Class: GemfileRewrite

Inherits:
Parser::TreeRewriter
  • Object
show all
Defined in:
lib/rspec-puppet/tasks/release_test.rb

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/rspec-puppet/tasks/release_test.rb', line 135

def on_send(node)
  _, method_name, *args = *node

  if method_name == :gem
    gem_name = args.first
    if gem_name.type == :str && gem_name.children.first == 'rspec-puppet'
      gem_root = File.expand_path(File.join(__FILE__, '..', '..', '..', '..'))
      replace(node.location.expression, "gem 'rspec-puppet', :path => '#{gem_root}'")
    end
  end

  super
end