cucumber-nagios 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/bin/cucumber-nagios-gen +14 -6
- data/cucumber-nagios.gemspec +4 -3
- data/features/commands.feature +8 -3
- data/features/creating.feature +1 -0
- data/features/files.feature +14 -4
- data/features/http_steps.feature +1 -0
- data/features/installing.feature +1 -0
- data/features/using.feature +8 -2
- data/lib/cucumber/nagios/version.rb +1 -1
- data/man/cucumber-nagios.1.ronn +49 -0
- metadata +5 -4
data/.gitignore
CHANGED
data/bin/cucumber-nagios-gen
CHANGED
@@ -13,7 +13,7 @@ module CucumberNagiosGenerators
|
|
13
13
|
def initialize(destination_root, options = {}, *args)
|
14
14
|
super
|
15
15
|
@readme = []
|
16
|
-
@readme << "<%= color('Your new cucumber-nagios project
|
16
|
+
@readme << "<%= color('Your new cucumber-nagios project can be found in #{self.destination_root}.', :green) %>"
|
17
17
|
@readme << ""
|
18
18
|
@readme << "Next, install the necessary RubyGems with:"
|
19
19
|
@readme << ""
|
@@ -26,14 +26,19 @@ module CucumberNagiosGenerators
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def destination_root
|
29
|
-
|
30
|
-
|
29
|
+
if options[:directory]
|
30
|
+
options[:directory].to_s
|
31
|
+
else
|
32
|
+
# takes :name from first_argument
|
33
|
+
File.join(@destination_root, name)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
@root = Pathname.new(File.dirname(__FILE__)).parent.join('lib/cucumber/nagios')
|
34
38
|
|
35
39
|
desc "Generate a cucumber-nagios project."
|
36
40
|
first_argument :name, :required => true, :desc => "Project name"
|
41
|
+
option :directory, :desc => "specify the directory to generate the project into"
|
37
42
|
|
38
43
|
file '.gitignore', '.gitignore'
|
39
44
|
file '.bzrignore', '.bzrignore'
|
@@ -51,9 +56,12 @@ module CucumberNagiosGenerators
|
|
51
56
|
def git_init
|
52
57
|
if system("which git > /dev/null 2>&1")
|
53
58
|
Dir.chdir(destination_root) do
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
git_directory = File.join(destination_root, '.git')
|
60
|
+
if not File.directory?(git_directory)
|
61
|
+
system("git init -q")
|
62
|
+
system("git add .")
|
63
|
+
system("git commit -qm 'Initial commit to #{name}.' .")
|
64
|
+
end
|
57
65
|
end
|
58
66
|
|
59
67
|
@readme << "Your project has been initialised as a git repository."
|
data/cucumber-nagios.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cucumber-nagios}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lindsay Holmwood"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-12}
|
13
13
|
s.default_executable = %q{cucumber-nagios-gen}
|
14
14
|
s.description = %q{cucumber-nagios helps you write high-level behavioural tests for your web applications and Unix infrastructure that can be plugged into Nagios.}
|
15
15
|
s.email = %q{lindsay@holmwood.id.au}
|
@@ -64,7 +64,8 @@ Gem::Specification.new do |s|
|
|
64
64
|
"lib/generators/project/README",
|
65
65
|
"lib/generators/project/bin/cucumber-nagios",
|
66
66
|
"lib/generators/project/lib/generators/feature/%feature_name%.feature",
|
67
|
-
"lib/generators/project/lib/generators/feature/%feature_name%_steps.rb"
|
67
|
+
"lib/generators/project/lib/generators/feature/%feature_name%_steps.rb",
|
68
|
+
"man/cucumber-nagios.1.ronn"
|
68
69
|
]
|
69
70
|
s.homepage = %q{http://cucumber-nagios.org/}
|
70
71
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/features/commands.feature
CHANGED
@@ -3,23 +3,28 @@ Feature: Executing commands
|
|
3
3
|
As an administrator
|
4
4
|
I want to run arbitrary commands and test the output
|
5
5
|
|
6
|
-
|
6
|
+
@steps
|
7
|
+
Scenario: Check Stdout
|
7
8
|
When I run 'echo "i like cheese"'
|
8
9
|
Then 'stdout' should have 'i like cheese'
|
9
10
|
|
11
|
+
@steps
|
10
12
|
Scenario: Check Stderr
|
11
13
|
When I run 'echo "i like cheese" 1>&2'
|
12
14
|
Then 'stderr' should have 'i like cheese'
|
13
15
|
|
16
|
+
@steps
|
14
17
|
Scenario: Check Stdout for multiple lines
|
15
18
|
When I run 'shopt -s xpg_echo ; echo "one\n\one\none\n"'
|
16
19
|
Then 'one' should appear on 'stdout' '3' times
|
17
20
|
|
18
|
-
|
21
|
+
@steps
|
22
|
+
Scenario: Check exit code
|
19
23
|
When I run 'true'
|
20
24
|
Then it should exit '0'
|
21
25
|
|
22
|
-
|
26
|
+
@steps
|
27
|
+
Scenario: Check exit code
|
23
28
|
When I run 'false'
|
24
29
|
Then it should exit '1'
|
25
30
|
|
data/features/creating.feature
CHANGED
data/features/files.feature
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
Feature: Examining files
|
1
|
+
Feature: Examining files
|
2
2
|
In order to test a running system
|
3
3
|
As an administrator
|
4
4
|
I want to examine files
|
5
5
|
|
6
|
-
|
6
|
+
@steps
|
7
|
+
Scenario: File exists
|
7
8
|
Given we have an empty file named '/tmp/foo.file'
|
8
9
|
Then a file named '/tmp/foo.file' should exist
|
9
10
|
|
10
|
-
|
11
|
+
@steps
|
12
|
+
Scenario: File does not exist
|
11
13
|
Then a file named '/tmp/foo.filepants' should not exist
|
12
14
|
|
15
|
+
@steps
|
13
16
|
Scenario: Atime
|
14
17
|
Given we have an empty file named '/tmp/foo.file'
|
15
18
|
And we have the atime/mtime of '/tmp/foo.file'
|
@@ -17,6 +20,7 @@ Feature: Examining files
|
|
17
20
|
And I run 'touch -a /tmp/foo.file'
|
18
21
|
Then the atime of '/tmp/foo.file' should be different
|
19
22
|
|
23
|
+
@steps
|
20
24
|
Scenario: Mtime
|
21
25
|
Given we have an empty file named '/tmp/foo.file'
|
22
26
|
And we have the atime/mtime of '/tmp/foo.file'
|
@@ -24,28 +28,34 @@ Feature: Examining files
|
|
24
28
|
And I run 'touch -m /tmp/foo.file'
|
25
29
|
Then the mtime of '/tmp/foo.file' should be different
|
26
30
|
|
31
|
+
@steps
|
27
32
|
Scenario: File contents
|
28
33
|
When I run 'shopt -s xpg_echo ; echo "monkeypants\nmonkeyshorts" > /tmp/monkeytest.file'
|
29
34
|
Then a file named '/tmp/monkeytest.file' should contain 'monkeypants'
|
30
35
|
|
36
|
+
@steps
|
31
37
|
Scenario: File contents multiple times
|
32
38
|
When I run 'shopt -s xpg_echo ; echo "monkeypants\nmonkeyshorts" > /tmp/monkeytest.file'
|
33
39
|
Then a file named '/tmp/monkeytest.file' should contain 'monkey.+' only '2' times
|
34
40
|
|
41
|
+
@steps
|
35
42
|
Scenario: File modes
|
36
43
|
When I run 'touch /tmp/filemode.file'
|
37
44
|
And I run 'chmod 644 /tmp/filemode.file'
|
38
45
|
Then the file named '/tmp/filemode.file' should have mode '644'
|
39
46
|
And the file named '/tmp/filemode.file' should have mode '0644'
|
40
47
|
|
48
|
+
@steps
|
41
49
|
Scenario: Directory exists
|
42
50
|
When I run 'mkdir -p /tmp/dirtest'
|
43
51
|
Then a directory named '/tmp/dirtest' should exist
|
44
52
|
|
53
|
+
@steps
|
45
54
|
Scenario: Directory does not exist
|
46
55
|
Then a directory named '/tmp/dirtest-m000' should not exist
|
47
56
|
|
48
|
-
|
57
|
+
@steps
|
58
|
+
Scenario: Directory mode
|
49
59
|
When I run 'mkdir -p /tmp/dirtest'
|
50
60
|
And I run 'chmod 755 /tmp/dirtest'
|
51
61
|
Then the directory named '/tmp/dirtest' should have mode '755'
|
data/features/http_steps.feature
CHANGED
data/features/installing.feature
CHANGED
data/features/using.feature
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
Feature: Using features
|
2
2
|
To test websites
|
3
|
-
|
4
|
-
|
3
|
+
And other infrastructure
|
4
|
+
An operator
|
5
|
+
Needs helper tools
|
6
|
+
To create and run features
|
5
7
|
|
8
|
+
@using
|
6
9
|
Scenario: Create a feature
|
7
10
|
Given cucumber-nagios is installed
|
8
11
|
And a project called "more-great-tests" is created and frozen
|
9
12
|
When I generate a new feature called "login" for "github.com"
|
10
13
|
Then a feature file should exist for "login" on "github.com"
|
11
14
|
|
15
|
+
@using
|
12
16
|
Scenario: Run a successful feature
|
13
17
|
Given a project called "passing-features" is created and frozen
|
14
18
|
When I generate a new feature called "homepage" for "github.com"
|
15
19
|
Then the "homepage" feature on "github.com" should exit cleanly
|
16
20
|
|
21
|
+
@using
|
17
22
|
Scenario: Run a failing feature
|
18
23
|
Given a project called "failing-features" is created and frozen
|
19
24
|
When I generate a new feature called "profile" for "github.com"
|
20
25
|
And the "profile" feature on "github.com" checks for something preposterous
|
21
26
|
Then the "profile" feature on "github.com" should not exit cleanly
|
22
27
|
|
28
|
+
@using
|
23
29
|
Scenario: webrat.log output
|
24
30
|
Given a project called "passing-features" is created and frozen
|
25
31
|
When I generate a new feature called "homepage" for "github.com"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
cucumber-nagios
|
2
|
+
===============
|
3
|
+
|
4
|
+
## SYNOPSIS ##
|
5
|
+
|
6
|
+
`cucumber-nagios` <feature> [--debug|--pretty]
|
7
|
+
|
8
|
+
## DESCRIPTION ##
|
9
|
+
|
10
|
+
**cucumber-nagios** runs Cucumber features and outputs the result in the Nagios
|
11
|
+
plugin format.
|
12
|
+
|
13
|
+
## FILES ##
|
14
|
+
|
15
|
+
The `cucumber-nagios` command expects a path to a Cucumber feature file as the
|
16
|
+
first argument. The path can be relative or absolute, e.g.
|
17
|
+
|
18
|
+
* `cucumber-nagios features/github.com/login.feature`
|
19
|
+
* `cucumber-nagios /home/nagios/behavioural/features/example.org/navigation.feature`
|
20
|
+
|
21
|
+
## OPTIONS ##
|
22
|
+
|
23
|
+
* `--debug`:
|
24
|
+
Output the generated command line used to invoke Cucumber.
|
25
|
+
* `--pretty`:
|
26
|
+
Use Cucumber's `pretty` formatter instead of cucumber-nagios's Nagios
|
27
|
+
formatter. This is useful for debugging your scenarios as you write them.
|
28
|
+
|
29
|
+
## RETURN VALUES ##
|
30
|
+
|
31
|
+
* **0**: all scenarios passed (OK)
|
32
|
+
* **1**: missing steps (WARNING)
|
33
|
+
* **2**: scenario failure (CRITICAL)
|
34
|
+
* **4**: missing feature file (UNKNOWN)
|
35
|
+
|
36
|
+
## AUTHOR ##
|
37
|
+
|
38
|
+
Lindsay Holmwood <lindsay@holmwood.id.au>
|
39
|
+
|
40
|
+
## COPYRIGHT ##
|
41
|
+
|
42
|
+
cucumber-nagios is MIT licensed.
|
43
|
+
|
44
|
+
Portions of cucumber-nagios contain code originally contributed to Chef
|
45
|
+
(http://github.com/opscode/chef)
|
46
|
+
|
47
|
+
## SEE ALSO ##
|
48
|
+
|
49
|
+
cucumber-nagios-gen(1), nagios(8)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-nagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 6
|
10
|
+
version: 0.8.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lindsay Holmwood
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-12 00:00:00 +11:00
|
19
19
|
default_executable: cucumber-nagios-gen
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -218,6 +218,7 @@ files:
|
|
218
218
|
- lib/generators/project/bin/cucumber-nagios
|
219
219
|
- lib/generators/project/lib/generators/feature/%feature_name%.feature
|
220
220
|
- lib/generators/project/lib/generators/feature/%feature_name%_steps.rb
|
221
|
+
- man/cucumber-nagios.1.ronn
|
221
222
|
has_rdoc: true
|
222
223
|
homepage: http://cucumber-nagios.org/
|
223
224
|
licenses: []
|