Sha256: 00397a940088985448d33c38038eef34ba33f0b7ebf982f554a155a77ab184a7
Contents?: true
Size: 1.89 KB
Versions: 13
Compression:
Stored size: 1.89 KB
Contents
#!/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| case command.to_sym when :new then create_base(opt) when :bootstrap then create_bootstrap(opt) 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." end def self.create_base(name) create(name, "motion-prime", "git://github.com/droidlabs/motion-prime.git") end def self.create_bootstrap(name) create(name, "prime_bootstrap", "git://github.com/motionprime/prime_bootstrap.git") end def self.create(name, template_name, repo) return puts "Usage: prime new <appname>" unless name.to_s.length > 0 info "Creating new MotionPrime iOS app: #{name}" if false sh "motion create #{name} --template=#{repo}" else clone_template(template_name, repo) sh "motion create #{name} --template=#{template_name}" end info "Command: bundle instal" 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.home_path ENV['HOME'].split('/')[0..2].join('/') end def self.clone_template(name, repo) path = File.expand_path(File.join(home_path, 'Library/RubyMotion/template', name)) git_clone(path, repo) end def self.git_clone(path, repo) if File.exist?(path) system("git --work-tree=#{path} --git-dir=#{path}/.git pull origin master") else system("git clone #{repo} #{path}") end end description "Command line tools for MotionPrime" arg :command arg :opt, :optional version MotionPrime::VERSION go! end
Version data entries
13 entries across 13 versions & 1 rubygems