class Souschef::Gemfile

Gemfile generator

Attributes

opts[RW]

Public Class Methods

new(opts) click to toggle source
Calls superclass method
# File lib/souschef/gemfile.rb, line 6
def initialize(opts)
  @opts = opts
  super(yaml_file_location)
end

Public Instance Methods

write() click to toggle source

Public - Writes down the Gemfile location

Returns nil

# File lib/souschef/gemfile.rb, line 14
def write
  Souschef::Print.info 'Populating Gemfile' if @opts[:verbose]
  write_gemfile
end

Private Instance Methods

gemfile_location() click to toggle source

Private - Return location of Gemfile

Returns string

# File lib/souschef/gemfile.rb, line 31
def gemfile_location
  File.join(@opts[:path], 'Gemfile')
end
write_gemfile() click to toggle source

Private - Write Gemfile data

Returns nil

# File lib/souschef/gemfile.rb, line 38
def write_gemfile
  File.open(gemfile_location, 'w') { |file| file.write(output) }
end
yaml_file_location() click to toggle source

Private - Return location of YAML file

Returns String

# File lib/souschef/gemfile.rb, line 24
def yaml_file_location
  File.expand_path('../../../data/gemfile.yml', __FILE__)
end