#!/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(opt) else help end 0 end def self.help info "Command line tools for MotionPrime" info "Commands:" info " new " info " Creates a new MotionPrime app from a template." end def self.create(name) return puts "Usage: prime new " unless name.to_s.length > 0 info "Creating new MotionPrime iOS app: #{name}" result = sh "motion create #{name} --template=git://github.com/droidlabs/motion-prime.git" if result == 0 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" else info "-------------------------------------" info "Unable to create RubyMotion template" info "Please create template manually" info "1. git clone git://github.com/droidlabs/motion-prime.git" info "2. cp motion-prime/files #{name}" info "3. cd ./#{name}" info "4. bundle" info "-------------------------------------" end end description "Command line tools for MotionPrime" arg :command arg :opt, :optional version MotionPrime::VERSION go! end