bin/gram in gram-0.0.1 vs bin/gram in gram-0.1.0
- old
+ new
@@ -1,10 +1,15 @@
#!/usr/bin/env ruby
$: << 'lib'
require 'gram'
component = ARGV.shift
+action = ARGV.shift
args = ARGV
raise "Unknown Gram component. Available components are: #{Gram::COMPONENTS.join(', ')}" unless Gram::COMPONENTS.include?(component)
-eval("Gram::#{component.capitalize}").run(*args)
+component_klass = eval("Gram::#{component.capitalize}")
+
+raise "Unknown action for #{component} component.\n#{component_klass.banner}\n" unless component_klass::ACTIONS.keys.map(&:to_s).include?(action)
+
+component_klass.send(action, *args)