fanforce-cli

The simplest way to create and manage a folder of Fanforce apps. 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 apps. It accepts any valid YAML markup. Below is a example file that sets a custom local path for the fanforce-app-factory gem, plus a version:

app_factory_gem:
    path: '../../fanforce-app-factory'
    version: '~> 0.1.3'

For more options see BitBucket and Heroku below.

Run Fanforce CLI Inside of an App

Sometimes you'll want to use cli commands inside a specific app. You can as long as the folder contains a config.ru file, and the app 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 apps 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 app if a bitbucket object is defined in your .fanforce-cli file:

bitbucket:
    user: apps-by-me
    password: password

Heroku Apps: Creating and Updating

A heroku app will be automatically setup for each new app if a heroku object is defined in your .fanforce-cli file. You'll need one for each environment (staging|production) you want apps setup for.

heroku:
    production:
        user: [email protected]
        git_ssh_domain: heroku_fanforce
        password: password
        app_domain: ffapp.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 [email protected]
  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 app 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:

constantcontact:
  - app-constantcontact
  - plugin-constantcontact-subscribers

facebook:
  - app-facebook
  - plugin-facebook-friends
  - plugin-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 apps that these ENV variables will be loaded into. Alternatively, you can specify the keyword ALL if those ENV variables should be loaded into all apps.

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):

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 apps:

fanforce iron upload:development

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