cucumber-nagios 0.8.4 → 0.8.5

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/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
5
+ require 'lib/cucumber/nagios/version'
5
6
 
6
7
  begin
7
8
  require 'jeweler'
@@ -13,6 +14,7 @@ begin
13
14
  gem.homepage = "http://cucumber-nagios.org/"
14
15
  gem.authors = ["Lindsay Holmwood"]
15
16
  gem.has_rdoc = false
17
+ gem.version = Cucumber::Nagios::VERSION
16
18
 
17
19
  gem.add_dependency('cucumber', '>= 0.10.0')
18
20
  gem.add_dependency('rspec', '>= 2.3.0')
@@ -3,12 +3,24 @@
3
3
  require 'rubygems'
4
4
  require 'templater'
5
5
  require 'cucumber/nagios'
6
+ require 'highline/import'
6
7
 
7
8
  module CucumberNagiosGenerators
8
9
 
9
10
  extend Templater::Manifold
10
11
 
11
12
  class ProjectGenerator < Templater::Generator
13
+ def initialize(destination_root, options = {}, *args)
14
+ super
15
+ @readme = []
16
+ @readme << "<%= color('Your new cucumber-nagios project has been generated!', :green) %>"
17
+ @readme << ""
18
+ @readme << "Next, install the necessary RubyGems with:"
19
+ @readme << ""
20
+ @readme << " <%= color('bundle install', :yellow) %>"
21
+ @readme << ""
22
+ end
23
+
12
24
  def self.source_root
13
25
  File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'project')
14
26
  end
@@ -20,36 +32,57 @@ module CucumberNagiosGenerators
20
32
 
21
33
  @root = Pathname.new(File.dirname(__FILE__)).parent.join('lib/cucumber/nagios')
22
34
 
23
- desc "Generate a new self-contained cucumber-nagios project."
35
+ desc "Generate a cucumber-nagios project."
24
36
  first_argument :name, :required => true, :desc => "Project name"
25
37
 
26
38
  file '.gitignore', '.gitignore'
27
39
  file '.bzrignore', '.bzrignore'
28
40
 
29
41
  directory :steps, @root.join('steps'), 'features/steps'
30
- directory :features, @root.join('support'), 'features/support', :after => :readme
42
+ directory :features, @root.join('support'), 'features/support'
31
43
 
32
44
  glob!
33
45
 
34
- def readme(action)
35
- puts <<-README
36
-
37
- Your new cucumber-nagios project has been generated.
38
-
39
- To get going, you'll need to bundle gems into the project:
40
-
41
- $ bundle install
42
-
43
- It's *highly* recommended you version control your project
46
+ def after_run
47
+ git_init
48
+ readme
49
+ end
44
50
 
45
- $ git init ; git add .
51
+ def git_init
52
+ if system("which git > /dev/null 2>&1")
53
+ Dir.chdir(destination_root) do
54
+ system("git init -q")
55
+ system("git add .")
56
+ system("git commit -qm 'Initial commit to #{name}.' .")
57
+ end
58
+
59
+ @readme << "Your project has been initialised as a git repository."
60
+ @readme << ""
61
+ else
62
+ @readme << "It's <%= color('strongly', :red) %> recommended you version control your project:"
63
+ @readme << ""
64
+ @readme << " # Install git using your package manager."
65
+ @readme << " <%= color('git init', :yellow) %>"
66
+ @readme << " <%= color('git add .', :yellow) %>"
67
+ @readme << " <%= color('git commit -m \"Initial commit to #{name}.\" .', :yellow) %>"
68
+ @readme << ""
69
+ end
70
+ end
46
71
 
47
- README
72
+ def readme
73
+ puts
74
+ @readme.each do |line|
75
+ if line =~ /^\s*$/
76
+ puts line
77
+ else
78
+ say(line)
79
+ end
80
+ end
81
+ puts unless @readme.last =~ /^\s*$/
48
82
  end
49
83
 
50
84
  end
51
85
 
52
- desc "Generate a cucumber-nagios project."
53
86
  add :project, ProjectGenerator
54
87
 
55
88
 
@@ -60,8 +93,10 @@ It's *highly* recommended you version control your project
60
93
  end
61
94
 
62
95
  desc <<-DESC
63
- Generate a cucumber feature. Takes a two arguments:
64
- cucumber-nagios-gen feature <site-name> <feature-name>
96
+ Generate a Cucumber feature.
97
+ \n
98
+ Usage: cucumber-nagios-gen feature <site> <feature>
99
+ e.g. cucumber-nagios-gen feature google.com.au search
65
100
  DESC
66
101
 
67
102
  first_argument :site, :required => true, :desc => "Site name"
@@ -79,9 +114,10 @@ It's *highly* recommended you version control your project
79
114
 
80
115
  end
81
116
 
82
- desc "Generators for a cucumber-nagios project"
83
117
  add :feature, FeatureGenerator
84
118
 
119
+ desc "Generators for cucumber-nagios projects."
120
+
85
121
  end
86
122
 
87
123
  CucumberNagiosGenerators.run_cli Dir.pwd, 'cucumber-nagios-gen', Cucumber::Nagios::VERSION, ARGV
@@ -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.4"
8
+ s.version = "0.8.5"
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"]
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
27
27
  "README.md",
28
28
  "Rakefile",
29
29
  "TODO",
30
- "VERSION",
31
30
  "bin/cucumber-nagios-gen",
32
31
  "cucumber-nagios.gemspec",
33
32
  "features/commands.feature",
@@ -1,5 +1,5 @@
1
1
  module Cucumber
2
2
  module Nagios
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.5'
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: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 4
10
- version: 0.8.4
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lindsay Holmwood
@@ -180,7 +180,6 @@ files:
180
180
  - README.md
181
181
  - Rakefile
182
182
  - TODO
183
- - VERSION
184
183
  - bin/cucumber-nagios-gen
185
184
  - cucumber-nagios.gemspec
186
185
  - features/commands.feature
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.8.4