2011-11-16 11:56:10 +00:00
|
|
|
require 'rubygems/package_task'
|
2011-12-02 13:42:46 +00:00
|
|
|
require 'rake/clean'
|
|
|
|
|
|
|
|
CLOBBER.include('pkg')
|
2010-07-28 19:30:56 +00:00
|
|
|
|
|
|
|
namespace :gem do
|
|
|
|
GEM_SPEC = Gem::Specification.new do |s|
|
|
|
|
unless s.respond_to?(:add_development_dependency)
|
2010-08-17 01:21:17 +00:00
|
|
|
puts 'The gem spec requires a newer version of RubyGems.'
|
2010-07-28 19:30:56 +00:00
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
s.name = PKG_NAME
|
|
|
|
s.version = PKG_VERSION
|
2011-08-02 18:39:46 +00:00
|
|
|
s.author = PKG_AUTHOR
|
|
|
|
s.email = PKG_AUTHOR_EMAIL
|
2010-07-28 19:30:56 +00:00
|
|
|
s.summary = PKG_SUMMARY
|
|
|
|
s.description = PKG_DESCRIPTION
|
|
|
|
|
|
|
|
s.files = PKG_FILES.to_a
|
2010-10-12 01:53:40 +00:00
|
|
|
s.executables << 'google-api'
|
2010-07-28 19:30:56 +00:00
|
|
|
|
2011-10-11 11:54:57 +00:00
|
|
|
s.extra_rdoc_files = %w( README.md )
|
|
|
|
s.rdoc_options.concat ['--main', 'README.md']
|
2010-07-28 19:30:56 +00:00
|
|
|
|
2010-10-22 17:14:02 +00:00
|
|
|
# Dependencies used in the main library
|
2012-05-24 14:47:17 +00:00
|
|
|
s.add_runtime_dependency('signet', '>= 0.3.4')
|
2012-01-30 13:42:02 +00:00
|
|
|
s.add_runtime_dependency('addressable', '>= 2.2.3')
|
2012-02-10 14:16:55 +00:00
|
|
|
s.add_runtime_dependency('autoparse', '>= 0.3.1')
|
2012-01-27 14:57:57 +00:00
|
|
|
s.add_runtime_dependency('faraday', '~> 0.7.0')
|
2012-04-24 11:39:25 +00:00
|
|
|
s.add_runtime_dependency('multi_json', '>= 1.3.0')
|
2010-10-12 23:26:41 +00:00
|
|
|
s.add_runtime_dependency('extlib', '>= 0.9.15')
|
2012-05-24 12:42:21 +00:00
|
|
|
s.add_runtime_dependency('uuidtools', '>= 2.1.0')
|
2010-08-10 04:44:14 +00:00
|
|
|
|
2010-10-22 17:14:02 +00:00
|
|
|
# Dependencies used in the CLI
|
2011-11-16 12:21:22 +00:00
|
|
|
s.add_runtime_dependency('launchy', '>= 2.0.0')
|
2010-10-22 17:14:02 +00:00
|
|
|
|
|
|
|
# Dependencies used in the examples
|
2011-05-12 20:27:41 +00:00
|
|
|
s.add_development_dependency('sinatra', '>= 1.2.0')
|
2010-10-22 17:14:02 +00:00
|
|
|
|
2011-11-16 12:21:22 +00:00
|
|
|
s.add_development_dependency('rake', '>= 0.9.0')
|
2012-06-14 09:18:35 +00:00
|
|
|
s.add_development_dependency('rspec', '~> 2.10.0')
|
2010-07-28 19:30:56 +00:00
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
s.require_path = 'lib'
|
2010-07-28 19:30:56 +00:00
|
|
|
|
|
|
|
s.homepage = PKG_HOMEPAGE
|
|
|
|
end
|
|
|
|
|
2011-11-16 11:56:10 +00:00
|
|
|
Gem::PackageTask.new(GEM_SPEC) do |p|
|
2010-07-28 19:30:56 +00:00
|
|
|
p.gem_spec = GEM_SPEC
|
|
|
|
p.need_tar = true
|
|
|
|
p.need_zip = true
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Show information about the gem'
|
2010-07-28 19:30:56 +00:00
|
|
|
task :debug do
|
|
|
|
puts GEM_SPEC.to_ruby
|
|
|
|
end
|
|
|
|
|
2011-11-16 12:21:22 +00:00
|
|
|
desc "Generates .gemspec file"
|
|
|
|
task :gemspec do
|
|
|
|
spec_string = GEM_SPEC.to_ruby
|
|
|
|
|
|
|
|
begin
|
|
|
|
Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
|
|
|
|
rescue
|
|
|
|
abort "unsafe gemspec: #{$!}"
|
|
|
|
else
|
|
|
|
File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
|
|
|
|
file.write spec_string
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Install the gem'
|
|
|
|
task :install => ['clobber', 'gem:package'] do
|
2010-07-28 19:30:56 +00:00
|
|
|
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Uninstall the gem'
|
2010-07-28 19:30:56 +00:00
|
|
|
task :uninstall do
|
|
|
|
installed_list = Gem.source_index.find_name(PKG_NAME)
|
|
|
|
if installed_list &&
|
|
|
|
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
|
|
|
sh(
|
|
|
|
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
|
|
|
"--ignore-dependencies --executables #{PKG_NAME}"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Reinstall the gem'
|
2010-07-28 19:30:56 +00:00
|
|
|
task :reinstall => [:uninstall, :install]
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Alias to gem:package'
|
|
|
|
task 'gem' => 'gem:package'
|
2012-02-10 14:49:52 +00:00
|
|
|
|
|
|
|
task 'gem:release' => 'gem:gemspec'
|