Skip to content

Commit a6f5497

Browse files
committed
Merge over change to gemspec handling.
1 parent 89548ee commit a6f5497

File tree

2 files changed

+70
-5
lines changed

2 files changed

+70
-5
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
source :rubygems
22

33
gem 'rake', '>= 0.8.7', :require => false
4-
gem 'activesupport', '>= 2.3.0', :require => false
4+
gem 'activerecord', '>= 2.3.0', :require => false
55

66
group :development do
7-
gem 'mg'
8-
platforms :ruby do
7+
gem 'mg', :require => false
8+
platforms :mri do
99
gem 'yard', :require => false
1010
end
1111
end

Rakefile

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,73 @@ end
2222

2323
require "./lib/annotate"
2424

25-
require 'mg'
26-
MG.new("annotate.gemspec")
25+
require "mg"
26+
begin
27+
MG.new("annotate.gemspec")
28+
rescue Exception => e
29+
STDERR.puts("WARNING: Couldn't read gemspec. As such, a number of tasks may be unavailable to you until you run 'rake gem:gemspec' to correct the issue.")
30+
# Gemspec is probably in a broken state, so let's give ourselves a chance to
31+
# build a new one...
32+
end
33+
DEVELOPMENT_GROUPS=[:development, :test]
34+
RUNTIME_GROUPS=Bundler.definition.groups - DEVELOPMENT_GROUPS
35+
namespace :gem do
36+
task :gemspec do
37+
spec = Gem::Specification.new do |gem|
38+
# See http://docs.rubygems.org/read/chapter/20
39+
# for more options.
40+
gem.version = Annotate.version
41+
gem.name = "annotate"
42+
gem.homepage = "http://github.com/ctran/annotate_models"
43+
gem.rubyforge_project = "annotate"
44+
gem.license = "Ruby"
45+
gem.summary = %q{Annotates Rails Models, routes, fixtures, and others based on the database schema.}
46+
gem.description = %q{Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the database schema.}
47+
gem.email = ["alex@stinky.com", "ctran@pragmaquest.com", "x@nofxx.com", "turadg@aleahmad.net", "jon@cloudability.com"]
48+
gem.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini", "Turadg Aleahmad", "Jon Frisby"]
49+
gem.require_paths = ["lib"]
50+
# gem.rdoc_options = ["--charset=UTF-8"]
51+
# gem.required_ruby_version = "> 1.9.2"
52+
53+
Bundler.load.dependencies_for(*RUNTIME_GROUPS).each do |dep|
54+
runtime_resolved = Bundler.definition.specs_for(RUNTIME_GROUPS).select { |spec| spec.name == dep.name }.first
55+
if(!runtime_resolved.nil?)
56+
gem.add_dependency(dep.name, dep.requirement)
57+
end
58+
end
59+
60+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
61+
gem.extra_rdoc_files = ['README.rdoc', 'CHANGELOG.rdoc', 'TODO.rdoc']
62+
63+
gem.files = `git ls-files -- .`.split("\n").reject do |fn|
64+
fn =~ /^Gemfile.*/ ||
65+
fn =~ /^Rakefile/ ||
66+
fn =~ /^\.rvmrc/ ||
67+
fn =~ /^\.gitignore/ ||
68+
fn =~ /^\.rspec/ ||
69+
fn =~ /^\.document/ ||
70+
fn =~ /^\.yardopts/ ||
71+
fn =~ /^pkg/ ||
72+
fn =~ /^spec/ ||
73+
fn =~ /^doc/ ||
74+
fn =~ /^vendor\/cache/
75+
end.sort
76+
end
77+
File.open("annotate.gemspec", "wb") do |fh|
78+
fh.write("# This file is auto-generated!\n")
79+
fh.write("# DO NOT EDIT THIS FILE DIRECTLY!\n")
80+
fh.write("# Instead, edit the Rakefile and run 'rake gems:gemspec'.")
81+
fh.write(spec.to_ruby)
82+
end
83+
end
84+
end
85+
86+
namespace :jeweler do
87+
task :clobber do
88+
FileUtils.rm_f("pkg")
89+
end
90+
end
91+
task :clobber => :'jeweler:clobber'
2792

2893
require "rspec/core/rake_task" # RSpec 2.0
2994
RSpec::Core::RakeTask.new(:spec) do |t|

0 commit comments

Comments
 (0)