Sha256: 75aaf370cb7471fdb0ae8e66208a8a01169d45e4ea721ad1fea0c2276d364c3d

Contents?: true

Size: 1.44 KB

Versions: 16

Compression:

Stored size: 1.44 KB

Contents

module SalesforceStreamer
  class CLI
    def initialize(argv)
      @argv = argv
      @config = Configuration.instance
      setup_options
      @parser.parse! @argv
    end

    def run
      Launcher.new.run
    end

    private

    def setup_options
      @parser = OptionParser.new do |o|
        o.on '-C', '--config PATH', 'Load PATH as a config file' do |arg|
          @config.config_file = arg
        end

        o.on '-e', '--environment ENVIRONMENT', 'The environment to run the app on (default development)' do |arg|
          @config.environment = arg
        end

        o.on '-r', '--require PATH', 'Load PATH as the entry point to your application' do |arg|
          @config.require_path = arg
        end

        o.on '--verbose-restforce', 'Activate the Restforce logger' do
          @config.restforce_logger!
        end

        o.on '-v', '--verbose LEVEL', 'Set the log level (default no logging)' do |arg|
          @config.logger = Logger.new($stderr, level: arg)
        end

        o.on '-V', '--version', 'Print the version information' do
          puts "streamer version #{SalesforceStreamer::VERSION}"
          exit 0
        end

        o.on '-x', '--topics', 'Activate PushTopic Management (default off)' do
          @config.manage_topics = true
        end

        o.banner = 'bundle exec streamer OPTIONS'

        o.on_tail '-h', '--help', 'Show help' do
          puts o
          exit 0
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
salesforce_streamer-2.12.1 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.12.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.11.2 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.11.1 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.11.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.10.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.9.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.8.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.6.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.5.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.4.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.4.0.rc1 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.3.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.2.0 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.1.1 lib/salesforce_streamer/cli.rb
salesforce_streamer-2.1.0 lib/salesforce_streamer/cli.rb