7.2.0 • Published 5 years ago

fh-fhc v7.2.0

Weekly downloads
265
License
MIT
Repository
github
Last release
5 years ago

FHC - FeedHenry Command Line Interface NPM version

FeedHenry CLI, the command line interface to FeedHenry.

Installation

fhc should now be available on your command line. fhc -v will tell you what version of fhc you have installed.

Usage

From the Command Line

To see the list of commands available, just run fhc. See fhc help for general help, or fhc help <someCommand> for help on a specific command.

Getting started

To get started with fhc, set the FeedHenry target and then login:

$ fhc target https://apps.feedhenry.com

$ fhc login <your-email-address> <your-password>

Examples of usage

To list your projects, use:

$ fhc projects

To create an app from a git repository use:

fhc app create --project=SomeProjectId --title=WelcomeApp --type=cloud_nodejs --repo=git://github.com/feedhenry-templates/welcome-app.git

As a Node.js Module

You can also use fh-fhc as a Node.js module in your scripts. This is useful for scripting automated tests, mobile app client builds and cloud deploys.

First, install & add it to your project dependencies by doing npm install --save fh-fhc from your project root.

Then, you can require it in your code like so:

var fhc = require('./lib/fhc');
fhc.load(function(err) {
  if (err) {
    // Something went wrong
  }
  // FHC started up OK - we can now perform commands, like listing projects:
  fhc.projects.list({json:true}, function(err, projects) {
    if (err) {
      // Handle error
    }
    console.log(projects);
  });
});

The commands require params to be passed in - these are typically passed like:

fhc.projects.list({ title : 'Some title', project : 'someProjectId'}, function() {});

Note : To force the result to be a json object use the json: true parameter

From Docker

To use FHC via docker, run commands like:

$ docker run -v $HOME:/root -it feedhenry/fhc target https://rhmap.cup.feedhenry.io

We mount $HOME into the the container to persist configuration in ~/.fhcrc & ~/.fhctargets on the host. You may want to alias this docker run command to fhc, by adding an alias to your shell's config:

alias fhc='docker run -v $HOME:/root -it feedhenry/fhc'

Now you'll be able to run commands similar to:

fhc target https://rhmap.cup.feedhenry.io

Building & Releasing for Docker

To build:

$ docker build -t feedhenry/fhc .

Get your Image ID via:

$ docker images | grep fhc
feedhenry/fhc          latest              0618027d8d57        8 minutes ago       749 MB

Tag this as latest & the version in package.json:

$ docker tag 0618027d8d57 feedhenry/fhc:latest
$ docker tag 0618027d8d57 feedhenry/fhc:2.17.3

Push your images (you may need to log in):

$ docker push feedhenry/fhc

Finally, verify your push by visiting:

https://hub.docker.com/r/feedhenry/fhc/tags/

Extending

The latest version of fh-fhc updates the structure of commands:

lib
  cmd # all commands go here
    fh3      # RHMAP commands ( `E.g fhc.projects.list({})` )
    fhc      # FHC commands   ( `E.g target` )
    internal # internal piping goes here

The fh3 directory structure doesn't get exposed to the user, but everything underneath does - meaning we can have a command lib/cmd/common/fooGroup/barCommand.js, another lib/cmd/common/fh3/fooGroup/anotherCommand.js, and be able to run both fhc fooGroup barCommand and fhc fooGroup anotherCommand. Internal commands in the internal directory are hidden from help output, but are still call-able.

Writing new commands is a little different than before. Old commands export a function - new style commands export an object.

Commands are DRY'd up substantially - see App List lib/cmd/fh3/app/list.js as an example of what a command definition looks like. Using the 'demand' syntax, yargs look after all validation - you don't need to worry about it. Commands can be DRY'd up even more if they're very similar - e.g. app start. This extends from a base class - anything with an _ prefix doesn't go into the command tree.

There's no longer a need to require() new commands in many different places - no need to require() new commands at all, just put them in the relevant tree structure within lib/cmd. Tests are turbo'd, nock for mocks, coverage is at least a little better than before.

Setting a Proxy Server

fhc fhcfg set proxy http://host:port
# eg:
fhc fhcfg set proxy http://127.0.0.1:8080

Tests

$grunt test

Internationalization

All of the strings expecting to be internationalized have to be passed through i18n._() function like:

module.exports = {
  'desc': i18n._('Version info about the FeedHenry instance we\'re connected to'),
  ...
}

To get strings translated, we use Zanata, the web-based translation platform. The source strings file has to be uploaded into the Zanata server. That can be done with:

$grunt potupload

Prior to doing that, please make sure you have an account on the Zanata server. If not, please visit https://translate.zanata.org and follow up the steps at http://docs.zanata.org/en/release/user-guide/account/account-sign-up/ to create an account, and http://zanata-client.readthedocs.io/en/latest/configuration/ to store the API key into $HOME/.config/zanata.ini.

Node version :

FHC requires node 4.4.x version

Javascript style & syntax

Javascript style & syntax can be checked using:

$grunt eslint
  • eslint configuration is in .eslintrc.json
  • If eslint has any errors, the build will fail

Report Bug/Issue:

RHMAP Supportability

If you are targetting a version of RHMAP < 3.5.0 then install an older version of fh-fhc with npm install fh-fhc@latest-1.

Tags/Versions to install

If you want install an older version of fh-fhc you can do it by the available tags via the command npm install fh-fhc@<tag>. To check the available tags use the command npm view fh-fhc and check the dist-tags section. Following a list with the currently tags/versions available.

TagVersion
latest7.x
latest-11.2.0
latest-22.18.0-896
latest-44.2.5
7.2.0

5 years ago

7.1.1

6 years ago

7.1.0-1

6 years ago

7.1.0

6 years ago

4.2.5-6eef713

6 years ago

2.18.0-896

7 years ago

2.17.5-877

7 years ago

2.17.5-685

7 years ago

2.17.1-516

7 years ago

2.16.3-500

7 years ago

2.16.3-493

7 years ago

2.15.5-457

8 years ago

2.13.0-430

8 years ago

2.9.1-338

8 years ago

2.8.0-329

8 years ago

2.6.0-249

8 years ago

2.4.0-206

8 years ago

2.3.6-156

8 years ago

2.3.5-155

8 years ago

2.3.4-146

8 years ago

2.3.2-140

8 years ago

2.1.0

8 years ago

2.0.5

9 years ago

1.2.0

9 years ago

1.1.5

9 years ago

2.0.4-71

9 years ago

2.0.2-68

9 years ago

2.0.1-67

9 years ago

2.0.0-66

9 years ago

1.1.5-59

9 years ago

1.1.4-49

9 years ago

1.1.3-44

9 years ago

1.1.2-43

9 years ago

1.1.0-39

9 years ago

1.0.2-22

9 years ago

1.0.0-18

9 years ago

0.31.5-5

9 years ago

0.31.4-476

9 years ago

0.31.3-475

9 years ago

0.31.2-473

10 years ago

0.31.1-472

10 years ago

0.31.0-469

10 years ago

0.30.1-464

10 years ago

0.30.0-463

10 years ago

0.14.1-458

10 years ago

0.14.0-454

10 years ago

0.13.0-453

10 years ago

0.11.5-446

10 years ago

0.11.4-443

10 years ago

0.11.3-442

10 years ago

0.11.2-441

10 years ago

0.11.1-330

11 years ago

0.11.0-324

11 years ago

0.10.0-322

11 years ago

0.9.3-313

11 years ago

0.8.2-306

11 years ago

0.8.1-205

11 years ago

0.8.0-203

11 years ago

0.7.36-202

11 years ago

0.7.35-200

11 years ago

0.7.34-199

11 years ago

0.7.33-198

11 years ago

0.7.32-197

11 years ago

0.7.31-195

11 years ago

0.7.30-193

11 years ago

0.7.29-192

11 years ago

0.7.28-190

11 years ago

0.7.27-189

11 years ago

0.7.26-187

11 years ago

0.7.25-185

11 years ago

0.7.23-182

11 years ago

0.7.22-181

11 years ago

0.7.21-180

11 years ago

0.7.20-179

11 years ago

0.7.19-174

11 years ago

0.7.18-172

11 years ago

0.7.17-171

11 years ago

0.7.16-169

11 years ago

0.7.15-168

11 years ago

0.7.14-167

11 years ago

0.7.13-166

11 years ago

0.7.12-158

11 years ago

0.7.7-136

12 years ago

0.7.6-135

12 years ago

0.7.5-132

12 years ago

0.7.5-130

12 years ago

0.7.4-128

12 years ago

0.7.4-124

12 years ago

0.7.3-120

12 years ago

0.7.3-119

12 years ago

0.7.2-112

12 years ago

0.7.0-107

12 years ago

0.6.13-96

12 years ago

0.6.13-95

12 years ago

0.6.13-93

12 years ago

0.6.12-88

12 years ago

0.6.11-83

12 years ago

0.6.11-82

12 years ago

0.6.11-77

12 years ago

0.6.11-73

12 years ago

0.6.10-71

12 years ago

0.6.10-70

12 years ago

0.6.9-66

12 years ago

0.6.9-63

12 years ago

0.6.9-58

12 years ago

0.6.9-57

12 years ago

0.6.8-52

12 years ago

0.6.8-51

12 years ago

0.6.8-50

12 years ago

0.6.8-48

12 years ago

0.6.7-44

12 years ago

0.6.6-37

12 years ago

0.6.5-33

12 years ago

0.6.4-31

12 years ago

0.6.3-29

12 years ago

0.6.2-23

12 years ago

0.6.1-20

12 years ago

0.6.1-19

12 years ago

0.4.0-51

12 years ago

0.4.0-50

12 years ago

0.4.0-46

12 years ago

0.4.0-45

12 years ago

0.6.1-14

12 years ago

0.6.0-9

12 years ago

0.6.0-8

12 years ago

0.5.0-66

12 years ago