oct 0.2.0 → 0.3.1
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/.gemfiles +6 -1
- data/.gitignore +5 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +42 -33
- data/HISTORY.markdown +8 -0
- data/LICENSE +1 -1
- data/README.markdown +11 -12
- data/Rakefile +47 -24
- data/VERSION +1 -1
- data/bin/oct +28 -24
- data/config/cucumber.yml +5 -4
- data/features/bin.feature +6 -6
- data/features/oct.feature +2 -2
- data/features/settings.feature +139 -0
- data/features/step_definitions/oct_steps.rb +2 -0
- data/features/support/aruba.rb +9 -9
- data/features/support/env.rb +7 -4
- data/lib/oct/app.rb +21 -32
- data/lib/oct/core/array.rb +11 -0
- data/lib/oct/core/hash.rb +45 -0
- data/lib/oct/oct.rb +2 -2
- data/lib/oct/settings.rb +60 -0
- data/lib/oct.rb +5 -2
- data/oct.gemspec +26 -37
- data/spec/aruba_helper.rb +25 -0
- data/spec/basic_app/array_spec.rb +48 -0
- data/spec/basic_gem/aruba_helper_spec.rb +3 -3
- data/spec/basic_gem/basic_gem_spec.rb +73 -2
- data/spec/basic_gem/gemspec_spec.rb +9 -21
- data/spec/spec_helper.rb +7 -31
- data/spec/watchr.rb +3 -1
- metadata +140 -168
- data/spec/spec.opts +0 -2
data/.gemfiles
CHANGED
@@ -14,17 +14,22 @@ bin/oct
|
|
14
14
|
config/cucumber.yml
|
15
15
|
features/bin.feature
|
16
16
|
features/oct.feature
|
17
|
+
features/settings.feature
|
17
18
|
features/step_definitions/.gitignore
|
18
19
|
features/step_definitions/oct_steps.rb
|
19
20
|
features/support/aruba.rb
|
20
21
|
features/support/env.rb
|
21
22
|
lib/oct.rb
|
22
23
|
lib/oct/app.rb
|
24
|
+
lib/oct/core/array.rb
|
25
|
+
lib/oct/core/hash.rb
|
23
26
|
lib/oct/oct.rb
|
27
|
+
lib/oct/settings.rb
|
24
28
|
oct.gemspec
|
29
|
+
spec/aruba_helper.rb
|
30
|
+
spec/basic_app/array_spec.rb
|
25
31
|
spec/basic_gem/aruba_helper_spec.rb
|
26
32
|
spec/basic_gem/basic_gem_spec.rb
|
27
33
|
spec/basic_gem/gemspec_spec.rb
|
28
|
-
spec/spec.opts
|
29
34
|
spec/spec_helper.rb
|
30
35
|
spec/watchr.rb
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,49 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
oct (0.
|
5
|
-
configatron (>= 2.5.1)
|
4
|
+
oct (0.3.1)
|
6
5
|
term-ansicolor (>= 1.0.4)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: http://rubygems.org/
|
10
9
|
specs:
|
11
|
-
aruba (0.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
aruba (0.4.6)
|
11
|
+
bcat (>= 0.6.1)
|
12
|
+
childprocess (>= 0.2.0)
|
13
|
+
cucumber (>= 1.0.2)
|
14
|
+
rdiscount (>= 1.6.8)
|
15
|
+
rspec (>= 2.6.0)
|
16
|
+
bcat (0.6.2)
|
17
|
+
rack (~> 1.0)
|
18
|
+
builder (3.0.0)
|
19
|
+
childprocess (0.2.2)
|
20
|
+
ffi (~> 1.0.6)
|
21
|
+
cucumber (1.1.0)
|
22
|
+
builder (>= 2.1.2)
|
23
|
+
diff-lcs (>= 1.1.2)
|
24
|
+
gherkin (~> 2.5.0)
|
25
|
+
json (>= 1.4.6)
|
26
|
+
term-ansicolor (>= 1.0.6)
|
27
|
+
diff-lcs (1.1.3)
|
28
|
+
ffi (1.0.10)
|
29
|
+
gherkin (2.5.4)
|
30
|
+
json (>= 1.4.6)
|
31
|
+
json (1.6.1)
|
32
|
+
rack (1.3.5)
|
33
|
+
rake (0.9.2.2)
|
34
|
+
rdiscount (1.6.8)
|
35
|
+
redcarpet (1.17.2)
|
36
|
+
rspec (2.7.0)
|
37
|
+
rspec-core (~> 2.7.0)
|
38
|
+
rspec-expectations (~> 2.7.0)
|
39
|
+
rspec-mocks (~> 2.7.0)
|
40
|
+
rspec-core (2.7.1)
|
41
|
+
rspec-expectations (2.7.0)
|
20
42
|
diff-lcs (~> 1.1.2)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
diff-lcs (1.1.2)
|
25
|
-
gherkin (2.2.9)
|
26
|
-
json (~> 1.4.6)
|
27
|
-
term-ansicolor (~> 1.0.5)
|
28
|
-
json (1.4.6)
|
29
|
-
kramdown (0.12.0)
|
30
|
-
rake (0.8.7)
|
31
|
-
rspec (1.3.1)
|
32
|
-
term-ansicolor (1.0.5)
|
33
|
-
yamler (0.1.0)
|
34
|
-
yard (0.6.2)
|
43
|
+
rspec-mocks (2.7.0)
|
44
|
+
term-ansicolor (1.0.7)
|
45
|
+
yard (0.7.3)
|
35
46
|
|
36
47
|
PLATFORMS
|
37
48
|
ruby
|
38
49
|
|
39
50
|
DEPENDENCIES
|
40
|
-
aruba (
|
41
|
-
bundler (>= 1.0.
|
42
|
-
|
43
|
-
cucumber (>= 0.9.4)
|
44
|
-
kramdown (>= 0.12.0)
|
51
|
+
aruba (~> 0.4.3)
|
52
|
+
bundler (>= 1.0.14)
|
53
|
+
cucumber (~> 1.0)
|
45
54
|
oct!
|
46
55
|
rake (>= 0.8.7)
|
47
|
-
|
48
|
-
|
49
|
-
yard (>= 0.
|
56
|
+
redcarpet (>= 1.17.2)
|
57
|
+
rspec (>= 2.6.0)
|
58
|
+
yard (>= 0.7.2)
|
data/HISTORY.markdown
CHANGED
@@ -6,6 +6,14 @@ Most recent changes are at the top
|
|
6
6
|
Changes
|
7
7
|
-------
|
8
8
|
|
9
|
+
### 0.3.1 - 06/11/2013 ###
|
10
|
+
|
11
|
+
* Use RbConfig instead of Config for Ruby 1.9
|
12
|
+
|
13
|
+
### 0.3.0 - 10/27/2011 ###
|
14
|
+
|
15
|
+
* Add configuration files via the BasicApp framework, see features/settings.feature
|
16
|
+
|
9
17
|
### 0.2.0 - 11/24/2010 ###
|
10
18
|
|
11
19
|
* ANSI coloring works under Windows with win32console gem
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -10,7 +10,7 @@ Why?
|
|
10
10
|
Oct is a sample RubyGem application cloned from BasicApp.
|
11
11
|
See <http://github.com/robertwahler/basic_app> for more information.
|
12
12
|
|
13
|
-
Oct does scratch an itch. 'Chmod' is easier to drive in octal and I can't
|
13
|
+
Oct does scratch an itch. 'Chmod' is easier to drive in octal and I can't
|
14
14
|
convince 'ls -l' to output permissions in octal.
|
15
15
|
|
16
16
|
Here is an equivalent bash script
|
@@ -35,30 +35,29 @@ Here is an equivalent bash script
|
|
35
35
|
fi
|
36
36
|
|
37
37
|
stat --format='%a,%U,%G,%t %n' $file
|
38
|
-
done
|
38
|
+
done
|
39
39
|
|
40
40
|
|
41
|
-
Run-time dependencies
|
41
|
+
Run-time dependencies
|
42
42
|
---------------------
|
43
43
|
|
44
44
|
* Term-ansicolor for optional color output <http://github.com/flori/term-ansicolor>
|
45
|
-
* Configatron for configuration support <http://github.com/markbates/configatron>
|
46
45
|
|
47
46
|
|
48
47
|
Development dependencies
|
49
48
|
------------------------
|
50
49
|
|
51
50
|
* Bundler for dependency management <http://github.com/carlhuda/bundler>
|
52
|
-
* Rspec for unit testing <http://github.com/
|
53
|
-
* Cucumber for functional testing <http://github.com/
|
54
|
-
* Aruba for CLI testing <http://github.com/
|
55
|
-
*
|
56
|
-
|
51
|
+
* Rspec for unit testing <http://github.com/rspec/rspec>
|
52
|
+
* Cucumber for functional testing <http://github.com/cucumber/cucumber>
|
53
|
+
* Aruba for CLI testing <http://github.com/cucumber/aruba>
|
54
|
+
* Yard for documentation generation <http://github.com/lsegal/yard>
|
55
|
+
* Redcarpet for documentation markup processing <http://github.com/tanoku/redcarpet>
|
57
56
|
|
58
57
|
Installation
|
59
58
|
------------
|
60
59
|
|
61
|
-
This gem has been published on RubyGems.org
|
60
|
+
This gem has been published on RubyGems.org
|
62
61
|
|
63
62
|
gem install oct
|
64
63
|
|
@@ -73,7 +72,7 @@ oct --help
|
|
73
72
|
Usage: oct [options] [FILES]
|
74
73
|
|
75
74
|
Options:
|
76
|
-
|
75
|
+
|
77
76
|
-v, --[no-]verbose Run verbosely
|
78
77
|
-c, --[no-]coloring Ansi color in output
|
79
78
|
--version Display current version
|
@@ -98,4 +97,4 @@ oct
|
|
98
97
|
Copyright
|
99
98
|
---------
|
100
99
|
|
101
|
-
Copyright (c) 2010 GearheadForHire, LLC. See [LICENSE](LICENSE) for details.
|
100
|
+
Copyright (c) 2010-2011 GearheadForHire, LLC. See [LICENSE](LICENSE) for details.
|
data/Rakefile
CHANGED
@@ -1,25 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
3
|
+
# Bundler is managing $LOAD_PATH, any gem needed by this Rakefile must be
|
4
|
+
# listed as a development dependency in the gemspec
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'bundler/gem_tasks'
|
5
7
|
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def gemspec
|
12
|
-
@gemspec ||= begin
|
13
|
-
file = File.expand_path('../oct.gemspec', __FILE__)
|
14
|
-
eval(File.read(file), binding, file)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
require 'spec'
|
19
|
-
require 'spec/rake/spectask'
|
20
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
21
|
-
spec.libs << 'lib' << 'spec'
|
22
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
desc "Run RSpec"
|
10
|
+
RSpec::Core::RakeTask.new do |spec|
|
11
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
12
|
+
spec.rspec_opts = ['--color', '--format nested']
|
23
13
|
end
|
24
14
|
|
25
15
|
require 'cucumber'
|
@@ -34,26 +24,59 @@ task :test => [:spec, :features]
|
|
34
24
|
task :default => :test
|
35
25
|
|
36
26
|
namespace :doc do
|
27
|
+
|
28
|
+
doc_version = File.open(File.join(File.dirname(__FILE__), 'VERSION'), "r") { |f| f.read }
|
37
29
|
project_root = File.expand_path(File.dirname(__FILE__))
|
38
30
|
doc_destination = File.join(project_root, 'rdoc')
|
39
31
|
|
40
32
|
require 'yard'
|
41
|
-
require 'yard/rake/yardoc_task'
|
42
33
|
|
43
34
|
YARD::Rake::YardocTask.new(:generate) do |yt|
|
44
|
-
yt.options = ['--output-dir', doc_destination
|
45
|
-
|
46
|
-
|
35
|
+
yt.options = ['--output-dir', doc_destination,
|
36
|
+
'--title', "Oct #{doc_version} Documentation",
|
37
|
+
'--main', "README.markdown"
|
38
|
+
]
|
47
39
|
end
|
48
40
|
|
49
41
|
desc "Remove generated documenation"
|
50
42
|
task :clean do
|
51
43
|
rm_r doc_destination if File.exists?(doc_destination)
|
52
44
|
end
|
53
|
-
|
45
|
+
|
54
46
|
desc "List undocumented objects"
|
55
47
|
task :undocumented do
|
56
48
|
system('yard stats --list-undoc')
|
57
49
|
end
|
58
50
|
|
59
51
|
end
|
52
|
+
|
53
|
+
# put the gemfiles task in the bundler dependency chain
|
54
|
+
task :build => [:gemfiles]
|
55
|
+
task :install => [:gemfiles]
|
56
|
+
task :release => [:gemfiles]
|
57
|
+
|
58
|
+
desc "Generate .gemfiles via 'git ls-files'"
|
59
|
+
task :gemfiles do
|
60
|
+
files = `git ls-files`
|
61
|
+
|
62
|
+
filename = File.join(File.dirname(__FILE__), '.gemfiles')
|
63
|
+
cached_files = nil
|
64
|
+
if File.exists?(filename)
|
65
|
+
puts ".gemfiles exists, reading..."
|
66
|
+
cached_files = File.open(filename, "rb") {|f| f.read}
|
67
|
+
end
|
68
|
+
|
69
|
+
if cached_files && cached_files.match("\r\n")
|
70
|
+
puts ".gemfiles using DOS EOL"
|
71
|
+
files.gsub!(/\n/, "\r\n")
|
72
|
+
end
|
73
|
+
|
74
|
+
if cached_files != files
|
75
|
+
puts ".gemfiles updating"
|
76
|
+
File.open(filename, 'wb') {|f| f.write(files)}
|
77
|
+
else
|
78
|
+
puts ".gemfiles update not required"
|
79
|
+
end
|
80
|
+
|
81
|
+
raise "unable to process .gemfiles" unless files
|
82
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.1
|
data/bin/oct
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
4
|
-
|
5
|
-
require 'rubygems'
|
6
3
|
require 'oct'
|
7
4
|
require 'optparse'
|
8
5
|
require 'term/ansicolor'
|
6
|
+
require 'fileutils'
|
9
7
|
|
10
8
|
available_actions = Oct::AVAILABLE_ACTIONS
|
11
9
|
|
@@ -20,23 +18,24 @@ help = banner
|
|
20
18
|
help += <<HELP
|
21
19
|
|
22
20
|
Options:
|
23
|
-
|
21
|
+
|
24
22
|
HELP
|
25
23
|
|
26
24
|
options = {}
|
27
25
|
OptionParser.new do |opts|
|
28
26
|
opts.banner = help
|
29
27
|
|
30
|
-
# set defaults
|
31
|
-
options[:verbose] = false
|
32
|
-
options[:coloring] = true
|
33
|
-
|
34
28
|
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
35
29
|
options[:verbose] = v
|
36
30
|
end
|
37
31
|
|
38
|
-
opts.on("-c", "--[no-]coloring", "
|
39
|
-
options[:
|
32
|
+
opts.on("-c", "--[no-]coloring [MODE]", "--[no-]color [MODE]", "ANSI color in output. MODE=AUTO (default) or ALWAYS") do |c|
|
33
|
+
options[:color] = c.nil? ? "AUTO" : c
|
34
|
+
options[:color].upcase! if options[:color]
|
35
|
+
unless [nil, false, "AUTO", "ALWAYS"].include?(options[:color])
|
36
|
+
puts "oct, invalid color option: #{options[:color]}"
|
37
|
+
exit 1
|
38
|
+
end
|
40
39
|
end
|
41
40
|
|
42
41
|
opts.on("--version", "Display current version") do
|
@@ -44,16 +43,16 @@ OptionParser.new do |opts|
|
|
44
43
|
exit 0
|
45
44
|
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
opts.on("--config FILE", "Load configuration options from FILE") do |file|
|
47
|
+
options[:config] = file
|
48
|
+
end
|
50
49
|
|
51
50
|
# no argument, shows at tail. This will print an options summary.
|
52
51
|
opts.on_tail("-h", "--help", "Show this message") do
|
53
52
|
puts opts
|
54
53
|
exit 0
|
55
54
|
end
|
56
|
-
|
55
|
+
|
57
56
|
begin
|
58
57
|
opts.parse!
|
59
58
|
rescue OptionParser::InvalidOption => e
|
@@ -64,15 +63,20 @@ OptionParser.new do |opts|
|
|
64
63
|
|
65
64
|
end
|
66
65
|
|
67
|
-
if
|
68
|
-
|
66
|
+
# options from config file, if it exists, will not overwrite command line
|
67
|
+
options = Oct::Settings.new(FileUtils.pwd, options).options
|
68
|
+
|
69
|
+
if STDOUT.isatty || (options[:color] == 'ALWAYS')
|
70
|
+
Term::ANSIColor::coloring = options[:color]
|
69
71
|
|
70
|
-
if options[:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
if options[:color] && Oct::WINDOWS
|
73
|
+
unless ENV['ANSICON']
|
74
|
+
begin
|
75
|
+
require 'Win32/Console/ANSI'
|
76
|
+
rescue LoadError
|
77
|
+
Term::ANSIColor::coloring = false
|
78
|
+
STDERR.puts 'WARNING: You must "gem install win32console" (1.2.0 or higher) or use the ANSICON driver (https://github.com/adoxa/ansicon) to get color output on MRI/Windows'
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -80,5 +84,5 @@ else
|
|
80
84
|
Term::ANSIColor::coloring = false
|
81
85
|
end
|
82
86
|
|
83
|
-
app = Oct::App.new(FileUtils.pwd, options)
|
84
|
-
app.
|
87
|
+
app = Oct::App.new(FileUtils.pwd, ARGV.dup, options)
|
88
|
+
app.execute
|
data/config/cucumber.yml
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format
|
4
|
-
std_opts = "
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
|
5
5
|
%>
|
6
|
-
default: <%= std_opts %>
|
7
|
-
wip: --tags @wip:3 --wip features
|
6
|
+
default: <%= std_opts %> -r features
|
7
|
+
wip: --tags @wip:3 --wip -r features
|
8
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip -r features
|
data/features/bin.feature
CHANGED
@@ -3,18 +3,18 @@ Feature: Options via a command line interface (CLI)
|
|
3
3
|
|
4
4
|
As an interactive user or automated script
|
5
5
|
The application should accept options on the command line
|
6
|
-
These options should override hard coded defaults
|
6
|
+
These options should override hard coded defaults
|
7
7
|
In order to configure options
|
8
8
|
|
9
9
|
Scenario: Version info
|
10
|
-
When I run
|
10
|
+
When I run `oct --version`
|
11
11
|
Then the exit status should be 0
|
12
12
|
And the output should match /oct, version ([\d]+\.[\d]+\.[\d]+$)/
|
13
13
|
|
14
14
|
Scenario: Help
|
15
|
-
When I run
|
15
|
+
When I run `oct --help`
|
16
16
|
Then the exit status should be 0
|
17
|
-
And the output should match:
|
17
|
+
And the output should match:
|
18
18
|
"""
|
19
19
|
.*
|
20
20
|
Usage: .*
|
@@ -25,9 +25,9 @@ Feature: Options via a command line interface (CLI)
|
|
25
25
|
"""
|
26
26
|
|
27
27
|
Scenario: Invalid option
|
28
|
-
When I run
|
28
|
+
When I run `oct --non-existing-option`
|
29
29
|
Then the exit status should be 1
|
30
|
-
And the output should match:
|
30
|
+
And the output should match:
|
31
31
|
"""
|
32
32
|
^.* invalid option: --non-existing-option
|
33
33
|
^.* --help for more information
|
data/features/oct.feature
CHANGED
@@ -13,7 +13,7 @@ Feature: Octal file listing
|
|
13
13
|
And file "file1.txt" is chmod 0644
|
14
14
|
|
15
15
|
Scenario: No files on the command line
|
16
|
-
When I run
|
16
|
+
When I run `oct`
|
17
17
|
Then the exit status should be 0
|
18
18
|
And the output should contain:
|
19
19
|
"""
|
@@ -22,7 +22,7 @@ Feature: Octal file listing
|
|
22
22
|
"""
|
23
23
|
|
24
24
|
Scenario: Files on the command line
|
25
|
-
When I run
|
25
|
+
When I run `oct file1.txt`
|
26
26
|
Then the exit status should be 0
|
27
27
|
And the output should contain:
|
28
28
|
"""
|
@@ -0,0 +1,139 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Configuration via yaml file
|
3
|
+
|
4
|
+
In order to configure options, as an interactive user or automated script,
|
5
|
+
the program should process configuration options via yaml. These options
|
6
|
+
should override hard coded defaults but not command line options.
|
7
|
+
|
8
|
+
Config files are read from multiple locations in order of priority. Once a
|
9
|
+
config file is found, all other config files are ignored.
|
10
|
+
|
11
|
+
Config file priority:
|
12
|
+
|
13
|
+
oct.conf
|
14
|
+
.oct.conf
|
15
|
+
config/oct.conf
|
16
|
+
~/.oct.conf
|
17
|
+
|
18
|
+
All command line options can be read from the config file from the "options:"
|
19
|
+
block. The "options" block is optional.
|
20
|
+
|
21
|
+
NOTE: All file system testing is done via the Aruba gem. The home folder
|
22
|
+
config file is stubbed to prevent testing contamination in case it exists.
|
23
|
+
|
24
|
+
|
25
|
+
Scenario: Specified config file exists
|
26
|
+
Given an empty file named "config.conf"
|
27
|
+
When I run `oct action --verbose --config config.conf`
|
28
|
+
Then the output should contain:
|
29
|
+
"""
|
30
|
+
config file: config.conf
|
31
|
+
"""
|
32
|
+
|
33
|
+
Scenario: Specified config file option but not given on command line
|
34
|
+
When I run `oct action --verbose --config`
|
35
|
+
Then the exit status should be 1
|
36
|
+
And the output should contain:
|
37
|
+
"""
|
38
|
+
missing argument: --config
|
39
|
+
"""
|
40
|
+
|
41
|
+
Scenario: Specified config file not found
|
42
|
+
When I run `oct path --verbose --config config.conf`
|
43
|
+
Then the exit status should be 1
|
44
|
+
And the output should contain:
|
45
|
+
"""
|
46
|
+
config file not found
|
47
|
+
"""
|
48
|
+
|
49
|
+
Scenario: Reading options from specified config file, ignoring the
|
50
|
+
default config file
|
51
|
+
Given a file named "oct.conf" with:
|
52
|
+
"""
|
53
|
+
---
|
54
|
+
options:
|
55
|
+
color: true
|
56
|
+
"""
|
57
|
+
And a file named "no_color.conf" with:
|
58
|
+
"""
|
59
|
+
---
|
60
|
+
options:
|
61
|
+
color: false
|
62
|
+
"""
|
63
|
+
When I run `oct action --verbose --config no_color.conf`
|
64
|
+
Then the output should contain:
|
65
|
+
"""
|
66
|
+
:color=>false
|
67
|
+
"""
|
68
|
+
And the output should not contain:
|
69
|
+
"""
|
70
|
+
:color=>true
|
71
|
+
"""
|
72
|
+
|
73
|
+
Scenario: Reading options from specified config file, ignoring the
|
74
|
+
default config file with override on command line
|
75
|
+
Given a file named "oct.conf" with:
|
76
|
+
"""
|
77
|
+
---
|
78
|
+
options:
|
79
|
+
color: true
|
80
|
+
"""
|
81
|
+
And a file named "no_color.conf" with:
|
82
|
+
"""
|
83
|
+
---
|
84
|
+
options:
|
85
|
+
color: false
|
86
|
+
"""
|
87
|
+
When I run `oct action --verbose --config no_color.conf --color`
|
88
|
+
Then the output should contain:
|
89
|
+
"""
|
90
|
+
:color=>"AUTO"
|
91
|
+
"""
|
92
|
+
And the output should not contain:
|
93
|
+
"""
|
94
|
+
:color=>false
|
95
|
+
"""
|
96
|
+
And the output should not contain:
|
97
|
+
"""
|
98
|
+
:color=>true
|
99
|
+
"""
|
100
|
+
|
101
|
+
Scenario: Reading options from config file with negative override on command line
|
102
|
+
And a file named "with_color.conf" with:
|
103
|
+
"""
|
104
|
+
---
|
105
|
+
options:
|
106
|
+
color: true
|
107
|
+
"""
|
108
|
+
When I run `oct action --verbose --config with_color.conf --no-color`
|
109
|
+
Then the output should contain:
|
110
|
+
"""
|
111
|
+
:color=>false
|
112
|
+
"""
|
113
|
+
|
114
|
+
Scenario: Negative override on command line with alternative spelling '--no-coloring'
|
115
|
+
And a file named "with_color.conf" with:
|
116
|
+
"""
|
117
|
+
---
|
118
|
+
options:
|
119
|
+
color: true
|
120
|
+
"""
|
121
|
+
When I run `oct action --verbose --config with_color.conf --no-coloring`
|
122
|
+
Then the output should contain:
|
123
|
+
"""
|
124
|
+
:color=>false
|
125
|
+
"""
|
126
|
+
|
127
|
+
Scenario: Reading text options from config file
|
128
|
+
Given a file named "with_always_color.conf" with:
|
129
|
+
"""
|
130
|
+
---
|
131
|
+
options:
|
132
|
+
color: ALWAYS
|
133
|
+
"""
|
134
|
+
When I run `oct action --verbose --config with_always_color.conf`
|
135
|
+
Then the output should contain:
|
136
|
+
"""
|
137
|
+
:color=>"ALWAYS"
|
138
|
+
"""
|
139
|
+
|
data/features/support/aruba.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'aruba'
|
1
|
+
require 'aruba/api'
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
-
APP_BIN_PATH = File.join(
|
4
|
+
APP_BIN_PATH = File.join(FileUtils.pwd, 'bin', 'oct')
|
5
5
|
|
6
6
|
module Aruba
|
7
7
|
module Api
|
8
8
|
|
9
|
-
alias_method :
|
9
|
+
alias_method :old_run_simple, :run_simple
|
10
|
+
|
11
|
+
# override aruba
|
12
|
+
def run_simple(cmd, fail_on_error=true)
|
10
13
|
|
11
|
-
# override aruba
|
12
|
-
def run(cmd, fail_on_error=true)
|
13
|
-
|
14
14
|
# run development version in verbose mode
|
15
|
-
cmd = cmd.gsub(/^oct/, "#{APP_BIN_PATH} --verbose")
|
15
|
+
cmd = cmd.gsub(/^oct/, "ruby -S #{APP_BIN_PATH} --verbose")
|
16
16
|
|
17
|
-
# run original aruba 'run'
|
18
|
-
|
17
|
+
# run original aruba 'run'
|
18
|
+
old_run_simple(cmd, fail_on_error)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|