Rakefile in rest-graph-1.7.0 vs Rakefile in rest-graph-1.8.0
- old
+ new
@@ -1,58 +1,43 @@
# encoding: utf-8
-begin
- require 'bones'
-rescue LoadError
- abort '### Please install the "bones" gem ###'
-end
+require "#{dir = File.dirname(__FILE__)}/task/gemgem"
+Gemgem.dir = dir
-ensure_in_path 'lib'
-proj = 'rest-graph'
-require "#{proj}/version"
+($LOAD_PATH << File.expand_path("#{Gemgem.dir}/lib" )).uniq!
-Bones{
- ruby_opts [''] # silence warning for now
+desc 'Generate gemspec'
+task 'gem:spec' do
+ Gemgem.spec = Gemgem.create do |s|
+ require 'rest-graph/version'
+ s.name = 'rest-graph'
+ s.version = RestGraph::VERSION
+ # s.executables = [s.name]
- version RestGraph::VERSION
+ %w[].each{ |g| s.add_runtime_dependency(g) }
+ %w[rest-client em-http-request rack yajl-ruby json json_pure ruby-hmac
+ webmock bacon rr].each{ |g| s.add_development_dependency(g) }
- depend_on 'rest-client' , :development => true
- depend_on 'em-http-request', :development => true
+ s.authors = ['Cardinal Blue', 'Lin Jen-Shin (godfat)']
+ s.email = ['dev (XD) cardinalblue.com']
+ end
- depend_on 'rack' , :development => true
-
- depend_on 'yajl-ruby', :development => true
- depend_on 'json' , :development => true
- depend_on 'json_pure', :development => true
-
- depend_on 'ruby-hmac', :development => true
-
- depend_on 'rr' , :development => true
- depend_on 'webmock' , :development => true
- depend_on 'bacon' , :development => true
-
- name proj
- url "http://github.com/cardinalblue/#{proj}"
- authors ['Cardinal Blue', 'Lin Jen-Shin (aka godfat 真常)']
- email 'dev (XD) cardinalblue.com'
-
- history_file 'CHANGES'
- readme_file 'README.rdoc'
- ignore_file '.gitignore'
- rdoc.include ['\w+']
- rdoc.exclude ['test', 'doc', 'Rakefile', 'example']
-}
-
-CLEAN.include Dir['**/*.rbc']
-
-task :default do
- Rake.application.options.show_task_pattern = /./
- Rake.application.display_tasks_and_comments
+ Gemgem.write
end
desc 'Run example tests'
task 'test:example' => ['gem:install'] do
- sh "cd example/rails2; #{Gem.ruby} -S rake test"
+ %w[rails3 rails2].each{ |framework|
+ opts = Rake.application.options
+ args = (opts.singleton_methods - [:rakelib, 'rakelib']).map{ |arg|
+ if arg.to_s !~ /=$/ && opts.send(arg)
+ "--#{arg}"
+ else
+ ''
+ end
+ }.join(' ')
+ sh "cd example/#{framework}; #{Gem.ruby} -S rake test #{args}"
+ }
end
desc 'Run all tests'
task 'test:all' => ['test', 'test:example']