Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add gem generating task and add MIT license.

  • Loading branch information...
commit 9a0a5b0c00f25a06c21464144730350a75e33e99 1 parent e449ab9
Marcel Molina authored
View
2  .gitignore
@@ -1,2 +1,4 @@
coverage
.rake_tasks
+.DS_Store
+pkg
View
18 COPYING
@@ -0,0 +1,18 @@
+# Copyright (c) 2009 Marcel Molina <marcel@twitter.com>, Twitter, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in the
+# Software without restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
+# Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
0  INSTALL
No changes.
View
68 Rakefile
@@ -1,6 +1,9 @@
require 'rubygems'
require 'rake'
require 'rake/testtask'
+require 'rake/gempackagetask'
+
+require File.dirname(__FILE__) + '/lib/twurl'
library_root = File.dirname(__FILE__)
@@ -24,4 +27,69 @@ namespace :test do
rm_r 'coverage' rescue nil
end
end
+end
+
+namespace :dist do
+ spec = Gem::Specification.new do |s|
+ s.name = 'twurl'
+ s.version = Gem::Version.new(Twurl::Version)
+ s.summary = "Curl for the Twitter API"
+ s.description = s.summary
+ s.email = 'marcel@twitter.com'
+ s.author = 'Marcel Molina'
+ s.has_rdoc = true
+ s.extra_rdoc_files = %w(README COPYING INSTALL)
+ s.homepage = 'http://twurl.rubyforge.org'
+ s.rubyforge_project = 'twurl'
+ s.files = FileList['Rakefile', 'lib/**/*.rb', 'bin/*']
+ s.executables << 'twurl'
+ s.test_files = Dir['test/**/*']
+
+ s.add_dependency 'oauth'
+ s.rdoc_options = ['--title', "twurl -- Curl for the Twitter API",
+ '--main', 'README',
+ '--line-numbers', '--inline-source']
+ end
+
+ Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_tar_gz = true
+ pkg.package_files.include('{lib,bin,test}/**/*')
+ pkg.package_files.include('README')
+ pkg.package_files.include('COPYING')
+ pkg.package_files.include('INSTALL')
+ pkg.package_files.include('Rakefile')
+ end
+
+ task :spec do
+ puts spec.to_ruby
+ end
+
+ package_name = lambda {|specification| File.join('pkg', "#{specification.name}-#{specification.version}")}
+
+ desc 'Push a release to rubyforge'
+ task :release => [:confirm_release, :clean, :add_release_marker_to_changelog, :package, :commit_changelog, :tag] do
+ require 'rubyforge'
+ package = package_name[spec]
+
+ rubyforge = RubyForge.new.configure
+ rubyforge.login
+
+ user_config = rubyforge.userconfig
+ user_config['release_changes'] = YAML.load_file('CHANGELOG')[spec.version.to_s].join("\n")
+
+ version_already_released = lambda do
+ releases = rubyforge.autoconfig['release_ids']
+ releases.has_key?(spec.name) && releases[spec.name][spec.version.to_s]
+ end
+
+ abort("Release #{spec.version} already exists!") if version_already_released.call
+
+ begin
+ rubyforge.add_release(spec.rubyforge_project, spec.name, spec.version.to_s, "#{package}.tar.gz", "#{package}.gem")
+ puts "Version #{spec.version} released!"
+ rescue Exception => exception
+ puts 'Release failed!'
+ raise
+ end
+ end
end
View
10 lib/twurl/version.rb
@@ -0,0 +1,10 @@
+module Twurl
+ module VERSION
+ MAJOR = '0'
+ MINOR = '5'
+ TINY = '0'
+ BETA = nil # Time.now.to_i.to_s
+ end
+
+ Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.