Class: MarsConfig
- Inherits:
-
Object
- Object
- MarsConfig
- Defined in:
- lib/mars_config.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
-
#stack ⇒ Object
Returns the value of attribute stack.
Instance Method Summary collapse
- #apply_stack ⇒ Object
- #create_project ⇒ Object
-
#initialize(args) ⇒ MarsConfig
constructor
A new instance of MarsConfig.
Constructor Details
#initialize(args) ⇒ MarsConfig
Returns a new instance of MarsConfig.
4 5 6 7 8 9 10 11 |
# File 'lib/mars_config.rb', line 4 def initialize(args) @project = args.first # @stack = JQUERY # if args.first and args.first.split(':')[0] == "stack" # @project = args.last # @stack = args.first.split(':')[1] == SENCHA ? SENCHA : JQUERY # end end |
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
2 3 4 |
# File 'lib/mars_config.rb', line 2 def project @project end |
#stack ⇒ Object
Returns the value of attribute stack.
2 3 4 |
# File 'lib/mars_config.rb', line 2 def stack @stack end |
Instance Method Details
#apply_stack ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mars_config.rb', line 25 def apply_stack # Eventually adding stacks # if @stack == SENCHA # FileUtils.cp_r File.dirname(__FILE__) + '/../lib/sencha/.', FileUtils.pwd + "/#{@project}/wwwroot" # elsif @stack == BLANK # # dont do anything # else # FileUtils.cp_r File.dirname(__FILE__) + '/../lib/public/.', FileUtils.pwd + "/#{@project}/wwwroot" # end FileUtils.cp_r File.dirname(__FILE__) + '/../lib/public/.', FileUtils.pwd + "/#{@project}/wwwroot" end |
#create_project ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mars_config.rb', line 13 def create_project # Build Directory and add setup files FileUtils.mkdir_p @project FileUtils.mkdir_p File.join(@project, 'wwwroot') FileUtils.mkdir_p File.join(@project, 'tmp') config_ru = ["require 'mars'","log = File.new('tmp/mars.log', 'a+')", "$stdout.reopen(log)", "$stderr.reopen(log)", "run Mars::App"].join("\n") File.open(File.join(@project, 'config.ru'),'w').write(config_ru) gemfile = ['source :gemcutter', "gem 'thin'", "gem 'mars'"].join("\n") File.open(File.join(@project, 'Gemfile'),'w').write(gemfile) end |