Class: Perkins::Build::Script

Inherits:
Object
  • Object
show all
Includes:
Helpers, Stages
Defined in:
lib/perkins/build/script.rb,
lib/perkins/build/script/go.rb,
lib/perkins/build/script/jdk.rb,
lib/perkins/build/script/rvm.rb,
lib/perkins/build/script/ruby.rb,
lib/perkins/build/script/stages.rb,
lib/perkins/build/script/bundler.rb,
lib/perkins/build/script/helpers.rb

Direct Known Subclasses

Go, Ruby

Defined Under Namespace

Modules: Bundler, Helpers, Jdk, RVM, Stages Classes: Go, Ruby

Constant Summary collapse

TEMPLATES_PATH =
File.expand_path('../script/templates', __FILE__)
STAGES =
{
  builtin: [:configure, :checkout, :pre_setup, :export, :setup, :announce],
  custom:  [:before_install, :install, :before_script, :script, :after_result, :after_script]
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#announce?, #before_install, #failure, #sh, #stacking

Methods included from Stages

#call_custom_stage, #run_builtin_stage, #run_stage, #run_stages

Constructor Details

#initialize(data, repo) ⇒ Script

Returns a new instance of Script.



63
64
65
66
67
68
69
70
# File 'lib/perkins/build/script.rb', line 63

def initialize(data, repo)
  @config = data #used in runner
  @repo = repo
  #@stack = []
  @data = Data.new({ config: self.class.defaults }.deep_merge(data.deep_symbolize_keys))
  @options = options
  @stack = [Shell::Script.new(echo: true, timing: true)]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



52
53
54
# File 'lib/perkins/build/script.rb', line 52

def data
  @data
end

#optionsObject (readonly)

Returns the value of attribute options.



52
53
54
# File 'lib/perkins/build/script.rb', line 52

def options
  @options
end

#repoObject (readonly)

Returns the value of attribute repo.



51
52
53
# File 'lib/perkins/build/script.rb', line 51

def repo
  @repo
end

#stackObject (readonly)

Returns the value of attribute stack.



51
52
53
# File 'lib/perkins/build/script.rb', line 51

def stack
  @stack
end

Class Method Details

.defaultsObject



55
56
57
# File 'lib/perkins/build/script.rb', line 55

def defaults
  self::DEFAULTS
end

Instance Method Details

#compileObject

run stages



73
74
75
76
77
78
79
80
# File 'lib/perkins/build/script.rb', line 73

def compile
  #run_stages if check_config
  #@stack.compact.join(" && ")
  raw template 'header.sh'
  run_stages.compact if check_config
  raw template 'footer.sh'
  sh.to_s
end