|
22 | 22 |
|
23 | 23 | require "./lib/annotate"
|
24 | 24 |
|
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' |
27 | 92 |
|
28 | 93 | require "rspec/core/rake_task" # RSpec 2.0
|
29 | 94 | RSpec::Core::RakeTask.new(:spec) do |t|
|
|
0 commit comments