Class: Runner

Inherits:
Object
  • Object
show all
Includes:
SuprailsHelper
Defined in:
lib/runner.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SuprailsHelper

#debug, #delete, #file, #folder, #frozen_rails, #generate, #git, #gpl, #new_file, #plugin, #rails, #rake, #runinside, #save, #svn

Constructor Details

#initialize(app_name, runfile = "~/.suprails/config") ⇒ Runner

Returns a new instance of Runner.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/runner.rb', line 47

def initialize(app_name, runfile = "~/.suprails/config")
  Runner.init_variables(app_name, runfile)
  Dir["#{Runner.facets_source}/*.rb"].each{|x| load x }
  
  Facet.registered_facets.each do |name, facet|
    self.class.send(:define_method, name) {}
    instance_eval do
      self.class.send(:define_method, name) do |*args|
        args.unshift(Runner.app_name)
        facet.go *args
      end
    end
  end
end

Class Attribute Details

.app_nameObject

Returns the value of attribute app_name.



28
29
30
# File 'lib/runner.rb', line 28

def app_name
  @app_name
end

.baseObject

Returns the value of attribute base.



32
33
34
# File 'lib/runner.rb', line 32

def base
  @base
end

.facets_sourceObject

Returns the value of attribute facets_source.



31
32
33
# File 'lib/runner.rb', line 31

def facets_source
  @facets_source
end

.runfileObject

Returns the value of attribute runfile.



29
30
31
# File 'lib/runner.rb', line 29

def runfile
  @runfile
end

.sources(sourcefolder) ⇒ Object

Returns the value of attribute sources.



30
31
32
# File 'lib/runner.rb', line 30

def sources
  @sources
end

Class Method Details

.init_variables(app_name, runfile) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/runner.rb', line 38

def init_variables(app_name, runfile)
  @app_name = app_name
  @runfile = File.expand_path(runfile)
  @sources = File.expand_path('~/.suprails/sources/')
  @facets_source = File.expand_path('~/.suprails/facets/')
  @base = File.expand_path "./#{@app_name}"
end

Instance Method Details

#methodsObject



62
63
64
# File 'lib/runner.rb', line 62

def methods
  super.each{|x| puts x}
end

#runObject



66
67
68
69
70
71
72
73
# File 'lib/runner.rb', line 66

def run
  gems = Gems.new Runner.app_name
  db = DB.new Runner.app_name
  
  Dir.mkdir(Runner.base)
  text = File.read(Runner.runfile)
  instance_eval(text)
end