newgem 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.28.0 2008-10-17
2
+
3
+ * Cucumber support: install_cucumber generator, and features generator for cucumber scope
4
+
1
5
  == 0.27.0 2008-09-20
2
6
 
3
7
  * Remove License.txt as its contents are in README (newgem + generator)
data/Manifest.txt CHANGED
@@ -35,6 +35,10 @@ bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet
35
35
  bundles/RubyGem.tmbundle/Syntaxes/Rdoc.tmLanguage
36
36
  bundles/RubyGem.tmbundle/info.plist
37
37
  config/hoe.rb
38
+ cucumber_generators/feature/USAGE
39
+ cucumber_generators/feature/feature_generator.rb
40
+ cucumber_generators/feature/templates/feature.erb
41
+ cucumber_generators/feature/templates/steps.erb
38
42
  lib/newgem.rb
39
43
  lib/newgem/quick_template.rb
40
44
  lib/newgem/rubyforge.rb
@@ -70,6 +74,10 @@ rubygems_generators/extconf/templates/ext/extconf.rb.erb
70
74
  rubygems_generators/extconf/templates/tasks/extconf.rake
71
75
  rubygems_generators/extconf/templates/tasks/extconf_name.rake
72
76
  rubygems_generators/extconf/templates/test/test.rb.erb
77
+ rubygems_generators/install_cucumber/install_cucumber_generator.rb
78
+ rubygems_generators/install_cucumber/templates/cucumber
79
+ rubygems_generators/install_cucumber/templates/cucumber.rake
80
+ rubygems_generators/install_cucumber/templates/env.rb
73
81
  rubygems_generators/install_jruby/USAGE
74
82
  rubygems_generators/install_jruby/install_jruby_generator.rb
75
83
  rubygems_generators/install_jruby/templates/tasks/jruby.rake
@@ -103,8 +111,10 @@ test/fixtures/home/.rubyforge/auto-config.yml
103
111
  test/fixtures/home/.rubyforge/user-config.yml
104
112
  test/test_executable_generator.rb
105
113
  test/test_extconf_generator.rb
114
+ test/test_feature_generator.rb
106
115
  test/test_generator_helper.rb
107
116
  test/test_helper.rb
117
+ test/test_install_cucumber_generator.rb
108
118
  test/test_install_jruby_generator.rb
109
119
  test/test_install_rspec_generator.rb
110
120
  test/test_install_rspec_stories_generator.rb
data/PostInstall.txt CHANGED
@@ -20,7 +20,7 @@ Whenever you create a new RubyForge.org project, re-run:
20
20
 
21
21
  Did you know you have script/generate generators?
22
22
  application_generator, component_generator, executable,
23
- extconf, install_jruby, install_rspec, install_rspec_stories,
23
+ extconf, install_cucumber, install_jruby, install_rspec,
24
24
  install_website, test_unit
25
25
 
26
26
  Have fun making RubyGems!
@@ -10,6 +10,9 @@ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
10
  EXTRA_DEPENDENCIES = [
11
11
  # ['activesupport', '>= 1.3.1']
12
12
  ] # An array of rubygem dependencies [name, version]
13
+ EXTRA_DEV_DEPENDENCIES = [
14
+ # ['rspec', '>= 1.1.5']
15
+ ] # An array of rubygem dependencies [name, version]
13
16
 
14
17
  @config_file = "~/.rubyforge/user-config.yml"
15
18
  @config = nil
@@ -52,22 +55,23 @@ end
52
55
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
53
56
  $hoe = Hoe.new(GEM_NAME, VERS) do |p|
54
57
  p.developer(AUTHOR, EMAIL)
55
- p.description = DESCRIPTION
56
- p.summary = DESCRIPTION
57
- p.url = HOMEPATH
58
+ p.description = DESCRIPTION
59
+ p.summary = DESCRIPTION
60
+ p.url = HOMEPATH
58
61
  p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
59
- p.test_globs = ["test/**/test_*.rb"]
62
+ p.test_globs = ["test/**/test_*.rb"]
60
63
  p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
61
64
 
62
65
  # == Optional
63
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
64
- #p.extra_deps = EXTRA_DEPENDENCIES
66
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
67
+ p.extra_deps = EXTRA_DEPENDENCIES
68
+ p.extra_dev_deps = EXTRA_DEV_DEPENDENCIES
65
69
 
66
70
  <% if is_jruby -%>
67
71
  # JRuby gem created, e.g. <%= gem_name %>-X.Y.Z-jruby.gem
68
72
  p.spec_extras = { :platform => 'jruby' } # A hash of extra values to set in the gemspec.
69
73
  <% else -%>
70
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
74
+ p.spec_extras = {} # A hash of extra values to set in the gemspec.
71
75
  <% end -%>
72
76
  end
73
77
 
@@ -75,4 +79,4 @@ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
75
79
  PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
76
80
  $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
77
81
  $hoe.rsync_args = '-av --delete --ignore-errors'
78
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
82
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,27 @@
1
+ class FeatureGenerator < RubiGen::Base
2
+ attr_reader :plural_name, :singular_name, :class_name
3
+
4
+ def initialize(runtime_args, runtime_options = {})
5
+ super
6
+ usage if args.empty?
7
+ @name = args.shift
8
+ @plural_name = @name.pluralize
9
+ @singular_name = @name.singularize
10
+ @class_name = @name.classify
11
+ end
12
+
13
+ def manifest
14
+ record do |m|
15
+ m.directory 'features/steps'
16
+ m.template 'feature.erb', "features/manage_#{plural_name}.feature"
17
+ m.template 'steps.erb', "features/steps/#{singular_name}_steps.rb"
18
+ end
19
+ end
20
+
21
+ protected
22
+
23
+ def banner
24
+ "Usage: #{$0} feature ModelName [feature1] [feature2]"
25
+ end
26
+
27
+ end
@@ -0,0 +1,28 @@
1
+ Feature: Manage <%= plural_name %>
2
+ In order to keep track of <%= plural_name %>
3
+ A <%= singular_name %> mechanic
4
+ Should be able to manage several <%= plural_name %>
5
+
6
+ Scenario: Register new <%= singular_name %>
7
+ Given I am on the new <%= singular_name %> page
8
+ <% keyword = 'When' -%>
9
+ <% args.each do |arg| -%>
10
+ <%= keyword %> I fill in "<%= arg.humanize %>" with "My <%= singular_name %> <%= arg %>"
11
+ <% keyword = 'And' -%>
12
+ <% end -%>
13
+ And I press "Create"
14
+ <% keyword = 'Then' -%>
15
+ <% args.each do |arg| -%>
16
+ <%= keyword %> I should see "My <%= singular_name %> <%= arg %>"
17
+ <% keyword = 'And' -%>
18
+ <% end -%>
19
+
20
+ Scenario: Delete <%= singular_name %>
21
+ Given there are 4 <%= plural_name %>
22
+ When I delete the first <%= singular_name %>
23
+ Then there should be 3 <%= plural_name %> left
24
+
25
+ More Examples:
26
+ | initial | after |
27
+ | 100 | 99 |
28
+ | 1 | 0 |
@@ -0,0 +1,22 @@
1
+ Given /I am on the new <%= singular_name %> page/ do
2
+ visits "/<%= plural_name %>/new"
3
+ end
4
+
5
+ Given /there are (\d+) <%= plural_name %>/ do |n|
6
+ <%= class_name %>.transaction do
7
+ <%= class_name %>.destroy_all
8
+ n.to_i.times do |n|
9
+ <%= class_name %>.create! :name => "<%= class_name %> #{n}"
10
+ end
11
+ end
12
+ end
13
+
14
+ When /I delete the first <%= singular_name %>/ do
15
+ visits <%= plural_name %>_url
16
+ clicks_link "Destroy"
17
+ end
18
+
19
+ Then /there should be (\d+) <%= plural_name %> left/ do |n|
20
+ <%= class_name %>.count.should == n.to_i
21
+ response.should have_tag("table tr", n.to_i + 1) # There is a header row too
22
+ end
@@ -1,7 +1,7 @@
1
1
  module Newgem
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 27
4
+ MINOR = 28
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -0,0 +1,36 @@
1
+ require 'rbconfig'
2
+
3
+ # This generator bootstraps a Rails project for use with Cucumber
4
+ class InstallCucumberGenerator < RubiGen::Base
5
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
+ Config::CONFIG['ruby_install_name'])
7
+
8
+ attr_reader :project_name
9
+
10
+ def initialize(runtime_args, runtime_options = {})
11
+ super
12
+ @project_name = File.basename(destination_root)
13
+ end
14
+
15
+ def manifest
16
+ record do |m|
17
+ script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
18
+
19
+ m.directory 'features/steps'
20
+ m.template 'env.rb', 'features/steps/env.rb'
21
+
22
+ m.directory 'tasks'
23
+ m.file 'cucumber.rake', 'tasks/cucumber.rake'
24
+
25
+ m.directory 'script'
26
+ m.file 'cucumber', 'script/cucumber', script_options
27
+ end
28
+ end
29
+
30
+ protected
31
+
32
+ def banner
33
+ "Usage: #{$0} cucumber"
34
+ end
35
+
36
+ end
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber")
@@ -0,0 +1,6 @@
1
+ gem 'cucumber'
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new(:features) do |t|
5
+ t.cucumber_opts = "--format pretty"
6
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + "/../../lib/<%= project_name %>"
2
+
3
+ gem 'cucumber'
4
+
5
+
6
+ # Following lines from original Rails cucumber generator.
7
+ # Not sure how to translate/reuse etc yet.
8
+ #
9
+ # # Sets up the Rails environment for Cucumber
10
+ # ENV["RAILS_ENV"] = "test"
11
+ # require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
12
+ # require 'cucumber/rails/world'
13
+ # Cucumber::Rails.use_transactional_fixtures
14
+ #
15
+ # # Comment out the next line if you're not using RSpec's matchers (should / should_not) in your steps.
16
+ # require 'cucumber/rails/rspec'
data/script/generate CHANGED
@@ -11,4 +11,4 @@ require 'rubigen/scripts/generate'
11
11
 
12
12
  ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
13
  RubiGen::Base.use_component_sources! :rubygems, :newgem, :test_unit
14
- RubiGen::Scripts::Generate.new.run(ARGV)
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,46 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestFeatureGenerator < Test::Unit::TestCase
5
+ include RubiGen::GeneratorTestHelper
6
+
7
+ def setup
8
+ bare_setup
9
+ end
10
+
11
+ def teardown
12
+ bare_teardown
13
+ end
14
+
15
+ # Some generator-related assertions:
16
+ # assert_generated_file(name, &block) # block passed the file contents
17
+ # assert_directory_exists(name)
18
+ # assert_generated_class(name, &block)
19
+ # assert_generated_module(name, &block)
20
+ # assert_generated_test_for(name, &block)
21
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
22
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
23
+ #
24
+ # Other helper methods are:
25
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
26
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
27
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
28
+
29
+ def test_generator_without_options
30
+ name = "myapp"
31
+ run_generator('feature', [name], sources)
32
+ assert_directory_exists('features/steps')
33
+ assert_generated_file("features/manage_myapps.feature")
34
+ assert_generated_file("features/steps/myapp_steps.rb")
35
+ end
36
+
37
+ private
38
+ def sources
39
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
40
+ ]
41
+ end
42
+
43
+ def generator_path
44
+ "cucumber_generators"
45
+ end
46
+ end
@@ -0,0 +1,49 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestInstallCucumberGenerator < Test::Unit::TestCase
4
+ include RubiGen::GeneratorTestHelper
5
+
6
+ def setup
7
+ bare_setup
8
+ end
9
+
10
+ def teardown
11
+ bare_teardown
12
+ end
13
+
14
+ # Some generator-related assertions:
15
+ # assert_generated_file(name, &block) # block passed the file contents
16
+ # assert_directory_exists(name)
17
+ # assert_generated_class(name, &block)
18
+ # assert_generated_module(name, &block)
19
+ # assert_generated_test_for(name, &block)
20
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
21
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
22
+ #
23
+ # Other helper methods are:
24
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
+
28
+ def test_generator_without_options
29
+ run_generator('install_cucumber', [], sources)
30
+ assert_directory_exists("features/steps")
31
+ assert_generated_file("features/steps/env.rb") do |body|
32
+ assert_match(/#{PROJECT_NAME}/, body)
33
+ end
34
+ assert_directory_exists("tasks")
35
+ assert_generated_file("tasks/cucumber.rake")
36
+ assert_directory_exists("script")
37
+ assert_generated_file("script/cucumber")
38
+ end
39
+
40
+ private
41
+ def sources
42
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
43
+ ]
44
+ end
45
+
46
+ def generator_path
47
+ "rubygems_generators"
48
+ end
49
+ end
data/website/index.html CHANGED
@@ -39,7 +39,7 @@
39
39
 
40
40
  <div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
41
41
  <p>Get Version</p>
42
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.27.0</a>
42
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.28.0</a>
43
43
  <p>Featured in</p>
44
44
  <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
45
45
  </div>
@@ -225,7 +225,7 @@ rake install_gem</pre>
225
225
  <h2>Contact</h2>
226
226
  <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
227
227
  <p class="coda">
228
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 24th September 2008<br>
228
+ <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 23rd September 2008<br>
229
229
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
230
230
  </p>
231
231
  </div>
@@ -39,7 +39,7 @@
39
39
 
40
40
  <div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
41
41
  <p>Get Version</p>
42
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.27.0</a>
42
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.28.0</a>
43
43
  <p>Featured in</p>
44
44
  <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
45
45
  </div>
@@ -227,7 +227,7 @@ OPTIONS
227
227
  specify whether release_notes/changes are preformatted
228
228
  </pre>
229
229
  <p class="coda">
230
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 17th June 2008<br>
230
+ <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 16th June 2008<br>
231
231
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
232
232
  </p>
233
233
  </div>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.27.0";
2
+ var version = "0.28.0";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "0.27.0";
2
+ var version = "0.28.0";
3
3
 
4
4
  document.write(" - " + version);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-24 00:00:00 +10:00
12
+ date: 2008-10-17 00:00:00 -02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 1.7.0
63
+ version: 1.8.0
64
64
  version:
65
65
  description: Make your own gems at home
66
66
  email:
@@ -121,6 +121,10 @@ files:
121
121
  - bundles/RubyGem.tmbundle/Syntaxes/Rdoc.tmLanguage
122
122
  - bundles/RubyGem.tmbundle/info.plist
123
123
  - config/hoe.rb
124
+ - cucumber_generators/feature/USAGE
125
+ - cucumber_generators/feature/feature_generator.rb
126
+ - cucumber_generators/feature/templates/feature.erb
127
+ - cucumber_generators/feature/templates/steps.erb
124
128
  - lib/newgem.rb
125
129
  - lib/newgem/quick_template.rb
126
130
  - lib/newgem/rubyforge.rb
@@ -156,6 +160,10 @@ files:
156
160
  - rubygems_generators/extconf/templates/tasks/extconf.rake
157
161
  - rubygems_generators/extconf/templates/tasks/extconf_name.rake
158
162
  - rubygems_generators/extconf/templates/test/test.rb.erb
163
+ - rubygems_generators/install_cucumber/install_cucumber_generator.rb
164
+ - rubygems_generators/install_cucumber/templates/cucumber
165
+ - rubygems_generators/install_cucumber/templates/cucumber.rake
166
+ - rubygems_generators/install_cucumber/templates/env.rb
159
167
  - rubygems_generators/install_jruby/USAGE
160
168
  - rubygems_generators/install_jruby/install_jruby_generator.rb
161
169
  - rubygems_generators/install_jruby/templates/tasks/jruby.rake
@@ -189,8 +197,10 @@ files:
189
197
  - test/fixtures/home/.rubyforge/user-config.yml
190
198
  - test/test_executable_generator.rb
191
199
  - test/test_extconf_generator.rb
200
+ - test/test_feature_generator.rb
192
201
  - test/test_generator_helper.rb
193
202
  - test/test_helper.rb
203
+ - test/test_install_cucumber_generator.rb
194
204
  - test/test_install_jruby_generator.rb
195
205
  - test/test_install_rspec_generator.rb
196
206
  - test/test_install_rspec_stories_generator.rb
@@ -238,7 +248,7 @@ post_install_message: |+
238
248
 
239
249
  Did you know you have script/generate generators?
240
250
  application_generator, component_generator, executable,
241
- extconf, install_jruby, install_rspec, install_rspec_stories,
251
+ extconf, install_cucumber, install_jruby, install_rspec,
242
252
  install_website, test_unit
243
253
 
244
254
  Have fun making RubyGems!
@@ -264,15 +274,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
274
  requirements: []
265
275
 
266
276
  rubyforge_project: newgem
267
- rubygems_version: 1.2.0
277
+ rubygems_version: 1.3.0
268
278
  signing_key:
269
279
  specification_version: 2
270
280
  summary: Make your own gems at home
271
281
  test_files:
272
282
  - test/test_executable_generator.rb
273
283
  - test/test_extconf_generator.rb
284
+ - test/test_feature_generator.rb
274
285
  - test/test_generator_helper.rb
275
286
  - test/test_helper.rb
287
+ - test/test_install_cucumber_generator.rb
276
288
  - test/test_install_jruby_generator.rb
277
289
  - test/test_install_rspec_generator.rb
278
290
  - test/test_install_rspec_stories_generator.rb