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
|
2013-05-13 21:03:49 +00:00
|
|
|
s.add_runtime_dependency('signet', '>= 0.5.0')
|
2012-07-31 13:56:17 +00:00
|
|
|
s.add_runtime_dependency('addressable', '>= 2.3.2')
|
|
|
|
s.add_runtime_dependency('uuidtools', '>= 2.1.0')
|
2013-03-26 04:32:16 +00:00
|
|
|
s.add_runtime_dependency('autoparse', '>= 0.3.3')
|
2013-05-13 21:03:49 +00:00
|
|
|
s.add_runtime_dependency('faraday', '>= 0.9.0.rc1')
|
2012-07-21 10:50:48 +00:00
|
|
|
s.add_runtime_dependency('multi_json', '>= 1.0.0')
|
2010-10-12 23:26:41 +00:00
|
|
|
s.add_runtime_dependency('extlib', '>= 0.9.15')
|
2012-10-25 22:05:34 +00:00
|
|
|
s.add_runtime_dependency('jwt', '>= 0.1.5')
|
2010-08-10 04:44:14 +00:00
|
|
|
|
2010-10-22 17:14:02 +00:00
|
|
|
# Dependencies used in the CLI
|
2012-07-31 13:56:17 +00:00
|
|
|
s.add_runtime_dependency('launchy', '>= 2.1.1')
|
2010-10-22 17:14:02 +00:00
|
|
|
|
|
|
|
# Dependencies used in the examples
|
2011-11-16 12:21:22 +00:00
|
|
|
s.add_development_dependency('rake', '>= 0.9.0')
|
2012-07-21 10:50:48 +00:00
|
|
|
s.add_development_dependency('rspec', '>= 2.11.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'
|