cucumber-nagios 0.8.9 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ require 'rubygems'
4
4
  require 'templater'
5
5
  require 'cucumber/nagios'
6
6
  require 'highline/import'
7
+ require 'pathname'
7
8
 
8
9
  module CucumberNagiosGenerators
9
10
 
@@ -22,28 +23,23 @@ module CucumberNagiosGenerators
22
23
  end
23
24
 
24
25
  def self.source_root
25
- File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'project')
26
+ Pathname.new(__FILE__).parent.parent.join('lib', 'generators', 'project').expand_path
26
27
  end
27
28
 
28
29
  def destination_root
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
30
+ options[:directory] ? options[:directory].to_s : Pathname.new(@destination_root).join(name)
35
31
  end
36
32
 
37
- @root = Pathname.new(File.dirname(__FILE__)).parent.join('lib/cucumber/nagios')
33
+ @root = Pathname.new(__FILE__).parent.parent.join('lib', 'cucumber', 'nagios').expand_path
38
34
 
39
35
  desc "Generate a cucumber-nagios project."
40
- first_argument :name, :required => true, :desc => "Project name"
41
- option :directory, :desc => "specify the directory to generate the project into"
36
+ first_argument :name, :required => true, :desc => "Project name"
37
+ option :directory, :desc => "specify the directory to generate the project into"
42
38
 
43
39
  file '.gitignore', '.gitignore'
44
40
  file '.bzrignore', '.bzrignore'
45
41
 
46
- directory :steps, @root.join('steps'), 'features/steps'
42
+ directory :steps, @root.join('steps'), 'features/steps'
47
43
  directory :features, @root.join('support'), 'features/support'
48
44
 
49
45
  glob!
@@ -56,8 +52,8 @@ module CucumberNagiosGenerators
56
52
  def git_init
57
53
  if system("which git > /dev/null 2>&1")
58
54
  Dir.chdir(destination_root) do
59
- git_directory = File.join(destination_root, '.git')
60
- if not File.directory?(git_directory)
55
+ git_directory = Pathname.new(destination_root).join('.git')
56
+ if not git_directory.directory?
61
57
  system("git init -q")
62
58
  system("git add .")
63
59
  system("git commit -qm 'Initial commit to #{name}.' .")
@@ -97,7 +93,7 @@ module CucumberNagiosGenerators
97
93
  # feature generator
98
94
  class FeatureGenerator < Templater::Generator
99
95
  def self.source_root
100
- File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'project', 'lib', 'generators', 'feature')
96
+ Pathname.new(__FILE__).parent.parent.join('lib', 'generators', 'feature').expand_path
101
97
  end
102
98
 
103
99
  desc <<-DESC
@@ -107,16 +103,16 @@ module CucumberNagiosGenerators
107
103
  e.g. cucumber-nagios-gen feature google.com.au search
108
104
  DESC
109
105
 
110
- first_argument :site, :required => true, :desc => "Site name"
106
+ first_argument :site, :required => true, :desc => "Site name"
111
107
  second_argument :feature, :required => true, :desc => "Feature name"
112
108
 
113
109
  template :feature do |template|
114
- template.source = "%feature_name%.feature"
110
+ template.source = "%feature_name%.feature"
115
111
  template.destination = "features/#{site}/#{feature}.feature"
116
112
  end
117
113
 
118
114
  template :step do |template|
119
- template.source = "%feature_name%_steps.rb"
115
+ template.source = "%feature_name%_steps.rb"
120
116
  template.destination = "features/#{site}/steps/#{feature}_steps.rb"
121
117
  end
122
118
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber-nagios}
8
- s.version = "0.8.9"
8
+ s.version = "0.8.10"
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"]
@@ -58,13 +58,13 @@ Gem::Specification.new do |s|
58
58
  "lib/cucumber/nagios/support/env.rb",
59
59
  "lib/cucumber/nagios/support/webrat_logging_patches.rb",
60
60
  "lib/cucumber/nagios/version.rb",
61
+ "lib/generators/feature/%feature_name%.feature",
62
+ "lib/generators/feature/%feature_name%_steps.rb",
61
63
  "lib/generators/project/.bzrignore",
62
64
  "lib/generators/project/.gitignore",
63
65
  "lib/generators/project/Gemfile",
64
66
  "lib/generators/project/README",
65
67
  "lib/generators/project/bin/cucumber-nagios",
66
- "lib/generators/project/lib/generators/feature/%feature_name%.feature",
67
- "lib/generators/project/lib/generators/feature/%feature_name%_steps.rb",
68
68
  "man/cucumber-nagios.1.ronn"
69
69
  ]
70
70
  s.has_rdoc = false
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  When /^I freeze in dependencies$/ do
15
15
  @project_name.should_not be_nil
16
- silent_system("cd /tmp/#{@project_name} ; bundle install").should be_true
16
+ silent_system("cd /tmp/#{@project_name} ; bundle install --local").should be_true
17
17
  end
18
18
 
19
19
  Then /^a Gemfile lock should be created$/ do
@@ -12,7 +12,7 @@ When /^I install the latest gem$/ do
12
12
  glob = File.join(pkg_dir, '*.gem')
13
13
  latest = Dir.glob(glob).sort {|a, b| File.ctime(a) <=> File.ctime(b) }.last
14
14
 
15
- silent_system("gem install #{latest} 2>&1 > /dev/null").should be_true
15
+ silent_system("gem install --local #{latest}").should be_true
16
16
  end
17
17
 
18
18
  Then /^I should have cucumber\-nagios\-gen on my path$/ do
@@ -35,8 +35,7 @@ Then /^"([^"]*)" in the "([^"]*)" project should not exist$/ do |file, project_n
35
35
  end
36
36
 
37
37
  Then /^the "([^"]*)" feature on "([^"]*)" should produce multiline output$/ do |feature, site|
38
- @output = `cd /tmp/#{@project_name} ; bin/cucumber-nagios features/#{site}/#{feature}.feature`
39
- $?.exitstatus.should == 0
40
-
38
+ command = "cd /tmp/#{@project_name} ; bin/cucumber-nagios features/#{site}/#{feature}.feature"
39
+ @output = `#{command}`
41
40
  @output.split("\n").size.should > 1
42
41
  end
@@ -1,4 +1,4 @@
1
1
  def silent_system(cmd)
2
- silent_cmd = cmd + " 2>&1 > /dev/null"
2
+ silent_cmd = cmd + " > /dev/null 2>&1"
3
3
  system(silent_cmd)
4
4
  end
@@ -35,7 +35,7 @@ Feature: Using features
35
35
  @using
36
36
  Scenario: Multiline output
37
37
  Given a project called "multiline-output" is created and frozen
38
- When I generate a new feature called "homepage" for "github.com"
38
+ When I generate a new feature called "profile" for "github.com"
39
39
  And the "profile" feature on "github.com" checks for something preposterous
40
40
  Then the "profile" feature on "github.com" should not exit cleanly
41
- And the "profile" feature on "github" should produce multiline output
41
+ And the "profile" feature on "github.com" should produce multiline output
@@ -3,7 +3,7 @@ module Cucumber
3
3
  end
4
4
  end
5
5
 
6
- begin
6
+ begin
7
7
  require 'cucumber/nagios/version'
8
8
  require 'cucumber/nagios/command'
9
9
  require 'net/ssh'
@@ -11,7 +11,7 @@ begin
11
11
  require 'mq'
12
12
  rescue LoadError => e
13
13
  dep = e.message.split.last
14
- puts "You don't appear to have #{dep} installed."
15
- puts "Perhaps run `gem bundle` or `gem install #{dep}`?"
14
+ puts "You don't appear to have #{dep} installed."
15
+ puts "Perhaps run `bundle install` or `gem install #{dep}`?"
16
16
  exit 2
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module Cucumber
2
2
  module Nagios
3
- VERSION = '0.8.9'
3
+ VERSION = '0.8.10'
4
4
  end
5
5
  end
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: 45
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 9
10
- version: 0.8.9
9
+ - 10
10
+ version: 0.8.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lindsay Holmwood
@@ -211,13 +211,13 @@ files:
211
211
  - lib/cucumber/nagios/support/env.rb
212
212
  - lib/cucumber/nagios/support/webrat_logging_patches.rb
213
213
  - lib/cucumber/nagios/version.rb
214
+ - lib/generators/feature/%feature_name%.feature
215
+ - lib/generators/feature/%feature_name%_steps.rb
214
216
  - lib/generators/project/.bzrignore
215
217
  - lib/generators/project/.gitignore
216
218
  - lib/generators/project/Gemfile
217
219
  - lib/generators/project/README
218
220
  - lib/generators/project/bin/cucumber-nagios
219
- - lib/generators/project/lib/generators/feature/%feature_name%.feature
220
- - lib/generators/project/lib/generators/feature/%feature_name%_steps.rb
221
221
  - man/cucumber-nagios.1.ronn
222
222
  has_rdoc: false
223
223
  homepage: http://cucumber-nagios.org/