Module: Fanforce::CLI::Run

Defined in:
lib/fanforce/cli/run.rb

Class Method Summary collapse

Class Method Details

.bundle_install(dir) ⇒ Object



4
5
6
7
8
9
# File 'lib/fanforce/cli/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



45
46
47
48
49
50
51
# File 'lib/fanforce/cli/run.rb', line 45

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_addObject



37
38
39
# File 'lib/fanforce/cli/run.rb', line 37

def self.git_add
  `git add .`
end

.git_first_commitObject



41
42
43
# File 'lib/fanforce/cli/run.rb', line 41

def self.git_first_commit
  `git commit -m "initial fanforce commit"`
end

.git_initObject



31
32
33
34
35
# File 'lib/fanforce/cli/run.rb', line 31

def self.git_init
  response = `git init`
  `git config core.fileMode false`
  return response
end

.pow_create(app, root_domain) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/fanforce/cli/run.rb', line 11

def self.pow_create(app, root_domain)
  domain = "#{app._id}.#{root_domain}"

  symbolic_link = "#{ENV['HOME']}/.pow/#{domain.gsub('.gg','')}"
  File.delete(symbolic_link) if File.exists?(symbolic_link)
  `ln -s #{app.dir} #{symbolic_link}`
  puts "#{'Connected'.format(:bold,:green)} #{domain} to #{app.dir}/"
end

.pow_destroy(app, root_domain) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/fanforce/cli/run.rb', line 20

def self.pow_destroy(app, root_domain)
  domain = "#{app._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 #{app.dir}/"
  end
end