motion/rake -> motion/project

This commit is contained in:
Laurent Sansonetti
2011-12-04 18:04:49 +01:00
parent 9032d97cf1
commit 8198ff4caf
10 changed files with 38 additions and 36 deletions

View File

@@ -38,9 +38,9 @@ class CreateCommand < Command
File.open('Rakefile', 'w') do |io|
io.puts <<EOS
$:.unshift(\"#{$motion_libdir}\")
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = '#{app_name}'
end

View File

@@ -1,20 +1,22 @@
require 'motion/rake/app'
require 'motion/rake/config'
require 'motion/rake/builder'
require 'motion/project/app'
require 'motion/project/config'
require 'motion/project/builder'
desc "Build the project, then run the simulator"
task :default => :simulator
App = Motion::Project::App
namespace :build do
desc "Build the simulator version"
task :simulator do
Motion::App.build('iPhoneSimulator')
App.build('iPhoneSimulator')
end
desc "Build the iOS version"
task :ios do
Motion::App.build('iPhoneOS')
Motion::App.codesign('iPhoneOS')
App.build('iPhoneOS')
App.codesign('iPhoneOS')
end
desc "Build everything"
@@ -23,11 +25,11 @@ end
desc "Run the simulator"
task :simulator => ['build:simulator'] do
sim = File.join(Motion::App.config.bindir, 'sim')
sim = File.join(App.config.bindir, 'sim')
debug = (ENV['debug'] || '0') == '1' ? 1 : 0
app = Motion::App.config.app_bundle('iPhoneSimulator')
family = Motion::App.config.device_family_ints[0]
sdk_version = Motion::App.config.sdk_version
app = App.config.app_bundle('iPhoneSimulator')
family = App.config.device_family_ints[0]
sdk_version = App.config.sdk_version
sh "#{sim} #{debug} #{family} #{sdk_version} \"#{app}\""
end
@@ -36,29 +38,29 @@ task :archive => ['build:ios'] do
tmp = "/tmp/ipa_root"
sh "/bin/rm -rf #{tmp}"
sh "/bin/mkdir -p #{tmp}/Payload"
sh "/bin/cp -r \"#{Motion::App.config.app_bundle('iPhoneOS')}\" #{tmp}/Payload"
sh "/bin/cp -r \"#{App.config.app_bundle('iPhoneOS')}\" #{tmp}/Payload"
Dir.chdir(tmp) do
sh "/bin/chmod -R 755 Payload"
sh "/usr/bin/zip -q -r archive.zip Payload"
end
sh "/bin/cp #{tmp}/archive.zip \"#{Motion::App.config.archive}\""
sh "/bin/cp #{tmp}/archive.zip \"#{App.config.archive}\""
end
desc "Deploy on the device"
task :deploy => :archive do
deploy = File.join(Motion::App.config.bindir, 'deploy')
deploy = File.join(App.config.bindir, 'deploy')
flags = Rake.application.options.trace ? '-d' : ''
sh "#{deploy} #{flags} \"#{Motion::App.config.archive}\""
sh "#{deploy} #{flags} \"#{App.config.archive}\""
end
desc "Clear build objects"
task :clean do
rm_rf(Motion::App.config.build_dir)
rm_rf(App.config.build_dir)
end
desc "Show project config"
task :config do
map = Motion::App.config.variables
map = App.config.variables
map.keys.sort.each do |key|
puts key.ljust(22) + " : #{map[key].inspect}"
end

View File

@@ -1,12 +1,12 @@
module Motion
module Motion; module Project
class App
class << self
def config
@config ||= Motion::Config.new('.')
@config ||= Motion::Project::Config.new('.')
end
def builder
@builder ||= Motion::Builder.new
@builder ||= Motion::Project::Builder.new
end
def setup
@@ -23,4 +23,4 @@ module Motion
end
end
end
end
end; end

View File

@@ -1,4 +1,4 @@
module Motion
module Motion; module Project;
class Builder
include Rake::DSL if Rake.const_defined?(:DSL)
@@ -235,4 +235,4 @@ PLIST
sh "CODESIGN_ALLOCATE=\"#{codesign_allocate}\" /usr/bin/codesign -f -s \"#{config.codesign_certificate}\" --resource-rules=\"#{resource_rules_plist}\" \"#{bundle_path}\""
end
end
end
end; end

View File

@@ -1,4 +1,4 @@
module Motion
module Motion; module Project
class Config
VARS = []
@@ -270,4 +270,4 @@ DATA
end
end
end
end
end; end

View File

@@ -1,7 +1,7 @@
$:.unshift('../../lib')
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'Hello'
app.icons << 'icon.png'

View File

@@ -1,7 +1,7 @@
$:.unshift('../../lib')
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'MapView'
app.frameworks << 'CoreLocation'

View File

@@ -1,7 +1,7 @@
$:.unshift('../../lib')
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'Paint'
app.frameworks << 'AVFoundation'

View File

@@ -1,7 +1,7 @@
$:.unshift('../../lib')
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'TableView'
end

View File

@@ -1,7 +1,7 @@
$:.unshift('../../lib')
require 'motion/rake'
require 'motion/project'
Motion::App.setup do |app|
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'Tweets'
end