Class: Adva::Generators::Gemfile

Inherits:
Object
  • Object
show all
Defined in:
lib/adva/generators/gemfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, options = {}) ⇒ Gemfile

Returns a new instance of Gemfile.



6
7
8
9
10
11
# File 'lib/adva/generators/gemfile.rb', line 6

def initialize(target, options = {})
  self.engines = options[:engines]
  @target  = Pathname.new(target)
  @source  = options[:source] || raise('no source given') # TODO [cli] should bubble up to find the current Gemfile
  @engines = engines
end

Instance Attribute Details

#enginesObject

Returns the value of attribute engines.



4
5
6
# File 'lib/adva/generators/gemfile.rb', line 4

def engines
  @engines
end

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'lib/adva/generators/gemfile.rb', line 4

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/adva/generators/gemfile.rb', line 4

def target
  @target
end

Instance Method Details

#writeObject



13
14
15
# File 'lib/adva/generators/gemfile.rb', line 13

def write
  File.open(target, 'w+') { |f| f.write(with_engines) }
end