mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-22 15:55:44 +08:00
Added pm binary with command.
This commit is contained in:
@@ -2,6 +2,7 @@ PATH
|
||||
remote: .
|
||||
specs:
|
||||
ProMotion (1.0.4)
|
||||
methadone
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
@@ -10,6 +11,8 @@ GEM
|
||||
formotion (1.3.1)
|
||||
bubble-wrap (>= 1.1.4)
|
||||
motion-require (~> 0.0.3)
|
||||
methadone (1.3.0)
|
||||
bundler
|
||||
motion-redgreen (0.1.0)
|
||||
motion-require (0.0.6)
|
||||
motion-stump (0.2.1)
|
||||
|
||||
@@ -15,8 +15,10 @@ Gem::Specification.new do |gem|
|
||||
gem.license = 'MIT'
|
||||
|
||||
gem.files = `git ls-files`.split($\)
|
||||
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
||||
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
||||
# gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
||||
# gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
||||
gem.executables << "pm"
|
||||
gem.test_files = gem.files.grep(%r{^(spec)/})
|
||||
gem.name = "ProMotion"
|
||||
gem.require_paths = ["lib"]
|
||||
gem.version = ProMotion::VERSION
|
||||
@@ -26,4 +28,5 @@ Gem::Specification.new do |gem|
|
||||
gem.add_development_dependency("motion-redgreen")
|
||||
gem.add_development_dependency("formotion")
|
||||
gem.add_development_dependency("rake")
|
||||
gem.add_dependency("methadone")
|
||||
end
|
||||
|
||||
45
bin/pm
Executable file
45
bin/pm
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'optparse'
|
||||
require 'methadone'
|
||||
require 'ProMotion/version'
|
||||
|
||||
class App
|
||||
include Methadone::Main
|
||||
include Methadone::CLILogging
|
||||
include Methadone::SH
|
||||
|
||||
main do |command, opt|
|
||||
case command.to_sym
|
||||
when :new then create(opt)
|
||||
when :help then show_help
|
||||
else show_help
|
||||
end
|
||||
|
||||
0 # Good!
|
||||
end
|
||||
|
||||
def self.show_help
|
||||
info "pm - Command line tools for ProMotion."
|
||||
info "By Jamon Holmgren"
|
||||
info ""
|
||||
info "Commands:"
|
||||
info " new <appname>"
|
||||
info " Creates a new ProMotion app from a template."
|
||||
end
|
||||
|
||||
def self.create(name)
|
||||
return puts "Usage: pm new <appname>" unless name.to_s.length > 0
|
||||
info "Creating new ProMotion iOS app #{name}"
|
||||
sh "motion create --template=git@github.com:jamonholmgren/promotion-template.git #{name}"
|
||||
end
|
||||
|
||||
description "Command line for ProMotion."
|
||||
|
||||
arg :command
|
||||
arg :opt, :optional
|
||||
|
||||
version ProMotion::VERSION
|
||||
|
||||
go!
|
||||
end
|
||||
Reference in New Issue
Block a user