class DroidProj::Runner

Constants

POSSIBLE_FILES

Attributes

app[RW]
droidfile[RW]

Public Class Methods

new() click to toggle source
# File lib/droidproj/runner.rb, line 18
def initialize
  @possible_files = POSSIBLE_FILES.dup
end
run() click to toggle source
# File lib/droidproj/runner.rb, line 13
def run
  new.run
end

Public Instance Methods

eval_droidfile() click to toggle source
# File lib/droidproj/runner.rb, line 38
def eval_droidfile
  content = nil
  File.open(@droidfile, 'r') {|file|
    content = file.read
  }

  context = RunnerContext.new
  context.app = @app

  eval content, context.create_context.binding
end
find_droidfile_location() click to toggle source
# File lib/droidproj/runner.rb, line 50
def find_droidfile_location
  @possible_files.each do |file|
    return file if File.exist?(file)
  end
  nil
end
run() click to toggle source
# File lib/droidproj/runner.rb, line 22
def run
  @droidfile = find_droidfile_location

  raise "You need to supply a Droidfile in the current directory" if !@droidfile

  @app = DroidProj::Android::App.new(File.dirname(@droidfile))

  DroidProj::Logger.log "Evaluating Droidfile...".green
  eval_droidfile

  DroidProj::Logger.log "Creating filesystem...".green
  @app.create_filesystem!

  DroidProj::Logger.log "Done!".green
end