fix erb processing for good
This commit is contained in:
parent
b3274c7e34
commit
1b97fa6078
|
@ -35,6 +35,7 @@ Feature: Gemfiles
|
||||||
Scenario: Simple env
|
Scenario: Simple env
|
||||||
Given I have the file "Gemfile.erb" with the content:
|
Given I have the file "Gemfile.erb" with the content:
|
||||||
"""
|
"""
|
||||||
|
gem 'test'
|
||||||
<% env :local do %>
|
<% env :local do %>
|
||||||
gem 'test'
|
gem 'test'
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -44,7 +45,9 @@ Feature: Gemfiles
|
||||||
"""
|
"""
|
||||||
# generated by penchant, environment: local
|
# generated by penchant, environment: local
|
||||||
gem 'test'
|
gem 'test'
|
||||||
|
gem 'test'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Use placeholder expansion
|
Scenario: Use placeholder expansion
|
||||||
Given I have the file "Gemfile.erb" with the content:
|
Given I have the file "Gemfile.erb" with the content:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
@fakefs
|
@fakefs
|
||||||
Feature: Gemfiles
|
Feature: Gemfiles
|
||||||
@wip
|
|
||||||
Scenario: Process a pure Ruby gemfile
|
Scenario: Process a pure Ruby gemfile
|
||||||
Given I have the file "Gemfile.penchant" with the content:
|
Given I have the file "Gemfile.penchant" with the content:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,6 +2,8 @@ Then /^the file "(.*?)" should have the following stripped content:$/ do |file,
|
||||||
test_lines = string.lines.to_a
|
test_lines = string.lines.to_a
|
||||||
|
|
||||||
File.read(file).lines.collect(&:strip).reject(&:empty?).to_a.each do |line|
|
File.read(file).lines.collect(&:strip).reject(&:empty?).to_a.each do |line|
|
||||||
|
raise StandardError.new if test_lines.empty?
|
||||||
|
|
||||||
line.strip.should == test_lines.shift.strip
|
line.strip.should == test_lines.shift.strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -183,6 +183,7 @@ module Penchant
|
||||||
def env(check, template = {}, &block)
|
def env(check, template = {}, &block)
|
||||||
if check.to_s == @environment.to_s
|
if check.to_s == @environment.to_s
|
||||||
original_erbout = @_erbout.dup
|
original_erbout = @_erbout.dup
|
||||||
|
@_erbout = ''
|
||||||
|
|
||||||
output = instance_eval(&block).lines.to_a
|
output = instance_eval(&block).lines.to_a
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Penchant
|
module Penchant
|
||||||
VERSION = "0.2.3"
|
VERSION = "0.2.4"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue