rake-gemcutter 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/doc/README ADDED
@@ -0,0 +1,21 @@
1
+ == Rake::Gemcutter::Tasks
2
+ === Rake tasks for Gemcutter (and Rubygems in general)
3
+
4
+ In your Rakefile include the line
5
+
6
+ Rake::Gemcutter::Tasks(gemspec)
7
+
8
+ (Where gemspec contains a Gem::Specification object for your rubygem), and you'll get four tasks:
9
+
10
+ gem:install
11
+ gem:uninstall
12
+ gem:reinstall
13
+ gem:push
14
+
15
+ gem:install and friends install your gem locally - always handy when you want to take it for a spin before deploying, or jsut use it locally without doing a release-and-install cycle.
16
+
17
+ gem:push is roughly equivalent to typing 'gem push' at the command-line but with three benefits:
18
+
19
+ 0. You can add dependencies to the task (like that all your specs pass and that you've got a certain coverage threshold (check out spec/rake/verify_rcov in RSpec)) to save yourself some embarrassment.
20
+ 0. You can add the task as a dependency of others - let your whole PubSubHubBub know when you make a new release. Or that Twitter thing...
21
+ 0. There's a default dependency that checks to make sure that the gems you gem depend on are available before it pushes, so that you aren't pushing a gem that the world won't be able to use.
@@ -0,0 +1,7 @@
1
+
2
+ Rake::Gemcutter::Tasks
3
+ - should define gem:push
4
+
5
+ Finished in 0.003935 seconds
6
+
7
+ 1 example, 0 failures
@@ -0,0 +1,93 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'commands/abstract_command'
4
+
5
+ module Rake::Gemcutter
6
+ class GemcutterCommands < ::Gem::AbstractCommand
7
+ def initialize
8
+ end
9
+
10
+ def send_gem(gem_path)
11
+ puts "Pushing gem to Gemcutter..."
12
+
13
+ response = make_request(:post, "gems") do |request|
14
+ request.body = File.open(gem_path){|io| io.read }
15
+ request.add_field("Content-Length", request.body.size)
16
+ request.add_field("Content-Type", "application/octet-stream")
17
+ request.add_field("Authorization", api_key)
18
+ end
19
+
20
+ puts response.body
21
+ end
22
+ end
23
+
24
+ class Tasks < ::Rake::TaskLib
25
+ def initialize(gem_spec)
26
+ @gem_spec = gem_spec
27
+ setup_fields
28
+ yield self if block_given?
29
+ finalize_fields
30
+ define
31
+ end
32
+
33
+ def setup_fields
34
+ @gem_path = nil
35
+ @package_dir = "pkg"
36
+ end
37
+ attr_accessor :gem_path, :package_dir
38
+
39
+ def finalize_fields
40
+ if @gem_name.nil?
41
+ @gem_name = @gem_spec.full_name
42
+ end
43
+
44
+ if @gem_path.nil? and not @package_dir.nil?
45
+ @gem_path = File::join(@package_dir, @gem_spec.file_name)
46
+ end
47
+ end
48
+
49
+ def define
50
+ namespace :gem do
51
+ desc "Uninstall the gem"
52
+ task :uninstall do |t|
53
+ when_writing("Uninstalling #{@gem_name}") do
54
+ begin
55
+ puts "Uninstalling #{@gem_name}"
56
+ Gem::Uninstaller.new(@gem_name, {:executables => true, :ignore => true}).uninstall
57
+ rescue Exception
58
+ end
59
+ end
60
+ end
61
+
62
+ desc "Install the gem locally"
63
+ task :install => [@gem_path] do |t|
64
+ when_writing("Installing #{@gem_path}") do
65
+ puts "Installing #{@gem_path}"
66
+ system(*%w{sudo gem install} + [@gem_path] )
67
+ end
68
+ end
69
+
70
+ desc "Force a reinstall of the gem"
71
+ task :reinstall => [:uninstall, :install]
72
+
73
+ task :dependencies_available do
74
+ checker = Gem::SpecFetcher.new
75
+ @gem_spec.runtime_dependencies.each do |dep|
76
+ fulfilling = checker.fetch(dep,false,false,false)
77
+ if fulfilling.empty?
78
+ fail "Dependency #{dep} is unfulfilled remotely"
79
+ else
80
+ puts "Remotely fulfilled: #{dep}"
81
+ end
82
+ end
83
+ end
84
+
85
+ desc 'Push a gem up to Gemcutter'
86
+ task :push => [:dependencies_available] do
87
+ cmd = GemcutterCommands::new
88
+ cmd.send_gem(@gem_path)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-gemcutter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
10
+ platform: ruby
11
+ authors:
12
+ - Judson Lester
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-20 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 8
30
+ - 7
31
+ version: 0.8.7
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: gemcutter
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 2
44
+ - 1
45
+ version: 0.2.1
46
+ - - <
47
+ - !ruby/object:Gem::Version
48
+ segments:
49
+ - 0
50
+ - 5
51
+ - 0
52
+ version: 0.5.0
53
+ type: :runtime
54
+ version_requirements: *id002
55
+ description: " Tasks for gemcutter, including gemcutter-push\n"
56
+ email: judson@jacked.com
57
+ executables: []
58
+
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - doc/README
63
+ - doc/Specifications
64
+ files:
65
+ - lib/rake/gemcutter.rb
66
+ - doc/README
67
+ - doc/Specifications
68
+ has_rdoc: true
69
+ homepage: http://rake-gemcutter.rubyforge.org/
70
+ licenses: []
71
+
72
+ post_install_message: Another tidy package brought to you by Judson
73
+ rdoc_options:
74
+ - --inline-source
75
+ - --main
76
+ - doc/README
77
+ - --title
78
+ - rake-gemcutter-0.0.2 RDoc
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - <
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 1
94
+ - 3
95
+ - 6
96
+ version: 1.3.6
97
+ requirements: []
98
+
99
+ rubyforge_project: rake-gemcutter
100
+ rubygems_version: 1.3.6
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Rake tasks for gemcutter
104
+ test_files: []
105
+