Sha256: 9a68035a8d578158ed86650c8fe83e23e6a37b2e06bc916caf563b782422169c

Contents?: true

Size: 886 Bytes

Versions: 7

Compression:

Stored size: 886 Bytes

Contents

module Reflection
  module CLI
    class << self

      def run!(args = nil)
        config = Reflection::Config.parse(args)

        if verify_config(config) == false
          Reflection::Support.exit_with_error("Ahh ja, missing arguments. Please read 'reflection --help' to get a feeling of how it works.")
        else
          case config.command
            when :apply
              Reflection::Command::Apply.run!(config)
            when :stash
              Reflection::Command::Stash.run!(config)
            else
              Reflection::Support.exit_with_error("Couldn't identify command. Please run 'reflection --help'.")
          end
        end
      end


      private

        def verify_config(config)
          return ([:stash, :apply].include?(config.command) && !config.repository.nil? && !config.directory.nil?) ? config : false
        end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reflection-0.4.6 lib/reflection/cli.rb
reflection-0.4.5 lib/reflection/cli.rb
reflection-0.4.4 lib/reflection/cli.rb
reflection-0.4.3 lib/reflection/cli.rb
reflection-0.4.1 lib/reflection/cli.rb
reflection-0.4.0 lib/reflection/cli.rb
reflection-0.3.1 lib/reflection/cli.rb