newgem 0.20.1 → 0.21.0

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/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.21.0 2008-04-03
2
+
3
+ * New Generator: install_rspec_stories for rubygems
4
+ * module.rb - more advanced $:.unshift sequence/cmd
5
+
1
6
  == 0.20.1 2008-03-30
2
7
 
3
8
  * extconf generator
data/Manifest.txt CHANGED
@@ -85,6 +85,11 @@ rubygems_generators/install_rspec/templates/spec.rb
85
85
  rubygems_generators/install_rspec/templates/spec/spec.opts
86
86
  rubygems_generators/install_rspec/templates/spec/spec_helper.rb
87
87
  rubygems_generators/install_rspec/templates/tasks/rspec.rake
88
+ rubygems_generators/install_rspec_stories/USAGE
89
+ rubygems_generators/install_rspec_stories/install_rspec_stories_generator.rb
90
+ rubygems_generators/install_rspec_stories/templates/all.rb
91
+ rubygems_generators/install_rspec_stories/templates/steps.rb
92
+ rubygems_generators/install_rspec_stories/templates/story.story
88
93
  script/destroy
89
94
  script/generate
90
95
  script/txt2html
@@ -102,6 +107,7 @@ test/test_generator_helper.rb
102
107
  test/test_helper.rb
103
108
  test/test_install_jruby_generator.rb
104
109
  test/test_install_rspec_generator.rb
110
+ test/test_install_rspec_stories_generator.rb
105
111
  test/test_install_website_generator.rb
106
112
  test/test_newgem_generator.rb
107
113
  test/test_newgem_simple_generator.rb
@@ -1,4 +1,5 @@
1
- $:.unshift File.dirname(__FILE__)
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
3
 
3
4
  module <%= module_name %>
4
5
 
@@ -1,8 +1,8 @@
1
1
  module Newgem #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 20
5
- TINY = 1
4
+ MINOR = 21
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -4,4 +4,7 @@ rescue LoadError
4
4
  require 'rubygems'
5
5
  gem 'rspec'
6
6
  require 'spec'
7
- end
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require '<%= gem_name %>'
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Creates an RSpec story scaffold for this RubyGem.
3
+
4
+ Usage:
5
+ script/generate install_rspec_stories
@@ -0,0 +1,53 @@
1
+ class InstallRspecStoriesGenerator < RubiGen::Base
2
+
3
+ default_options :author => nil
4
+
5
+ attr_reader :gem_name, :name
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+ @gem_name = base_name
10
+ extract_options
11
+ end
12
+
13
+ def manifest
14
+ record do |m|
15
+ # Ensure appropriate folder(s) exists
16
+ m.directory 'stories/steps'
17
+
18
+ m.template 'steps.rb', "stories/steps/#{gem_name}_steps.rb"
19
+ m.template 'story.story', "stories/sell_#{gem_name}.story"
20
+ m.template 'all.rb', "stories/all.rb"
21
+ # Create stubs
22
+ # m.template "template.rb", "some_file_after_erb.rb"
23
+ # m.file "file", "some_file_copied"
24
+ end
25
+ end
26
+
27
+ protected
28
+ def banner
29
+ <<-EOS
30
+ Creates an RSpec story scaffold for this RubyGem.
31
+
32
+ USAGE: #{$0} #{spec.name}
33
+ EOS
34
+ end
35
+
36
+ def add_options!(opts)
37
+ # opts.separator ''
38
+ # opts.separator 'Options:'
39
+ # For each option below, place the default
40
+ # at the top of the file next to "default_options"
41
+ # opts.on("-a", "--author=\"Your Name\"", String,
42
+ # "Some comment about this option",
43
+ # "Default: none") { |options[:author]| }
44
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
45
+ end
46
+
47
+ def extract_options
48
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
49
+ # Templates can access these value via the attr_reader-generated methods, but not the
50
+ # raw instance variable value.
51
+ # @author = options[:author]
52
+ end
53
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'spec/story'
3
+ require File.dirname(__FILE__) + '/../spec/spec_helper'
4
+ require 'stories/steps/rubyfools_steps'
5
+
6
+ with_steps_for :rubyfools do
7
+ run 'stories/sell_rubyfools.story'
8
+ end
@@ -0,0 +1,15 @@
1
+ # TODO: Make the steps talk to your code
2
+ steps_for :rubyfools do
3
+ Given 'there are $n rubyfools' do |n|
4
+ @initial = n.to_i
5
+ end
6
+
7
+ When 'I sell $n rubyfools' do |n|
8
+ @sold = n.to_i
9
+ end
10
+
11
+ Then 'there should be $n rubyfools' do |n|
12
+ @left = n.to_i + 1
13
+ (@initial - @sold).should == @left
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ Story: Sell RubyFools
2
+ As a conference organiser
3
+ I want to sell RubyFools
4
+ So that I can make the world a better place
5
+
6
+ Scenario: Sell a cpuple
7
+ Given there are 5 rubyfools
8
+ When I sell 2 rubyfools
9
+ Then there should be 3 rubyfools
@@ -0,0 +1,46 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestInstallRspecStoriesGenerator < 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
+ name = "myapp"
30
+ run_generator('install_rspec_stories', [name], sources)
31
+ assert_directory_exists("stories/steps")
32
+ assert_generated_file("stories/steps/myapp_steps.rb")
33
+ assert_generated_file("stories/sell_myapp.story")
34
+ assert_generated_file("stories/all.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
+ "rubygems_generators"
45
+ end
46
+ end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>New Gem Generator</h1>
34
34
  <div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="" class="numbers">0.20.1</a>
36
+ <a href="" class="numbers">0.21.0</a>
37
37
  <p>Featured in</p>
38
38
  <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>
39
39
  </div>
@@ -33,7 +33,7 @@
33
33
  <h1>New Gem Generator</h1>
34
34
  <div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="" class="numbers">0.20.1</a>
36
+ <a href="" class="numbers">0.21.0</a>
37
37
  <p>Featured in</p>
38
38
  <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>
39
39
  </div>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.20.1";
2
+ var version = "0.21.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.20.1";
2
+ var version = "0.21.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.20.1
4
+ version: 0.21.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-03-31 00:00:00 +02:00
12
+ date: 2008-04-03 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -177,6 +177,11 @@ files:
177
177
  - rubygems_generators/install_rspec/templates/spec/spec.opts
178
178
  - rubygems_generators/install_rspec/templates/spec/spec_helper.rb
179
179
  - rubygems_generators/install_rspec/templates/tasks/rspec.rake
180
+ - rubygems_generators/install_rspec_stories/USAGE
181
+ - rubygems_generators/install_rspec_stories/install_rspec_stories_generator.rb
182
+ - rubygems_generators/install_rspec_stories/templates/all.rb
183
+ - rubygems_generators/install_rspec_stories/templates/steps.rb
184
+ - rubygems_generators/install_rspec_stories/templates/story.story
180
185
  - script/destroy
181
186
  - script/generate
182
187
  - script/txt2html
@@ -194,6 +199,7 @@ files:
194
199
  - test/test_helper.rb
195
200
  - test/test_install_jruby_generator.rb
196
201
  - test/test_install_rspec_generator.rb
202
+ - test/test_install_rspec_stories_generator.rb
197
203
  - test/test_install_website_generator.rb
198
204
  - test/test_newgem_generator.rb
199
205
  - test/test_newgem_simple_generator.rb
@@ -245,6 +251,7 @@ test_files:
245
251
  - test/test_helper.rb
246
252
  - test/test_install_jruby_generator.rb
247
253
  - test/test_install_rspec_generator.rb
254
+ - test/test_install_rspec_stories_generator.rb
248
255
  - test/test_install_website_generator.rb
249
256
  - test/test_newgem_generator.rb
250
257
  - test/test_newgem_simple_generator.rb