Class: Travish::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/travish.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Runner

– faffing



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

def initialize(args)
  # find a command
  @params = args
  command = @params[0].to_sym rescue :help
  commands.include?(command) ? send(command.to_sym) : help
end

Instance Method Details

#helpObject



8
9
10
11
12
13
14
15
16
# File 'lib/travish.rb', line 8

def help
  puts ""
  puts "Travish - emulates the OSX experience for travis."
  puts ""
  puts "          run     - Runs the .travis.yml."
  puts "          script  - Runs only the \"script\" portion of .travis.yml."
  puts ""
  puts "                                               ./"
end

#runObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/travish.rb', line 18

def run
  validate
  travis_file = default_yml.merge local_travis_yml
  parser = EnvironmentParser.new(travis_file.fetch('env', {}).fetch('global', {}), ENV)

  run_commands(travis_file["before_install"], parser.environment_hash)
  run_commands(travis_file["install"], parser.environment_hash)
  run_commands(travis_file["before_script"], parser.environment_hash)
  run_commands(travis_file["script"], parser.environment_hash)
end

#scriptObject



29
30
31
32
33
34
35
# File 'lib/travish.rb', line 29

def script
  validate
  travis_file = default_yml.merge local_travis_yml
  parser = EnvironmentParser.new(travis_file.fetch('env', {}).fetch('global', {}), ENV)

  run_commands(travis_file["script"], parser.environment_hash)
end