Permalink
Browse files

Merge branch 'upgrade-infrastructure'

  • Loading branch information...
2 parents 9bba03f + 7f40fc0 commit 37a9362503e5a30b13eaf3761c2c8ce89fb420fa @luislavena luislavena committed Nov 25, 2010
Showing with 91 additions and 214 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 Isolate
  3. +5 −5 README.rdoc
  4. +3 −5 Rakefile
  5. +5 −1 features/step_definitions/gem.rb
  6. +1 −1 features/support/file_template_helpers.rb
  7. +11 −0 tasks/bootstrap.rake
  8. +1 −4 tasks/common.rake
  9. +38 −78 tasks/news.rake
  10. +0 −15 tasks/rdoc.rake
  11. +0 −41 tasks/rdoc_publish.rake
  12. +19 −64 tasks/release.rake
View
@@ -1,3 +1,4 @@
+.rvmrc
.*.sw[pon]
coverage
doc/api
View
@@ -0,0 +1,7 @@
+gem 'rake'
+gem 'rspec', '~> 1.3.1'
+gem 'cucumber', '~> 0.9.4'
+
+unless RUBY_PLATFORM =~ /java/
+ gem 'rcov', '~> 0.9.9'
+end
View
@@ -304,11 +304,11 @@ development of it! (and contributions too!)
You can find more information about rake-compiler:
-Blog: http://blog.mmediasys.com
-RubyForge: http://rubyforge.org/projects/rake-compiler
-GitHub: http://github.com/luislavena/rake-compiler
-Issues: http://github.com/luislavena/rake-compiler/issues
-Wiki: http://github.com/luislavena/rake-compiler/wiki
+* GitHub: https://github.com/luislavena/rake-compiler
+* Issues: https://github.com/luislavena/rake-compiler/issues
+* Blog: http://blog.mmediasys.com
+* Docs: http://rubydoc.info/gems/rake-compiler
+* Wiki: https://github.com/luislavena/rake-compiler/wiki
== Disclaimer
View
@@ -12,11 +12,9 @@
#
begin
- require 'rake'
-rescue LoadError
- require 'rubygems'
- gem 'rake', '~> 0.8.3.1'
- require 'rake'
+ require 'isolate/now'
+rescue LoadError => e
+ fail "This project uses Isolate to manage development dependencies. Please `gem install isolate` first and try again."
end
# load rakefile extensions (tasks)
@@ -17,7 +17,11 @@
`gem unpack #{gem_file_platform(folder, name, version, platform)} --target tmp`
unpacked_gem_dir = unpacked_gem_dir_platform('tmp', name, version, platform)
File.exist?(unpacked_gem_dir).should be_true
- Dir.glob(unpacked_gem_dir << "/lib/*.#{binary_extension(platform)}").should_not be_empty
+
+ files = Dir.glob("#{unpacked_gem_dir}/lib/*.#{binary_extension(platform)}")
+ files << Dir.glob("#{unpacked_gem_dir}/lib/*/*.#{binary_extension(platform)}")
+
+ files.flatten.uniq.should_not be_empty
end
Then /^gem for platform '(.*)' get generated$/ do |platform|
@@ -70,7 +70,7 @@ def template_rake_extension_multi_cross_compile(extension_name)
require 'rake/extensiontask'
Rake::ExtensionTask.new("#{extension_name}", SPEC) do |ext|
ext.cross_compile = true
- ext.cross_platform = ['i386-mswin32', 'i386-mingw32']
+ ext.cross_platform = ['x86-mswin32', 'x86-mingw32']
end
EOF
end
View
@@ -0,0 +1,11 @@
+desc 'Ensure all the cross compiled versions are installed'
+task :bootstrap do
+ fail "Sorry, this only works on OSX and Linux" if RUBY_PLATFORM =~ /mswin|mingw/
+
+ versions = %w(1.8.6-p398 1.9.1-p243 1.9.2-p0)
+
+ versions.each do |version|
+ puts "[INFO] Attempt to cross-compile Ruby #{version}"
+ ruby "-Ilib bin/rake-compiler cross-ruby VERSION=#{version}"
+ end
+end
View
@@ -1,13 +1,10 @@
require 'rake/clean'
# common pattern cleanup
-CLEAN.include('tmp')
+CLEAN.include('tmp/project.*')
# set default task
task :default => [:spec, :features]
# make packing depend on success of running specs and features
task :package => [:spec, :features]
-
-# publish documentation when doing a release
-task :release => [:publish]
View
@@ -1,79 +1,39 @@
-begin
- require 'rubyforge'
-rescue LoadError
- warn "rubyforge gem is required to generate announces, please install it (gem install rubyforge)."
-end
-
-CLEAN.include('email.txt')
-
-if defined?(RubyForge) then
- if defined?(GEM_SPEC) then
- desc 'Create news email file and post to RubyForge.'
- task :announce do |t|
- ver = ENV['VERSION'] or fail "Must supply VERSION (rake announce VERSION=x.y.z)."
-
- # compare versions to avoid mistakes
- unless ver == GEM_SPEC.version.to_s then
- fail "Version mismatch (supplied and specification versions differ)."
- end
-
- # no homepage? why announce it then?!
- if GEM_SPEC.homepage == 'TODO' or GEM_SPEC.homepage.nil? then
- fail "Must define homepage in your gem specification."
- end
-
- # no rubyforge project? no release for you!
- if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
- fail "Must define rubyforge_project in your gem specification."
- end
-
- # instantiate a RubyForge object
- rf = RubyForge.new.configure
-
- # read project info and overview
- notes = begin
- r = File.read("README.rdoc")
- r.split(/^(=+ .*)/)[1..4].join.strip
- rescue
- warn "Missing README.rdoc"
- ''
- end
-
- # read changes
- changes = begin
- h = File.read("History.txt")
- h.split(/^(===+ .*)/)[1..2].join.strip
- rescue
- warn "Missing History.txt"
- ''
- end
-
- # standard fields
- subject = "#{GEM_SPEC.name} #{GEM_SPEC.version} Released"
- title = "#{GEM_SPEC.name} version #{GEM_SPEC.version} has been released!"
- body = "#{notes}\n\nChanges:\n\n#{changes}"
- urls = [GEM_SPEC.homepage, "http://rubyforge.org/projects/#{GEM_SPEC.rubyforge_project}"].map { |u| "* <#{u.strip}>" }.join("\n")
-
- puts "Logging in RubyForge..."
- rf.login
-
- puts "Generating email.txt..."
- File.open("email.txt", "w") do |mail|
- mail.puts "Subject: [ANN] #{subject}"
- mail.puts
- mail.puts title
- mail.puts
- mail.puts urls
- mail.puts
- mail.puts body
- end
- puts "Created email.txt"
-
- puts "Posting news for #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
- rf.post_news GEM_SPEC.rubyforge_project, subject, "#{title}\n\n#{body}"
- puts "Done."
- end
- else
- warn "no GEM_SPEC is found or defined. 'announce' task cannot work without it."
- end
+desc 'Generate email template to standard output'
+task :announce do
+ fail "no GEM_SPEC is found or defined. 'announce' task cannot work without it." unless defined?(GEM_SPEC)
+
+ # read project info and overview
+ notes = begin
+ r = File.read("README.rdoc")
+ r.split(/^(=+ .*)/)[1..4].join.strip
+ rescue
+ warn "Missing README.rdoc"
+ ''
+ end
+
+ # read changes
+ changes = begin
+ h = File.read("History.txt")
+ h.split(/^(===+ .*)/)[1..2].join.strip
+ rescue
+ warn "Missing History.txt"
+ ''
+ end
+
+ # standard fields
+ subject = "#{GEM_SPEC.name} #{GEM_SPEC.version} Released"
+ title = "#{GEM_SPEC.name} version #{GEM_SPEC.version} has been released!"
+ body = "#{notes}\n\nChanges:\n\n#{changes}"
+ urls = [GEM_SPEC.homepage].map { |u| "* <#{u.strip}>" }.join("\n")
+
+ puts "=" * 80, ""
+ puts "Subject: [ANN] #{subject}"
+ puts
+ puts title
+ puts
+ puts urls
+ puts
+ puts body
+ puts
+ puts "=" * 80, ""
end
View
@@ -1,15 +0,0 @@
-begin
- require 'rdoc/task'
-rescue LoadError
- warn "RDoc 2.4.3+ gem is required, please install it (gem install rdoc)."
-end
-
-if defined?(RDoc) then
- DOC = RDoc::Task.new(:rdoc) do |rd|
- rd.title = 'rake-compiler -- Documentation'
- rd.main = 'README.rdoc'
- rd.rdoc_dir = 'doc/api'
- rd.options << '--line-numbers' << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation'
- rd.rdoc_files.include %w(README.rdoc LICENSE.txt History.txt lib/**/*.rb)
- end
-end
View
@@ -1,41 +0,0 @@
-begin
- require 'rubyforge'
-rescue LoadError
- warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
-end
-
-if defined?(RubyForge) then
- if defined?(DOC) && defined?(GEM_SPEC) then
- desc "Publish RDoc to RubyForge"
- task :publish => [:clobber_rdoc, :rdoc] do
- config_file = File.expand_path('~/.rubyforge/user-config.yml')
- fail "You need rubyforge properly configured." unless File.exist?(config_file)
-
- # no rubyforge project? no release for you!
- if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
- fail "Must define rubyforge_project in your gem specification."
- end
-
- # use YAML to load configuration file
- config = YAML.load_file(config_file)
-
- host = "#{config['username']}@rubyforge.org"
- remote_dir = "/var/www/gforge-projects/#{GEM_SPEC.rubyforge_project}/"
- local_dir = DOC.rdoc_dir
-
- # use PuTTY pscp or scp on other platforms
- ssh_exe = RUBY_PLATFORM =~ /mswin|mingw/ ? 'pscp' : 'scp'
-
- # construct the command
- cmd = [ssh_exe]
- cmd << '-r' << '-q' # recursive and quiet options
- cmd << "#{local_dir}/*"
- cmd << "#{host}:#{remote_dir}"
-
- puts "Publishing RDocs to RubyForge..."
- sh cmd.join(' ')
- end
- else
- warn "You need a GEM_SPEC and DOC rdoc definitions present. task publish not defined."
- end
-end
View
@@ -1,71 +1,26 @@
-begin
- require 'rubyforge'
-rescue LoadError
- warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
-end
-
-if defined?(RubyForge) then
- if defined?(GEM_SPEC) then
- desc 'Package and upload to RubyForge'
- task :release => [:clobber, :package] do |t|
- ver = ENV['VERSION'] or fail "Must supply VERSION (rake release VERSION=x.y.z)."
-
- # compare versions to avoid mistakes
- unless ver == GEM_SPEC.version.to_s then
- fail "Version mismatch (supplied and specification versions differ)."
- end
-
- # no rubyforge project? no release for you!
- if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
- fail "Must define rubyforge_project in your gem specification."
- end
-
- # instantiate a RubyForge object
- rf = RubyForge.new
+desc 'Package gems and upload to RubyGems'
+task :release, :version, :needs => [:package] do |t, args|
+ args.with_defaults(:version => "")
+ ver = args.version
- # read project info and overview
- notes = begin
- r = File.read("README.rdoc")
- r.split(/^(=+ .*)/)[1..4].join.strip
- rescue
- warn "Missing README.rdoc"
- ''
- end
+ fail "no GEM_SPEC is found or defined. 'release' task cannot work without it." unless defined?(GEM_SPEC)
- # read changes
- changes = begin
- h = File.read("History.txt")
- h.split(/^(===+ .*)/)[1..2].join.strip
- rescue
- warn "Missing History.txt"
- ''
- end
-
- # build the configuration for the release
- config = Hash.new
- config["release_notes"] = notes
- config["release_changes"] = changes
- config["preformatted"] = true
-
- # prepare configuration
- rf.configure config
-
- files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a
- fail "No files found for the release." if files.empty?
+ # compare versions to avoid mistakes
+ unless ver == GEM_SPEC.version.to_s then
+ fail "Version mismatch (supplied and specification versions differ)."
+ end
- puts "Logging in RubyForge..."
- rf.login
+ files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a
+ fail "No files found for the release." if files.empty?
- puts "Files to upload:"
- files.each do |f|
- puts " * #{f}"
- end
+ puts "Files to release:"
+ files.each do |f|
+ puts " * #{f}"
+ end
- puts "Releasing #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
- rf.add_release GEM_SPEC.rubyforge_project, GEM_SPEC.name, GEM_SPEC.version, *files
- puts "Done."
- end
- else
- warn "no GEM_SPEC is found or defined. 'release' task cannot work without it."
+ puts "Releasing #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
+ files.each do |f|
+ system "gem push #{f}"
end
+ puts "Done."
end

0 comments on commit 37a9362

Please sign in to comment.