Class: Aigu::CLI
- Inherits:
-
Object
- Object
- Aigu::CLI
- Defined in:
- lib/aigu/cli.rb
Constant Summary collapse
- COMMANDS =
{ 'rails-import' => 'RailsImporter', 'rails-export' => 'RailsExporter', 'android-import' => 'AndroidImporter', 'android-export' => 'AndroidExporter', 'core-import' => 'CoreImporter', 'core-export' => 'CoreExporter', 'ios-import' => 'IOSImporter', 'ios-export' => 'IOSExporter', 'ember-import' => 'EmberImporter', 'ember-export' => 'EmberExporter', 'ember-pod-import' => 'EmberPodImporter', 'ember-pod-export' => 'EmberPodExporter', 'ember-engine-import' => 'EmberEngineImporter', 'ember-engine-export' => 'EmberEngineExporter' }.freeze
Instance Method Summary collapse
-
#initialize(env, argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(env, argv) ⇒ CLI
Returns a new instance of CLI.
20 21 22 23 24 25 26 27 28 |
# File 'lib/aigu/cli.rb', line 20 def initialize(env, argv) @env = env @command = argv.first =~ /^[^-]/ ? argv.shift : nil @command = @command.tr('_', '-') if @command @argv = argv @options = {} @options = (@options) @options = (@options) end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/aigu/cli.rb', line 30 def run if COMMANDS[@command] service_class = Aigu.const_get(COMMANDS[@command]) else puts "The #{@command} command doesn’t exist. Nice try." exit 0 end service_object = service_class.new(@options) service_object.process! end |