Class: Machete::App

Inherits:
Object
  • Object
show all
Includes:
SystemHelper
Defined in:
lib/machete/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SystemHelper

#run_cmd

Methods included from Logger

log_to, logger, #logger

Constructor Details

#initialize(app_name, cmd = '') ⇒ App

Returns a new instance of App.



10
11
12
13
# File 'lib/machete/app.rb', line 10

def initialize(app_name, cmd='')
  @app_name = app_name
  @cmd = cmd
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



8
9
10
# File 'lib/machete/app.rb', line 8

def app_name
  @app_name
end

#outputObject (readonly)

Returns the value of attribute output.



8
9
10
# File 'lib/machete/app.rb', line 8

def output
  @output
end

Instance Method Details

#homepage_htmlObject



27
28
29
# File 'lib/machete/app.rb', line 27

def homepage_html
  HTTParty.get("http://#{url}").body
end

#push(with_db) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/machete/app.rb', line 15

def push(with_db)
  Dir.chdir("test_applications/#{app_name}")
  run_cmd("cf delete -f #{app_name}")
  if with_db
    run_cmd("cf push #{app_name} --no-start")
    run_cmd("cf bind-service #{app_name} lilelephant")
  end
  command = "cf push #{app_name} -b ruby-integration-test"
  command = command + " -c '#{@cmd}'" unless @cmd.empty?
  @output = run_cmd(command)
end

#urlObject



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

def url
  run_cmd("cf app #{app_name} | grep url").split(' ').last
end