Skip to content

Commit

Permalink
Merge branch 'upgrade-infrastructure'
Browse files Browse the repository at this point in the history
  • Loading branch information
luislavena committed Nov 25, 2010
2 parents 9bba03f + 7f40fc0 commit 37a9362
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 214 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.rvmrc
.*.sw[pon]
coverage
doc/api
Expand Down
7 changes: 7 additions & 0 deletions Isolate
@@ -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
10 changes: 5 additions & 5 deletions README.rdoc
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions Rakefile
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion features/step_definitions/gem.rb
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion features/support/file_template_helpers.rb
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tasks/bootstrap.rake
@@ -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
5 changes: 1 addition & 4 deletions tasks/common.rake
@@ -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]
116 changes: 38 additions & 78 deletions tasks/news.rake
@@ -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
15 changes: 0 additions & 15 deletions tasks/rdoc.rake

This file was deleted.

41 changes: 0 additions & 41 deletions tasks/rdoc_publish.rake

This file was deleted.

83 changes: 19 additions & 64 deletions tasks/release.rake
@@ -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.