# fanforce-cli The simplest way to create and manage a folder of Fanforce plugins. This gem provides bulk commands that you can run against your entire list. ## Installation Run this command from your command line: gem install fanforce-cli ## Usage Run this command to view usage instructions $ fanforce ## Customizing Your Fanforce CLI Setup with .fanforce-cli You can add a .fanforce-cli to any fanforce folder you've setup for your plugins. It accepts any valid YAML markup. Below is a example file that sets a custom local path for the fanforce-plugin-factory gem, plus a version: ```yaml plugin_factory_gem: path: '../../fanforce-plugin-factory' version: '>= 1.6.0' ``` For more options see BitBucket and Heroku below. ## Run Fanforce CLI Inside of a Plugin Sometimes you'll want to use cli commands inside a specific plugin. You can as long as the folder contains a config.ru file, and the plugin is a subdirectory of a fanforce folder containing a .fanforce-cli file. ## Supercharge Your Fanforce CLI Fanforce-cli comes with a special application when you're running commands on a long list of plugins and each command is taking a long time to run. It forks each command and runs them in parallel. Only a subset of the full cli commands are available with fanforce-supercharge. Run the following from your terminal to see your available options: ``` fanforce-supercharge ``` ## BitBucket: Creating Repositories and Pushing A BitBucket repository will be automatically setup for each new plugin if a bitbucket object is defined in your .fanforce-cli file: ```yaml bitbucket: user: plugins-by-me password: password ``` ## Heroku Apps: Creating and Updating A heroku app will be automatically setup for each new plugin if a heroku object is defined in your .fanforce-cli file. You'll need one for each environment (staging|production) you want plugins setup for. ```yaml heroku: production: user: technical@fanforce.com git_ssh_domain: heroku_fanforce password: password app_domain: ffplugin.io short_domain: fanforce.io ``` The git_ssh_domain variable listed above is needed if you're pushing to multiple Heroku accounts as you'll need to specify the SSH key that must be used (each Heroku account requires a unique ssh key). For example, the above git_ssh_domain variable references the following lines in ~/.ssh/config: ``` Host heroku_fanforce HostName heroku.com User technical@fanforce.com IdentityFile ~/.ssh/heroku_fanforce ``` See http://www.springloops.com/blog/git-config-for-mutiply-ssh-keys/ for more info. ## Environment Variables Fanforce CLI allows you to setup a list of env variables that can be loaded by your plugin it's running in your local development environment, pushed to Heroku, or tasks setup on IronWorker. First, you need to setup a folder called ".env" in your fanforce folder with a series of YAML files inside. The only required file is _bind.yaml: ```yaml constantcontact: - constantcontact - constantcontact-subscribers facebook: - facebook - facebook-friends - facebook-posts iron: ALL ``` Each key is the filename (minus .yaml) of the YAML file holding a list of ENV variables. The array underneath is the folder names of plugins that these ENV variables will be loaded into. Alternatively, you can specify the keyword ALL if those ENV variables should be loaded into all plugins. Second, you'll need to setup the filenames references in _bind.yaml. Each file contains a hash of ENV key/values organized by RACK_ENV. Here's is an example of facebook.yaml (of course, you'll need to provide legit facebook api_keys and api_secrets): ```yaml development: api_key: 175620799120142 api_secret: b4e86cbf9db2ch5777609396b1d0a52f staging: api_key: 362017347478160 api_secret: cf3605c0cnda02c95ddd1bb983a59e7a ``` ## Using IronWorker Fanforce CLI comes with built in support for using IronWorker in your plugins: ``` fanforce push development iron ``` There are a couple things you'll want to setup first: #### 1. Env Variables - IRON_TOKEN - IRON_PROJECT_ID #### 2. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request