This repository has been archived by the owner on Feb 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
138 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
# -*- encoding: utf-8 -*- | |||
|
|||
require 'colored' | |||
|
|||
module Alloy::Command | |||
|
|||
class Build | |||
def initialize(platform) | |||
@platform = platform | |||
end | |||
|
|||
def execute | |||
if @platform == 'iphone' | |||
build :device => 'iphone' | |||
elsif @platform == 'android' | |||
build :device => 'android' | |||
else | |||
raise ArgumentError, "Platform '#{@platform}' is invalid" | |||
end | |||
|
|||
true | |||
end | |||
|
|||
private | |||
|
|||
def build(options = {}) | |||
options[:device] ||= 'iphone' | |||
|
|||
config = Alloy::Config.new | |||
|
|||
puts "Building with Titanium... (DEVICE_TYPE: #{options[:device]})".blue | |||
case options[:device] | |||
when 'android' | |||
system %Q{bash -c "#{config.titanium_android_builder} run '#{config.project_root}/' #{config.android_sdk_path} #{config.app_id} #{config.app_name} #{options[:device]} " #{Alloy::PERL_COLOR_FILTER}} | |||
when 'iphone' | |||
begin | |||
system %Q{bash -c "#{config.titanium_iphone_builder} run '#{config.project_root}/' #{config.iphone_sdk_version} #{config.app_id} #{config.app_name} #{options[:device]}" #{Alloy::PERL_COLOR_FILTER}} | |||
rescue => e | |||
puts e.message.red | |||
system %Q{killall "iPhone Simulator"} | |||
end | |||
end | |||
end | |||
|
|||
end | |||
|
|||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
# -*- encoding: utf-8 -*- | |||
|
|||
require 'colored' | |||
require 'fileutils' | |||
|
|||
module Alloy::Command | |||
|
|||
class Clean | |||
def initialize(platform) | |||
@platform = platform | |||
end | |||
|
|||
def execute | |||
case @platform | |||
when 'android' | |||
clean :device => 'android' | |||
when 'iphone' | |||
clean :device => 'iphone' | |||
when nil | |||
clean :device => 'android' | |||
clean :device => 'iphone' | |||
else | |||
raise ArgumentError, "Platform '#{@platform}' is invalid" | |||
end | |||
|
|||
true | |||
end | |||
|
|||
private | |||
|
|||
def clean(options = {}) | |||
case options[:device] | |||
when 'android' | |||
FileUtils.rm_r Dir.glob('build/android/*'), :force => true | |||
puts "Cleaned build/android".blue | |||
when 'iphone' | |||
FileUtils.rm_r Dir.glob('build/iphone/*'), :force => true | |||
puts "Cleaned build/iphone".blue | |||
end | |||
end | |||
end | |||
|
|||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
# -*- encoding: utf-8 -*- | |||
|
|||
require 'colored' | |||
|
|||
module Alloy::Command | |||
|
|||
class CoffeeScript | |||
def execute | |||
compile_coffee | |||
end | |||
|
|||
private | |||
|
|||
def compile_coffee | |||
puts "Compiling CoffeeScript".blue | |||
|
|||
failed = false | |||
paths = `find app -name '*.coffee'`.split("\n") | |||
|
|||
paths.each do |path| | |||
out_dir = path.gsub(/^app/, 'Resources').gsub(/\/[\w-]*\.coffee$/,"") | |||
unless system "coffee -c -b -o #{out_dir} #{path}" | |||
puts "Compilation failed: #{path}".red | |||
failed = true | |||
end | |||
end | |||
|
|||
puts "Successfully compiled CoffeeScript".green unless failed | |||
not failed | |||
end | |||
end | |||
|
|||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters