Rakefile in rest-graph-1.9.1 vs Rakefile in rest-graph-2.0.0
- old
+ new
@@ -7,44 +7,58 @@
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]
+ s.name = 'rest-graph'
+ s.version = RestGraph::VERSION
+ s.homepage = 'https://github.com/cardinalblue/rest-graph'
%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) }
+ %w[].each{ |g| s.add_development_dependency(g) }
- s.authors = ['Cardinal Blue', 'Lin Jen-Shin (godfat)']
- s.email = ['dev (XD) cardinalblue.com']
+ s.authors = ['Cardinal Blue', 'Lin Jen-Shin (godfat)']
+ s.email = ['dev (XD) cardinalblue.com']
end
Gemgem.write
end
+module Gemgem
+ module_function
+ def test_rails *rails
+ rails.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(' ')
+ Rake.sh "cd example/#{framework}; #{Gem.ruby} -S rake test #{args}"
+ }
+ end
+end
+
desc 'Run example tests'
-task 'test:example' => ['gem:install'] do
- %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}"
- }
+task 'test:example' do
+ Gemgem.test_rails('rails3', 'rails2')
end
desc 'Run all tests'
task 'test:all' => ['test', 'test:example']
desc 'Run different json test'
task 'test:json' do
%w[yajl json].each{ |json|
- sh "#{Gem.ruby} -S rake -r #{json} test"
+ Rake.sh "#{Gem.ruby} -S rake -r #{json} test"
}
+end
+
+task 'test:travis' do
+ case ENV['RESTGRAPH']
+ when 'rails3'; Gemgem.test_rails('rails3')
+ when 'rails2'; Gemgem.test_rails('rails2')
+ else ; Rake::Task['test'].invoke
+ end
end