cucumber-puppet 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
- :patch: 3
3
+ :patch: 4
4
4
  :minor: 0
5
5
  :major: 0
data/bin/cucumber-puppet CHANGED
@@ -1,28 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  unless ARGV[0]
4
- puts "Usage: cucumber-puppet <feature> [<feature> <feature> ...]"
5
- exit 1
4
+ puts "Usage: cucumber-puppet [options] <feature> [<feature> <feature> ...]"
5
+ exit 0
6
6
  end
7
7
 
8
- ARGV.each { |f|
9
- unless File.exists?(f)
10
- puts "No such file or directory: #{f}"
11
- exit 1
12
- end
13
- }
8
+ command = ""
9
+ command << "cucumber "
10
+ command << "--strict "
14
11
 
15
12
  # XXX be more creative, finding this directory
16
13
  features_dir = "features"
17
- unless File.directory?(features_dir)
18
- puts "Cannot find '#{features_dir}' directory."
19
- exit 1
14
+ if File.directory?(features_dir)
15
+ command << "--require #{features_dir} "
20
16
  end
21
17
 
22
- command = ""
23
- command << "cucumber "
24
- command << "--strict "
25
- command << "--require #{features_dir} "
26
18
  command << ARGV.join(' ')
27
19
 
28
20
  system(command) ? exit(0) : exit(1)
@@ -27,6 +27,21 @@ module CucumberPuppetGenerators
27
27
  end
28
28
  end
29
29
 
30
+ class TestcaseGenerator < Templater::Generator
31
+ def source_root
32
+ File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'testcase')
33
+ end
34
+
35
+ desc <<-DESC
36
+ Generate a test case for cucumber-puppet's test suite
37
+ cucumber-puppet-gen testcase
38
+ DESC
39
+
40
+ file('testcase.feature', 'testcase.feature', 'features/testcase.feature')
41
+ file('testcase.rb', 'testcase.rb', 'features/support/testcase.rb')
42
+ file('site.pp', 'site.pp')
43
+ end
44
+
30
45
  class WorldGenerator < Templater::Generator
31
46
  def source_root
32
47
  File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'world')
@@ -41,12 +56,20 @@ module CucumberPuppetGenerators
41
56
  cucumber-puppet-gen world
42
57
  DESC
43
58
 
59
+ first_argument :version, :required => false, :desc => "Puppet version"
60
+
61
+ template :version do |template|
62
+ template.source = "support/world.rb"
63
+ template.destination = "support/world.rb"
64
+ end
65
+
44
66
  directory('steps', 'steps')
45
- directory('support', 'support')
67
+ file('support/hooks.rb', 'support/hooks.rb')
46
68
  end
47
69
 
48
70
  desc "Generators for cucumber-puppet"
49
71
  add :feature, FeatureGenerator
72
+ add :testcase, TestcaseGenerator
50
73
  add :world, WorldGenerator
51
74
 
52
75
  end
@@ -39,7 +39,11 @@ class CucumberPuppet
39
39
 
40
40
  begin
41
41
  # Compile our catalog
42
- @catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
42
+ begin
43
+ @catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node)
44
+ rescue NameError
45
+ @catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
46
+ end
43
47
  rescue => detail
44
48
  if Puppet[:trace]
45
49
  puts detail.backtrace
@@ -0,0 +1,6 @@
1
+ Then /^cron job "([^\"]*)" should be "([^\"]*)"$/ do |name, state|
2
+ steps %Q{
3
+ Then there should be a resource "Cron[#{name}]"
4
+ And the state should be "#{state}"
5
+ }
6
+ end
@@ -0,0 +1,5 @@
1
+ Then /^exec "([^\"]*)" should be present$/ do |name|
2
+ steps %Q{
3
+ Then there should be a resource "Exec[#{name}]"
4
+ }
5
+ end
@@ -1,3 +1,13 @@
1
+ <%=
2
+ if version
3
+ "begin
4
+ gem 'puppet', '#{version}'
5
+ rescue Gem::LoadError => e
6
+ puts e
7
+ exit 1
8
+ end"
9
+ end
10
+ %>
1
11
  require 'cucumber-puppet/puppet'
2
12
 
3
13
  World do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nikolay Sturm
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-17 00:00:00 +02:00
17
+ date: 2010-04-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -59,6 +59,8 @@ files:
59
59
  - lib/cucumber-puppet.rb
60
60
  - lib/cucumber-puppet/puppet.rb
61
61
  - lib/generators/feature/%feature_name%.feature
62
+ - lib/generators/world/steps/cron.rb
63
+ - lib/generators/world/steps/exec.rb
62
64
  - lib/generators/world/steps/file.rb
63
65
  - lib/generators/world/steps/package.rb
64
66
  - lib/generators/world/steps/puppet.rb