Skip to content
Browse files

Latest changes to support rspec

git-svn-id: svn+ssh://rubyforge.org/var/svn/newgem/trunk@59 b8dfb574-5f1f-0410-9469-b441dc4e948f
  • Loading branch information...
1 parent 80d1173 commit ecc2211f1ba7a4f038499afd3e60d69ead3b1472 nicwilliams committed
Showing with 70 additions and 11 deletions.
  1. +8 −0 History.txt
  2. +1 −0 Manifest.txt
  3. +13 −2 Rakefile
  4. +22 −1 bin/newgem
  5. +1 −1 lib/newgem/version.rb
  6. +6 −1 templates/Rakefile
  7. +1 −0 templates/spec.opts
  8. +8 −1 templates/spec.rb
  9. +5 −2 website/index.html
  10. +2 −0 website/index.txt
  11. +1 −1 website/rubyforge.html
  12. +1 −1 website/version-raw.js
  13. +1 −1 website/version.js
View
8 History.txt
@@ -1,3 +1,11 @@
++++ 0.10.1 XXX
++ 2 minor enhancements
+ + Gems using rspec include a #spec task to run all spec tests
+ + Generated rakefile#deploy prompts user to do svn tag
+ + Generated local_deploy prints svn command to tag release
++ 1 dependency update:
+ + Hoe 1.2.1
+
+++ 0.10.0 2007-05-19
+ 3 major enhancements
View
1 Manifest.txt
@@ -19,6 +19,7 @@ templates/Rakefile
templates/app.rb
templates/scripts/txt2html
templates/setup.rb
+templates/spec.opts
templates/spec.rb
templates/test.rb
templates/website/index.html
View
15 Rakefile
@@ -1,6 +1,7 @@
require 'rubygems'
require 'rake'
require 'rake/clean'
+require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
@@ -42,7 +43,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
# == Optional
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.extra_deps = [
- ['hoe', '>=1.2.0'],
+ ['hoe', '>=1.2.1'],
['RedCloth','>=3.0.4'],
['syntax','>=1.0.0']
]
@@ -81,7 +82,17 @@ task :load_consts do
end
desc 'Release the website and new gem version'
-task :deploy => [:check_version, :website, :release]
+task :deploy => [:check_version, :website, :release] do
+ # Create SVN tag
+ puts "Remember to create SVN tag /tags/REL-#{ENV['VERSION']}"
+ # e.g. svn copy svn+ssh://nicwilliams@rubyforge.org/var/svn/magicmodels/magic_model_generator/trunk
+ # svn+ssh://nicwilliams@rubyforge.org/var/svn/magicmodels/magic_model_generator/tags/REL-#{VERS}
+ # -m "Tagging release #{VERS}"
+ puts "Remember to create SVN tag:"
+ puts "svn copy svn+ssh://\#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/\#{RUBYFORGE_PROJECT}/\#{NAME}/trunk " +
+ "svn+ssh://\#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/\#{RUBYFORGE_PROJECT}/\#{NAME}/tags/REL-\#{VERS} " +
+ "-m \"Tagging release \#{VERS}\""
+end
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
task :local_deploy => [:website_generate, :install_gem]
View
23 bin/newgem
@@ -167,10 +167,20 @@ if test_framework == 'rspec'
test_template = 'spec.rb'
unit_test = test + "/" + project_name + "_spec.rb"
test_file_prefix = 'spec/NAME_spec'
+ spec_opts = 'spec.opts'
unit_test_template = <<-eos
require 'spec'
-require File.dirname(__FILE__) + '/../lib/#{project_name}'
eos
+ requirements = <<-eos
+require 'spec/rake/spectest'
+ eos
+ test_task = <<-eos
+desc "Run the specs under spec/models"
+Spec::Rake::SpecTask.new do |t|
+ t.spec_opts = ['--options', "spec/spec.opts"]
+ t.spec_files = FileList['spec/*_spec.rb']
+end
+ eos
else
test = project_name + "/test"
test_helper = test + "/test_helper.rb"
@@ -181,6 +191,8 @@ else
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/#{project_name}'
eos
+ requirements = ''
+ test_task = ''
end
puts "creating: " + test
@@ -198,6 +210,15 @@ File.open(unit_test, 'w') do |file|
file << eval('"' + template.gsub(/"/, '\"') + '"')
end
+if test_framework == 'rspec'
+ spec_opts_file = test + "/" + spec_opts
+ puts "creating: " + spec_opts_file
+ template = File.open(templates + spec_opts, 'r') { |f| f.readlines.join }
+ File.open(spec_opts_file, 'w') do |file|
+ file << eval('"' + template.gsub(/"/, '\""') + '"')
+ end
+end
+
puts "creating: " + examples
Dir.mkdir examples
View
2 lib/newgem/version.rb
@@ -2,7 +2,7 @@ module Newgem #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 10
- TINY = 0
+ TINY = 1
STRING = [MAJOR, MINOR, TINY].join('.')
end
View
7 templates/Rakefile
@@ -8,6 +8,7 @@ require 'rake/rdoctask'
require 'rake/contrib/rubyforgepublisher'
require 'fileutils'
require 'hoe'
+#{requirements}
include FileUtils
require File.join(File.dirname(__FILE__), 'lib', '#{gem_name}', 'version')
@@ -75,7 +76,10 @@ desc 'Generate and upload website files'
task :website => [:website_generate, :website_upload]
desc 'Release the website and new gem version'
-task :deploy => [:check_version, :website, :release]
+task :deploy => [:check_version, :website, :release] do
+ # Create SVN tag
+ puts "Remember to create SVN tag /tags/REL-#{ENV['VERSION']}"
+end
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
task :local_deploy => [:website_generate, :install_gem]
@@ -91,3 +95,4 @@ task :check_version do
end
end
+#{test_task}
View
1 templates/spec.opts
@@ -0,0 +1 @@
+--colour
View
9 templates/spec.rb
@@ -1,4 +1,11 @@
require File.dirname(__FILE__) + '/spec_helper.rb'
# Time to add your specs!
-# http://rspec.rubyforge.org/
+# http://rspec.rubyforge.org/
+context "Place your specs here" do
+
+ specify "find this spec in spec directory" do
+ violate "Be sure to write your specs"
+ end
+
+end
View
7 website/index.html
@@ -33,7 +33,7 @@
<h1>New Gem Generator</h1>
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return false'>
Get Version
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.10.0</a>
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.10.1</a>
</div>
<h1>&#x2192; &#8216;newgem&#8217;</h1>
@@ -98,6 +98,9 @@
NOW - update wizzo/Rakefile with gem description, etc
</pre>
+ <p>As of 0.10.0 &#8211; you can generate test::unit or rspec test stubs via the -t,&#8212;test-with options</p>
+
+
<h3>Setup</h3>
@@ -287,7 +290,7 @@
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
<p class="coda">
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 10th May 2007<br>
+ <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 20th May 2007<br>
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
</p>
</div>
View
2 website/index.txt
@@ -52,6 +52,8 @@ copying: wizzo/website/stylesheets/screen.css
NOW - update wizzo/Rakefile with gem description, etc
</pre>
+As of 0.10.0 - you can generate test::unit or rspec test stubs via the -t, --test-with options
+
h3. Setup
Now modify the constants at the top of *Rakefile*, with your name, email and the location where you'll host your website for the gem. The defaults are tied to RubyForge for uploading the gems and the website (see below).
View
2 website/rubyforge.html
@@ -33,7 +33,7 @@
<h1>New Gem Generator</h1>
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return false'>
Get Version
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.10.0</a>
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.10.1</a>
</div>
<h1>&#x2192; using &#8216;rubyforge&#8217;</h1>
View
2 website/version-raw.js
@@ -1,3 +1,3 @@
// Announcement JS file
-var version = "0.10.0";
+var version = "0.10.1";
MagicAnnouncement.show('compositekeys', version);
View
2 website/version.js
@@ -1,4 +1,4 @@
// Version JS file
-var version = "0.10.0";
+var version = "0.10.1";
document.write(" - " + version);

0 comments on commit ecc2211

Please sign in to comment.
Something went wrong with that request. Please try again.