bin/prime in motion-prime-0.8.12 vs bin/prime in motion-prime-0.9.0
- old
+ new
@@ -1,30 +1,35 @@
#!/usr/bin/env ruby
require 'optparse'
require 'methadone'
require_relative '../motion-prime/version'
-
class App
include Methadone::Main
include Methadone::CLILogging
include Methadone::SH
- main do |command, opt|
+ main do |command, *opts|
case command.to_sym
- when :new then create_base(opt)
- when :bootstrap then create_bootstrap(opt)
+ when :new then create_base(*opts)
+ when :bootstrap then create_bootstrap(*opts)
+ when :generate then generate(*opts)
+ when :g then generate(*opts)
else help
end
0
end
def self.help
info "Command line tools for MotionPrime"
info "Commands:"
info " new <appname>"
info " Creates a new MotionPrime app from a template."
+ info " generate scaffold <name>"
+ info " Creates a new MotionPrime scaffold from a template."
+ info " generate screen|model|table <name>"
+ info " Creates a new MotionPrime resource from a template."
end
def self.create_base(name)
create(name, "motion-prime", "git://github.com/droidlabs/motion-prime.git")
end
@@ -46,9 +51,14 @@
sh "cd ./#{name}; bundle install"
info "Command: pod setup"
sh "cd ./#{name}; pod setup"
info "Command: rake pod:install"
sh "cd ./#{name}; rake pod:install"
+ end
+
+ def self.generate(resource, name)
+ require_relative '../generators/generator'
+ MotionPrime::Generator.factory(resource).generate(name)
end
def self.home_path
ENV['HOME'].split('/')[0..2].join('/')
end
\ No newline at end of file