Class: DroidProj::Runner
- Inherits:
-
Object
- Object
- DroidProj::Runner
- Defined in:
- lib/droidproj/runner.rb
Constant Summary collapse
- POSSIBLE_FILES =
[ 'droidfile', 'Droidfile', 'droidfile.rb', 'Droidfile.rb' ].freeze
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#droidfile ⇒ Object
Returns the value of attribute droidfile.
Class Method Summary collapse
Instance Method Summary collapse
- #eval_droidfile ⇒ Object
- #find_droidfile_location ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
18 19 20 |
# File 'lib/droidproj/runner.rb', line 18 def initialize @possible_files = POSSIBLE_FILES.dup end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
10 11 12 |
# File 'lib/droidproj/runner.rb', line 10 def app @app end |
#droidfile ⇒ Object
Returns the value of attribute droidfile.
10 11 12 |
# File 'lib/droidproj/runner.rb', line 10 def droidfile @droidfile end |
Class Method Details
.run ⇒ Object
13 14 15 |
# File 'lib/droidproj/runner.rb', line 13 def run new.run end |
Instance Method Details
#eval_droidfile ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# 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 ⇒ Object
50 51 52 53 54 55 |
# 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 ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |