Module: Fanforce::Factory::Run
- Defined in:
- lib/fanforce/factory/run.rb
Class Method Summary collapse
- .bundle_install(dir) ⇒ Object
- .command(command, print_now = true) ⇒ Object
- .git_add ⇒ Object
- .git_first_commit ⇒ Object
- .git_init ⇒ Object
- .pow_create(addon, root_domain) ⇒ Object
- .pow_destroy(addon, root_domain) ⇒ Object
Class Method Details
.bundle_install(dir) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/fanforce/factory/run.rb', line 4 def self.bundle_install(dir) Dir.chdir(dir) do command('gem install bundler') if Gem::Specification::find_all_by_name('bundler').empty? command('bundle install') end end |
.command(command, print_now = true) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/fanforce/factory/run.rb', line 43 def self.command(command, print_now=true) output = [] PTY.spawn(command) do |stdin, stdout, pid| stdin.each { |line| output << line; print line if print_now } end output.join("\n") end |
.git_add ⇒ Object
35 36 37 |
# File 'lib/fanforce/factory/run.rb', line 35 def self.git_add `git add .` end |
.git_first_commit ⇒ Object
39 40 41 |
# File 'lib/fanforce/factory/run.rb', line 39 def self.git_first_commit `git commit -m "initial factory commit"` end |
.git_init ⇒ Object
31 32 33 |
# File 'lib/fanforce/factory/run.rb', line 31 def self.git_init `git init` end |
.pow_create(addon, root_domain) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/fanforce/factory/run.rb', line 11 def self.pow_create(addon, root_domain) domain = "#{addon._id}.#{root_domain}" symbolic_link = "#{ENV['HOME']}/.pow/#{domain.gsub('.gg','')}" File.delete(symbolic_link) if File.exists?(symbolic_link) `ln -s #{addon.dir} #{symbolic_link}` puts "#{'Connected'.format(:bold,:green)} #{domain} to #{addon.dir}/" end |
.pow_destroy(addon, root_domain) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fanforce/factory/run.rb', line 20 def self.pow_destroy(addon, root_domain) domain = "#{addon._id}.#{root_domain}" symbolic_link = "#{ENV['HOME']}/.pow/#{domain.gsub('.gg','')}" if File.exists?(symbolic_link) File.delete(symbolic_link) puts "#{'Removed'.format(:bold,:green)} #{domain}" else puts "#{'Already Removed'.format(:bold,:green)} #{domain} to #{addon.dir}/" end end |