Skip to content

Commit

Permalink
Merge pull request #1 from notfunc/multiple-unity-installation
Browse files Browse the repository at this point in the history
Option for multiple Unity installation
  • Loading branch information
yokoe committed Jul 3, 2013
2 parents 191bd25 + 304fd28 commit 79641ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bin/echinoidea
Expand Up @@ -11,6 +11,7 @@ opt.on('-d') {|v| OPTS[:d] = v}
opt.on('-l') {|v| OPTS[:l] = v}
opt.on('-o VAL') {|v| OPTS[:o] = v }
opt.on('-t VAL') {|v| OPTS[:t] = v }
opt.on('-u VAL') {|v| OPTS[:u] = v }
opt.on('--development-mode') {|v| OPTS[:development_mode] = v}
opt.parse!(ARGV)

Expand Down Expand Up @@ -42,7 +43,7 @@ end
# load config
config = YAML.load_file([current_dir, "echinoidea.yml"].join("/"))

builder = Echinoidea::Builder.new(current_dir, config, OPTS[:l])
builder = Echinoidea::Builder.new(current_dir, config, OPTS[:l], OPTS[:u])
builder.output_directory = OPTS[:o]
builder.build_target = OPTS[:t] if OPTS[:t]
builder.development_mode = OPTS[:development_mode] if OPTS[:development_mode]
Expand Down
7 changes: 4 additions & 3 deletions lib/echinoidea/builder.rb
Expand Up @@ -12,13 +12,14 @@ def self.unique_builder_class_name
"ECBuilder#{Time.now.strftime('%y%m%d%H%M%S')}"
end

def initialize(root_directory, config, loggings_enabled = false)
def initialize(root_directory, config, loggings_enabled = false, unity_dir = nil)
@class_name = self.class.unique_builder_class_name
@root_directory = root_directory
@config = config
@build_target = "iPhone" # Default build target
@debug_mode = false
@loggings_enabled = true if loggings_enabled == true
@unity_dir = unity_dir || "/Applications/Unity/"
@development_mode = false

log "Initializing builder"
Expand Down Expand Up @@ -90,7 +91,7 @@ def remove_files
def run_unity_command
opts = debug_mode ? "" : "-quit -batchMode"
project_path = @root_directory.gsub(" ", "\\ ")
command = "/Applications/Unity/Unity.app/Contents/MacOS/Unity #{opts} -executeMethod #{@class_name}.Build -projectPath #{project_path}"
command = "#{@unity_dir}Unity.app/Contents/MacOS/Unity #{opts} -executeMethod #{@class_name}.Build -projectPath #{project_path}"
log "Running unity.app..."
log " #{command}"
`#{command}`
Expand All @@ -101,4 +102,4 @@ def run
run_unity_command
remove_files
end
end
end

0 comments on commit 79641ff

Please sign in to comment.