indentation 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/History.txt +7 -0
- data/Manifest.txt +0 -5
- data/README.rdoc +24 -0
- data/Rakefile +0 -1
- data/lib/indentation.rb +1 -1
- data/lib/indentation/array_mod.rb +1 -1
- data/lib/indentation/string_mod.rb +12 -2
- data/spec/indentation_spec.rb +26 -0
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +2 -2
- data/tasks/rspec.rake +6 -6
- metadata +17 -28
- data/features/development.feature +0 -13
- data/features/step_definitions/common_steps.rb +0 -168
- data/features/support/common.rb +0 -29
- data/features/support/env.rb +0 -15
- data/features/support/matchers.rb +0 -11
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 0.0.4 2011-02-17
|
2
|
+
* Fixed documentation to include find_least_indentation function
|
3
|
+
* Added options hash to find_least_indentation function with options to:
|
4
|
+
* Ignore blank lines (zero-length lines)
|
5
|
+
* Ignore empty lines (whitespace-only lines)
|
6
|
+
* Modified specs to use rspec >= 2.0
|
7
|
+
|
1
8
|
=== 0.0.3 2010-05-07
|
2
9
|
* Fixed documentation regarding installation and summary
|
3
10
|
|
data/Manifest.txt
CHANGED
@@ -3,11 +3,6 @@ Manifest.txt
|
|
3
3
|
PostInstall.txt
|
4
4
|
README.rdoc
|
5
5
|
Rakefile
|
6
|
-
features/development.feature
|
7
|
-
features/step_definitions/common_steps.rb
|
8
|
-
features/support/common.rb
|
9
|
-
features/support/env.rb
|
10
|
-
features/support/matchers.rb
|
11
6
|
lib/indentation.rb
|
12
7
|
lib/indentation/array_mod.rb
|
13
8
|
lib/indentation/string_mod.rb
|
data/README.rdoc
CHANGED
@@ -93,6 +93,30 @@ A small library of extensions to Ruby's Array and String classes that allow inde
|
|
93
93
|
#
|
94
94
|
# lazy
|
95
95
|
# typist
|
96
|
+
|
97
|
+
|
98
|
+
=== Find Least Indentation
|
99
|
+
|
100
|
+
# Given a String or Array of Strings, finds the least indentation on any line. Splits on newlines found within strings
|
101
|
+
# to find the least indentation within a multi-line String
|
102
|
+
" test".find_least_indentation # => 2
|
103
|
+
" three\n two \n one".find_least_indentation # => 1
|
104
|
+
[" two", " three", " four"].find_least_indentation # => 2
|
105
|
+
[" two", " three", [" four", " five\n one"]].find_least_indentation # => 1
|
106
|
+
|
107
|
+
# Option to ignore blank (no characters whatsoever) lines.
|
108
|
+
# Note, disabling this option will automatically disable :ignore_empty_lines
|
109
|
+
# Default => true
|
110
|
+
" three\n".find_least_indentation # => 3
|
111
|
+
" three\n".find_least_indentation(:ignore_blank_lines => false) # => 0
|
112
|
+
|
113
|
+
# Option to ignore both blank lines (no characters whatsoever) and empty lines (whitespace-only)
|
114
|
+
# Default => true
|
115
|
+
" three\n ".find_least_indentation # => 3
|
116
|
+
" three\n ".find_least_indentation(:ignore_empty_lines => false) # => 1
|
117
|
+
" three\n".find_least_indentation(:ignore_empty_lines => false) # => 3
|
118
|
+
" three\n".find_least_indentation(:ignore_empty_lines => false, :ignore_blank_lines => false) # => 0
|
119
|
+
|
96
120
|
|
97
121
|
== REQUIREMENTS:
|
98
122
|
|
data/Rakefile
CHANGED
data/lib/indentation.rb
CHANGED
@@ -55,7 +55,7 @@ class Array
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# Get the least indentation of all elements
|
58
|
-
def find_least_indentation
|
58
|
+
def find_least_indentation(options = {:ignore_blank_lines => true, :ignore_empty_lines => true})
|
59
59
|
self.collect{|array_element| array_element.find_least_indentation }.min
|
60
60
|
end
|
61
61
|
|
@@ -22,8 +22,18 @@ class String
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# Split across newlines and return the fewest number of indentation characters found on each line
|
25
|
-
def find_least_indentation
|
26
|
-
empty
|
25
|
+
def find_least_indentation(options = {:ignore_blank_lines => true, :ignore_empty_lines => true})
|
26
|
+
# Cannot ignore empty lines unless we're also ignoring blank lines
|
27
|
+
options[:ignore_blank_lines] = options[:ignore_empty_lines] ? true : options[:ignore_blank_lines]
|
28
|
+
empty? ? 0 : split("\n", -1).reject{|line|
|
29
|
+
if options[:ignore_empty_lines]
|
30
|
+
line.strip.empty?
|
31
|
+
elsif options[:ignore_blank_lines]
|
32
|
+
line.empty?
|
33
|
+
else
|
34
|
+
false
|
35
|
+
end
|
36
|
+
}.collect{|substr| substr.match(/^[ \t]*/).to_s.length}.min
|
27
37
|
end
|
28
38
|
|
29
39
|
# Find the least indentation of all lines within this string and remove that amount (if any)
|
data/spec/indentation_spec.rb
CHANGED
@@ -353,4 +353,30 @@ describe "README.rdoc" do
|
|
353
353
|
test_array = [["this", "is", "a", "test"], ["quick", "brown", "fox"], ["lazy", "typist"]]
|
354
354
|
test_array.append_separator("").join("\n").should == "this\nis\na\ntest\n\nquick\nbrown\nfox\n\nlazy\ntypist"
|
355
355
|
end
|
356
|
+
|
357
|
+
it "should have correct examples for find_least_indentation" do
|
358
|
+
|
359
|
+
# Given a String or Array of Strings, finds the least indentation on any line. Splits on newlines found within strings
|
360
|
+
# to find the least indentation within a multi-line String
|
361
|
+
" test".find_least_indentation # => 2
|
362
|
+
" three\n two \n one".find_least_indentation # => 1
|
363
|
+
[" two", " three", " four"].find_least_indentation # => 2
|
364
|
+
[" two", " three", [" four", " five\n one"]].find_least_indentation # => 1
|
365
|
+
|
366
|
+
# Option to ignore blank (no characters whatsoever) lines.
|
367
|
+
# Note, disabling this option will automatically disable :ignore_empty_lines
|
368
|
+
# Default => true
|
369
|
+
" three\n".find_least_indentation # => 3
|
370
|
+
" three\n".find_least_indentation(:ignore_blank_lines => false) # => 0
|
371
|
+
|
372
|
+
# Option to not only ignore both blank lines (no characters whatsoever) and empty lines (whitespace-only)
|
373
|
+
# Default => true
|
374
|
+
" three\n ".find_least_indentation # => 3
|
375
|
+
" three\n ".find_least_indentation(:ignore_empty_lines => false) # => 1
|
376
|
+
" three\n".find_least_indentation(:ignore_empty_lines => false) # => 3
|
377
|
+
" three\n".find_least_indentation(:ignore_empty_lines => false, :ignore_blank_lines => false) # => 0
|
378
|
+
end
|
379
|
+
|
380
|
+
|
381
|
+
|
356
382
|
end
|
data/spec/spec.opts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
-c -fd
|
data/spec/spec_helper.rb
CHANGED
data/tasks/rspec.rake
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
begin
|
2
|
-
require '
|
2
|
+
require 'rspec'
|
3
3
|
rescue LoadError
|
4
4
|
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
require '
|
5
|
+
require 'rspec'
|
6
6
|
end
|
7
7
|
begin
|
8
|
-
require '
|
8
|
+
require 'rspec/core/rake_task'
|
9
9
|
rescue LoadError
|
10
10
|
puts <<-EOS
|
11
11
|
To use rspec for testing you must install rspec gem:
|
@@ -15,7 +15,7 @@ EOS
|
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "Run the specs under spec/models"
|
18
|
-
|
19
|
-
t.
|
20
|
-
t.
|
18
|
+
RSpec::Core::RakeTask.new do |t|
|
19
|
+
t.rspec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
# t.files = FileList['spec/**/*_spec.rb']
|
21
21
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Samuel Dana
|
@@ -14,37 +15,25 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-02-17 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: hoe
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 41
|
27
30
|
segments:
|
28
31
|
- 2
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 2.
|
32
|
+
- 9
|
33
|
+
- 1
|
34
|
+
version: 2.9.1
|
32
35
|
type: :development
|
33
36
|
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: hoe
|
36
|
-
prerelease: false
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 2
|
43
|
-
- 6
|
44
|
-
- 0
|
45
|
-
version: 2.6.0
|
46
|
-
type: :development
|
47
|
-
version_requirements: *id002
|
48
37
|
description: A small library of extensions to Ruby's Array and String classes that allow indentation manipulation of Strings and Arrays of Strings. Has the capability of working with multi-line strings. If you frequently use String arrays to manipulate text, see synopsis (In README.rdoc) for examples of how indentation can make your life easier.
|
49
38
|
email:
|
50
39
|
- s.dana@prometheuscomputing.com
|
@@ -62,11 +51,6 @@ files:
|
|
62
51
|
- PostInstall.txt
|
63
52
|
- README.rdoc
|
64
53
|
- Rakefile
|
65
|
-
- features/development.feature
|
66
|
-
- features/step_definitions/common_steps.rb
|
67
|
-
- features/support/common.rb
|
68
|
-
- features/support/env.rb
|
69
|
-
- features/support/matchers.rb
|
70
54
|
- lib/indentation.rb
|
71
55
|
- lib/indentation/array_mod.rb
|
72
56
|
- lib/indentation/string_mod.rb
|
@@ -77,6 +61,7 @@ files:
|
|
77
61
|
- spec/spec.opts
|
78
62
|
- spec/spec_helper.rb
|
79
63
|
- tasks/rspec.rake
|
64
|
+
- .gemtest
|
80
65
|
has_rdoc: true
|
81
66
|
homepage: http://github.com/samueldana/indentation
|
82
67
|
licenses: []
|
@@ -93,23 +78,27 @@ rdoc_options:
|
|
93
78
|
require_paths:
|
94
79
|
- lib
|
95
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
96
82
|
requirements:
|
97
83
|
- - ">="
|
98
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
99
86
|
segments:
|
100
87
|
- 0
|
101
88
|
version: "0"
|
102
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
103
91
|
requirements:
|
104
92
|
- - ">="
|
105
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
106
95
|
segments:
|
107
96
|
- 0
|
108
97
|
version: "0"
|
109
98
|
requirements: []
|
110
99
|
|
111
100
|
rubyforge_project: indentation
|
112
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.5.2
|
113
102
|
signing_key:
|
114
103
|
specification_version: 3
|
115
104
|
summary: A small library of extensions to Ruby's Array and String classes that allow indentation manipulation of Strings and Arrays of Strings
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Development processes of newgem itself (rake tasks)
|
2
|
-
|
3
|
-
As a Newgem maintainer or contributor
|
4
|
-
I want rake tasks to maintain and release the gem
|
5
|
-
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
6
|
-
|
7
|
-
Scenario: Generate RubyGem
|
8
|
-
Given this project is active project folder
|
9
|
-
And "pkg" folder is deleted
|
10
|
-
When I invoke task "rake gem"
|
11
|
-
Then folder "pkg" is created
|
12
|
-
And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
|
13
|
-
And gem spec key "rdoc_options" contains /(--mainREADME.rdoc|\[\"--main\", \"README.rdoc\"\])/
|
@@ -1,168 +0,0 @@
|
|
1
|
-
Given /^this project is active project folder/ do
|
2
|
-
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
|
6
|
-
ENV[env_var] = value
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /"(.*)" folder is deleted/ do |folder|
|
10
|
-
in_project_folder { FileUtils.rm_rf folder }
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
14
|
-
@stdout = StringIO.new
|
15
|
-
in_project_folder do
|
16
|
-
if Object.const_defined?("APP_ROOT")
|
17
|
-
APP_ROOT.replace(FileUtils.pwd)
|
18
|
-
else
|
19
|
-
APP_ROOT = FileUtils.pwd
|
20
|
-
end
|
21
|
-
run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
|
22
|
-
end
|
23
|
-
File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
|
24
|
-
@stdout.rewind
|
25
|
-
f << @stdout.read
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
30
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
31
|
-
in_project_folder do
|
32
|
-
system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
37
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
38
|
-
in_project_folder do
|
39
|
-
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
44
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
45
|
-
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
46
|
-
in_project_folder do
|
47
|
-
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
When /^I invoke task "rake (.*)"/ do |task|
|
52
|
-
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
53
|
-
in_project_folder do
|
54
|
-
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
59
|
-
in_project_folder do
|
60
|
-
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
65
|
-
in_project_folder do
|
66
|
-
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
Then /^file with name matching "(.*)" is created/ do |pattern|
|
71
|
-
in_project_folder do
|
72
|
-
Dir[pattern].should_not be_empty
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
77
|
-
in_project_folder do
|
78
|
-
actual_output = File.read(file)
|
79
|
-
(does == 'does') ?
|
80
|
-
actual_output.should(match(/#{regex}/)) :
|
81
|
-
actual_output.should_not(match(/#{regex}/))
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
86
|
-
File.exists?(gem_file).should be_true
|
87
|
-
File.exists?(project_file).should be_true
|
88
|
-
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
89
|
-
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
90
|
-
project_file_contents.should == gem_file_contents
|
91
|
-
end
|
92
|
-
|
93
|
-
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
94
|
-
actual_output = File.read(@stdout)
|
95
|
-
does_invoke == "does" ?
|
96
|
-
actual_output.should(match(/dependency\s+#{generator}/)) :
|
97
|
-
actual_output.should_not(match(/dependency\s+#{generator}/))
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
101
|
-
actual_output = File.read(@stdout)
|
102
|
-
actual_output.should match(/#{opt1}/)
|
103
|
-
actual_output.should match(/#{opt2}/)
|
104
|
-
end
|
105
|
-
|
106
|
-
Then /^I should see "([^\"]*)"$/ do |text|
|
107
|
-
actual_output = File.read(@stdout)
|
108
|
-
actual_output.should contain(text)
|
109
|
-
end
|
110
|
-
|
111
|
-
Then /^I should see$/ do |text|
|
112
|
-
actual_output = File.read(@stdout)
|
113
|
-
actual_output.should contain(text)
|
114
|
-
end
|
115
|
-
|
116
|
-
Then /^I should not see$/ do |text|
|
117
|
-
actual_output = File.read(@stdout)
|
118
|
-
actual_output.should_not contain(text)
|
119
|
-
end
|
120
|
-
|
121
|
-
Then /^I should see exactly$/ do |text|
|
122
|
-
actual_output = File.read(@stdout)
|
123
|
-
actual_output.should == text
|
124
|
-
end
|
125
|
-
|
126
|
-
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
127
|
-
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
128
|
-
actual_output = File.read(@stdout)
|
129
|
-
actual_output.should match(expected)
|
130
|
-
end
|
131
|
-
|
132
|
-
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
133
|
-
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
134
|
-
actual_output = File.read(@stdout)
|
135
|
-
actual_output.should match(expected)
|
136
|
-
end
|
137
|
-
|
138
|
-
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
139
|
-
in_project_folder do
|
140
|
-
yaml = eval yaml
|
141
|
-
YAML.load(File.read(file)).should == yaml
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
Then /^Rakefile can display tasks successfully/ do
|
146
|
-
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
147
|
-
in_project_folder do
|
148
|
-
system "rake -T > #{@stdout} 2> #{@stdout}"
|
149
|
-
end
|
150
|
-
actual_output = File.read(@stdout)
|
151
|
-
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
152
|
-
end
|
153
|
-
|
154
|
-
Then /^task "rake (.*)" is executed successfully/ do |task|
|
155
|
-
@stdout.should_not be_nil
|
156
|
-
actual_output = File.read(@stdout)
|
157
|
-
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
158
|
-
actual_output.should_not match(/Error/i)
|
159
|
-
end
|
160
|
-
|
161
|
-
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
162
|
-
in_project_folder do
|
163
|
-
gem_file = Dir["pkg/*.gem"].first
|
164
|
-
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
165
|
-
spec_value = gem_spec.send(key.to_sym)
|
166
|
-
spec_value.to_s.should match(/#{regex}/)
|
167
|
-
end
|
168
|
-
end
|
data/features/support/common.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module CommonHelpers
|
2
|
-
def in_tmp_folder(&block)
|
3
|
-
FileUtils.chdir(@tmp_root, &block)
|
4
|
-
end
|
5
|
-
|
6
|
-
def in_project_folder(&block)
|
7
|
-
project_folder = @active_project_folder || @tmp_root
|
8
|
-
FileUtils.chdir(project_folder, &block)
|
9
|
-
end
|
10
|
-
|
11
|
-
def in_home_folder(&block)
|
12
|
-
FileUtils.chdir(@home_path, &block)
|
13
|
-
end
|
14
|
-
|
15
|
-
def force_local_lib_override(project_name = @project_name)
|
16
|
-
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
-
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
-
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
-
f << rakefile
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def setup_active_project_folder project_name
|
24
|
-
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
-
@project_name = project_name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
World(CommonHelpers)
|
data/features/support/env.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../../lib/indentation"
|
2
|
-
|
3
|
-
gem 'cucumber'
|
4
|
-
require 'cucumber'
|
5
|
-
gem 'rspec'
|
6
|
-
require 'spec'
|
7
|
-
|
8
|
-
Before do
|
9
|
-
@tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
10
|
-
@home_path = File.expand_path(File.join(@tmp_root, "home"))
|
11
|
-
@lib_path = File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
12
|
-
FileUtils.rm_rf @tmp_root
|
13
|
-
FileUtils.mkdir_p @home_path
|
14
|
-
ENV['HOME'] = @home_path
|
15
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Matchers
|
2
|
-
def contain(expected)
|
3
|
-
simple_matcher("contain #{expected.inspect}") do |given, matcher|
|
4
|
-
matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
|
5
|
-
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
|
6
|
-
given.index expected
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
World(Matchers)
|