stickler 2.2.4 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/CONTRIBUTING.md +48 -0
  2. data/{HISTORY.asciidoc → HISTORY.md} +8 -2
  3. data/Manifest.txt +86 -0
  4. data/{README.asciidoc → README.rdoc} +18 -20
  5. data/Rakefile +25 -59
  6. data/bin/stickler +10 -3
  7. data/examples/gemcutter_repo.ru +1 -2
  8. data/lib/stickler.rb +6 -2
  9. data/lib/stickler/client.rb +5 -4
  10. data/lib/stickler/client/delete.rb +50 -0
  11. data/lib/stickler/client/unyank.rb +50 -0
  12. data/lib/stickler/middleware.rb +7 -0
  13. data/lib/stickler/middleware/compression.rb +0 -2
  14. data/lib/stickler/middleware/gemcutter.rb +16 -7
  15. data/lib/stickler/middleware/helpers.rb +1 -3
  16. data/lib/stickler/middleware/index.rb +0 -8
  17. data/lib/stickler/middleware/local.rb +1 -5
  18. data/lib/stickler/middleware/mirror.rb +0 -4
  19. data/lib/stickler/middleware/not_found.rb +0 -1
  20. data/lib/stickler/repository.rb +9 -5
  21. data/lib/stickler/repository/index.rb +0 -1
  22. data/lib/stickler/repository/local.rb +12 -4
  23. data/lib/stickler/repository/null.rb +0 -1
  24. data/lib/stickler/repository/remote.rb +40 -20
  25. data/lib/stickler/repository/remote_mirror.rb +1 -1
  26. data/lib/stickler/server.rb +1 -9
  27. data/lib/stickler/server/public/css/blueprint/ie.css +35 -0
  28. data/lib/stickler/server/public/css/blueprint/screen.css +266 -0
  29. data/lib/stickler/server/public/css/style.css +19 -0
  30. data/man/stickler-passenger-config.1 +83 -0
  31. data/man/stickler-passenger-config.1.ronn +70 -0
  32. data/man/stickler-server.1 +168 -0
  33. data/man/stickler-server.1.ronn +84 -0
  34. data/man/stickler.1 +321 -0
  35. data/man/stickler.1.ronn +144 -0
  36. data/spec/data/gemcutter/gems/foo-1.0.0.gem +0 -0
  37. data/spec/middleware/local_spec.rb +1 -4
  38. data/spec/middleware/not_found_spec.rb +1 -2
  39. data/spec/paths_spec.rb +1 -3
  40. data/spec/repository/api_behavior.rb +34 -4
  41. data/spec/repository/api_spec.rb +2 -3
  42. data/spec/repository/index_spec.rb +10 -11
  43. data/spec/repository/local_spec.rb +10 -12
  44. data/spec/repository/null_spec.rb +2 -5
  45. data/spec/repository/remote_spec.rb +3 -5
  46. data/spec/spec_helper.rb +7 -2
  47. data/spec/spec_lite_spec.rb +1 -3
  48. data/tasks/default.rake +274 -0
  49. data/tasks/this.rb +209 -0
  50. metadata +142 -85
  51. data/.bnsignore +0 -14
  52. data/.gitignore +0 -23
  53. data/TODO.asciidoc +0 -6
  54. data/lib/stickler/version.rb +0 -36
  55. data/man/asciidoc.conf +0 -25
  56. data/man/stickler-passenger-config.asciidoc +0 -74
  57. data/man/stickler-server.asciidoc +0 -87
  58. data/man/stickler.asciidoc +0 -150
  59. data/tasks/asciidoc.rake +0 -32
  60. data/tasks/bundler.rake +0 -13
  61. data/tasks/contribute.rake +0 -36
  62. data/tasks/man.rake +0 -19
@@ -0,0 +1,144 @@
1
+ STICKLER(1)
2
+ ===========
3
+
4
+ NAME
5
+ ----
6
+ stickler - command line program to interact with a stickler-server
7
+
8
+
9
+ SYNOPSIS
10
+ --------
11
+ *stickler* [--help] [COMMAND] [COMMAND_OPTIONS] [gemfile(s)]
12
+
13
+
14
+ DESCRIPTION
15
+ -----------
16
+ Stickler is a tool to organize and maintain an internal gem repository of
17
+ proprietary gems and/or a mirror of third party gems.
18
+
19
+ The stickler(1) command interacts with an instance of
20
+ stickler-server(1) to control the publishing and mirroring of ruby
21
+ gems.
22
+
23
+
24
+ COMMANDS
25
+ --------
26
+ *push*:
27
+ Push one or more gems to a gemserver. This works the same as `gem push`
28
+ although there is no authorization mechanism.
29
+
30
+ *yank*:
31
+ Remove a gem from the gemserver's index. It will still be available from
32
+ direct download. This works the same as `gem yank`.
33
+
34
+ *mirror*:
35
+ Pull a specific version of a gem from an upstream gem server and
36
+ store it in a stickler-server(1).
37
+
38
+ *config*:
39
+ Access or update the stickler client configuration.
40
+
41
+ *list*:
42
+ List all the gems in the remote repository.
43
+
44
+ *unyank*:
45
+ Put a gem that was _yanked_ back into the gemserver index. This reverses a
46
+ `yank`.
47
+
48
+ OPTIONS
49
+ -------
50
+ These are the options for all commands. Not all options apply to all commands.
51
+
52
+ *-a, --add*:
53
+ Add the `--server` or `--upstream` items to the config file when using the
54
+ `config` command.
55
+
56
+ *-d, --debug*:
57
+ Output debug information
58
+
59
+ *-g, --gem-version*='VERSION':
60
+ The version of the gem to yank from `--server` or to mirror from
61
+ `--upstream`.
62
+
63
+ *-h, --help*:
64
+ Show the help message
65
+
66
+ *-l, --list*:
67
+ Display the current configuration when using the `config` command.
68
+
69
+ *-p, --platform*='PLATFORM':
70
+ The platform of the gem to yank from `--server` or to mirror from
71
+ `--upstream` (e.g. ruby, java, mswin32)
72
+
73
+ *-s, --server*='SERVER':
74
+ The gem server or stickler-server(1) URL. This is used by all the commands.
75
+
76
+ *-u, --upstream*='SERVER':
77
+ The upstream server from which to mirror a gem when using the `mirror`
78
+ command.
79
+
80
+ *-v, --version*:
81
+ Output the version.
82
+
83
+
84
+ CONFIGURATION
85
+ -------------
86
+ Stickler uses the `.gem/stickler` file to hold its configuration. It is a yaml
87
+ file and Currently there are two options. These are altered using the `stickler
88
+ config` command.
89
+
90
+ *upstream*: The default upstream server from which to mirror gems.
91
+ *server*: The default linkstick:stickler-server[1] to interact with.
92
+
93
+ An example config file
94
+
95
+ ---
96
+ :server: http://stickler.example.com
97
+ :upstream: https://rubygems.org
98
+
99
+
100
+ EXAMPLES
101
+ --------
102
+ Push the local `my_gem-1.0.0.gem` file to the stickler-server(1) at
103
+ *stickler.example.com*
104
+
105
+ stickler push ./my_gem-1.0.0.gem --server http://stickler.example.com/
106
+
107
+ Push all the gems in the `pkg` directory to the stickler-server(1) at
108
+ *stickler.example.com*
109
+
110
+ stickler push --server http://stickler.example.com/ ./pkg/*.gem
111
+
112
+ Yank vesion 1.0.0 of my_gem from the gem index on sticker.example.com
113
+
114
+ stickler yank my_gem --version 1.0.0 --server http://stickler.example.com/
115
+
116
+ Take the +third_party+ gem, version +1.4.2+ that is on *rubygems.org* and mirror
117
+ it on *stickler.example.com*
118
+
119
+ stickler mirror third_party_gem --gem-version 0.4.2 --upstream http://rubygems.org/ --server http://stickler.example.com/
120
+ stickler mirror --help
121
+
122
+ Set the `server` and `upstream` configration values in the `.gem/stickler` file.
123
+
124
+ stickler config --add --server http://stickler.example.com --upstream http://rubygems.org/
125
+
126
+
127
+ SEE ALSO
128
+ --------
129
+ stickler-server(1), stickler-passenger-config(1)
130
+
131
+
132
+ AUTHOR
133
+ ------
134
+ Written by Jeremy Hinegardner <jeremy@copiousfreetime.org>
135
+
136
+
137
+ RESOURCES
138
+ ---------
139
+ [GitHub project](https://www.github.com/copiousfreetime/stickler)
140
+
141
+
142
+ BUGS
143
+ ----
144
+ Please report bugs to the [github issue tracker](https://github.com/copiousfreetime/stickler/issues)
@@ -1,7 +1,4 @@
1
- require File.expand_path( "../spec_helper",File.dirname(__FILE__) )
2
-
3
- require 'stickler/middleware/local'
4
- require 'stickler/middleware/compression'
1
+ require 'spec_helper'
5
2
 
6
3
  describe Stickler::Middleware::Local do
7
4
 
@@ -1,5 +1,4 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require 'stickler/middleware/not_found'
1
+ require 'spec_helper'
3
2
 
4
3
  describe ::Stickler::Middleware::NotFound do
5
4
  include Rack::Test::Methods
@@ -1,6 +1,4 @@
1
- require File.expand_path( File.join( File.dirname( __FILE__ ), "spec_helper.rb" ) )
2
-
3
- require 'stickler/paths'
1
+ require 'spec_helper'
4
2
 
5
3
  describe Stickler::Paths do
6
4
  it "can access the root dir of the project" do
@@ -1,5 +1,3 @@
1
- require 'stickler/repository/api'
2
-
3
1
  shared_examples_for "includes Repository::Api" do
4
2
  describe "responds to all the api methods" do
5
3
  Stickler::Repository::Api.api_methods.each do |method|
@@ -62,8 +60,8 @@ shared_examples_for "implements Repository::Api" do
62
60
  it "deletes a gem from the repo" do
63
61
  @repo.search_for( @foo_spec ).should be_empty
64
62
  @repo.push( @foo_gem_local_path )
65
- @repo.search_for( @foo_spec ).size.should == 1
66
- @repo.delete( @foo_spec ).should == true
63
+ @repo.search_for( @foo_spec ).size.should eq 1
64
+ @repo.delete( @foo_spec ).should eq true
67
65
  @repo.search_for( @foo_spec ).should be_empty
68
66
  end
69
67
 
@@ -104,6 +102,38 @@ shared_examples_for "implements Repository::Api" do
104
102
 
105
103
  end
106
104
 
105
+ describe "#unyank" do
106
+ before( :each ) do
107
+ @repo.search_for( @foo_spec ).should be_empty
108
+ @repo.push( @foo_gem_local_path )
109
+ end
110
+
111
+ it "returns nil if the gem to unyank does not exist" do
112
+ non_existing_gem = @missing_spec
113
+ @repo.unyank( non_existing_gem ).should be_nil
114
+ end
115
+
116
+ #Do we even care about this?
117
+ xit "returns nil if the gem to unyank has not been yanked" do
118
+ @repo.unyank( @foo_spec ).should be_nil
119
+ end
120
+
121
+ context " when file has been yanked" do
122
+ before :each do
123
+ @repo.yank( @foo_spec )
124
+ end
125
+
126
+ it "return true if the gem is successfully unyanked" do
127
+ @repo.unyank( @foo_spec ).should be_true
128
+ end
129
+
130
+ it "finds the gem in a search" do
131
+ @repo.unyank( @foo_spec )
132
+ @repo.search_for( @foo_spec ).should_not be_empty
133
+ end
134
+ end
135
+ end
136
+
107
137
  describe "#search_for" do
108
138
  it "returns specs for items that are found" do
109
139
  @repo.push( @foo_gem_local_path )
@@ -1,7 +1,6 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require File.expand_path( File.join( File.dirname(__FILE__), "api_behavior.rb" ) )
1
+ require 'spec_helper'
2
+ require 'repository/api_behavior'
3
3
 
4
- require 'stickler/repository/api'
5
4
  module Stickler::Repository
6
5
  class Stub
7
6
  include Stickler::Repository::Api
@@ -1,5 +1,4 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require 'stickler/repository/index'
1
+ require 'spec_helper'
3
2
 
4
3
  describe ::Stickler::Repository::Index do
5
4
 
@@ -20,28 +19,28 @@ describe ::Stickler::Repository::Index do
20
19
  end
21
20
 
22
21
  it "indexes all the .gemspec files in the directory" do
23
- @index.specs.size.should == @specifications.size
22
+ @index.specs.size.should eq @specifications.size
24
23
  end
25
24
 
26
25
  it "is able to notice changes in the index" do
27
- @index.specs.size.should == @specifications.size
26
+ @index.specs.size.should eq @specifications.size
28
27
  FileUtils.rm( File.join( @index_me, "foo-1.0.0.gemspec" ) )
29
- @index.specs.size.should == ( @specifications.size - 1 )
28
+ @index.specs.size.should eq( @specifications.size - 1 )
30
29
  end
31
30
 
32
31
  it "knows just the latest specs" do
33
- @index.latest_specs.size.should == (@specifications.size - 1)
34
- @index.latest_specs.collect { |s| s.full_name }.sort.should == %w[ bar-1.0.0 baz-3.1.4 baz-3.1.4-java foo-1.0.0 ]
32
+ @index.latest_specs.size.should eq(@specifications.size - 1)
33
+ @index.latest_specs.collect { |s| s.full_name }.sort.should eq(%w[ bar-1.0.0 baz-3.1.4 baz-3.1.4-java foo-1.0.0 ])
35
34
  end
36
35
 
37
36
  it "knows the pre-release specs" do
38
- @index.prerelease_specs.size.should == 1
39
- @index.prerelease_specs.first.full_name.should == "foo-2.0.0a"
37
+ @index.prerelease_specs.size.should eq 1
38
+ @index.prerelease_specs.first.full_name.should eq "foo-2.0.0a"
40
39
  end
41
40
 
42
41
  it "knows the released specs" do
43
- @index.released_specs.size.should == 4
44
- @index.released_specs.collect { |s| s.full_name }.sort.should == %w[ bar-1.0.0 baz-3.1.4 baz-3.1.4-java foo-1.0.0 ]
42
+ @index.released_specs.size.should eq 4
43
+ @index.released_specs.collect { |s| s.full_name }.sort.should eq(%w[ bar-1.0.0 baz-3.1.4 baz-3.1.4-java foo-1.0.0 ])
45
44
  end
46
45
  end
47
46
 
@@ -1,7 +1,5 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require File.expand_path( File.join( File.dirname(__FILE__), "api_behavior.rb" ) )
3
-
4
- require 'stickler/repository/local'
1
+ require 'spec_helper'
2
+ require 'repository/api_behavior'
5
3
 
6
4
  describe ::Stickler::Repository::Local do
7
5
 
@@ -19,8 +17,8 @@ describe ::Stickler::Repository::Local do
19
17
  %w[ gems specifications ].each do |sub_dir|
20
18
  it "creates #{sub_dir} directory" do
21
19
  new_dir = File.join( @repo_dir , sub_dir ) + File::SEPARATOR
22
- File.directory?( new_dir ).should == true
23
- @repo.send( "#{sub_dir}_dir" ).should == new_dir
20
+ File.directory?( new_dir ).should eq true
21
+ @repo.send( "#{sub_dir}_dir" ).should eq new_dir
24
22
  end
25
23
 
26
24
  end
@@ -29,20 +27,20 @@ describe ::Stickler::Repository::Local do
29
27
  Dir.glob( File.join( @gems_dir, "*.gem" ) ).each do |gem|
30
28
  @repo.push( gem )
31
29
  end
32
- @repo.specs.size.should == 5
30
+ @repo.specs.size.should eq 5
33
31
  end
34
32
 
35
33
  it "two instances with the same repo dir are the same object" do
36
34
  repo2 = ::Stickler::Repository::Local.new( File.join(@repos_dir, '1') )
37
- repo2.object_id.should == @repo.object_id
38
- ::Stickler::Repository::Local.repos.size.should == 1
35
+ repo2.object_id.should eq @repo.object_id
36
+ ::Stickler::Repository::Local.repos.size.should eq 1
39
37
  end
40
38
 
41
39
 
42
40
  it "keeps track of all the repository instances" do
43
- repo2 = ::Stickler::Repository::Local.new( File.join(@repos_dir, "2" ) )
44
- repo3 = ::Stickler::Repository::Local.new( File.join(@repos_dir, "3" ) )
45
- ::Stickler::Repository::Local.repos.size.should == 3
41
+ ::Stickler::Repository::Local.new( File.join(@repos_dir, "2" ) )
42
+ ::Stickler::Repository::Local.new( File.join(@repos_dir, "3" ) )
43
+ ::Stickler::Repository::Local.repos.size.should eq 3
46
44
  end
47
45
 
48
46
  it_should_behave_like 'includes Repository::Api'
@@ -1,8 +1,5 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require File.expand_path( File.join( File.dirname(__FILE__), "api_behavior.rb" ) )
3
-
4
- require 'stickler/repository/null'
5
-
1
+ require 'spec_helper'
2
+ require 'repository/api_behavior'
6
3
  describe ::Stickler::Repository::Null do
7
4
 
8
5
  before do
@@ -1,7 +1,5 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "..", "spec_helper.rb" ) )
2
- require File.expand_path( File.join( File.dirname(__FILE__), "api_behavior.rb" ) )
3
-
4
- require 'stickler/repository/remote'
1
+ require 'spec_helper'
2
+ require 'repository/api_behavior'
5
3
 
6
4
  class SticklerTestServer
7
5
  def initialize( spec_dir, ru_file )
@@ -23,7 +21,7 @@ class SticklerTestServer
23
21
  Excon.get( @repo_uri + "specs.#{Gem.marshal_version}.gz" )
24
22
  #puts "rackup started with pid #{IO.read( @pid_file )}"
25
23
  break
26
- rescue => e
24
+ rescue
27
25
  tries += 1
28
26
  sleep tries * 0.1
29
27
  end
@@ -1,7 +1,12 @@
1
- require 'rspec'
1
+ if RUBY_VERSION >= '1.9.2' then
2
+ require 'simplecov'
3
+ SimpleCov.start if ENV['COVERAGE']
4
+ end
5
+
6
+ require "rspec/autorun"
7
+ require 'stickler'
2
8
  require 'index_spec_helpers'
3
9
 
4
- require 'stickler/repository/local'
5
10
 
6
11
  RSpec.configure do |config|
7
12
 
@@ -1,6 +1,4 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), "spec_helper.rb" ) )
2
-
3
- require 'stickler/spec_lite'
1
+ require 'spec_helper'
4
2
 
5
3
  describe Stickler::SpecLite do
6
4
  before do
@@ -0,0 +1,274 @@
1
+ # vim: syntax=ruby
2
+ require 'rake/clean'
3
+ #------------------------------------------------------------------------------
4
+ # If you want to Develop on this project just run 'rake develop' and you'll
5
+ # have all you need to get going. If you want to use bundler for development,
6
+ # then run 'rake develop:using_bundler'
7
+ #------------------------------------------------------------------------------
8
+ namespace :develop do
9
+
10
+ # Install all the development and runtime dependencies of this gem using the
11
+ # gemspec.
12
+ task :default do
13
+ require 'rubygems/dependency_installer'
14
+ installer = Gem::DependencyInstaller.new
15
+
16
+ This.set_coverage_gem
17
+
18
+ puts "Installing gem depedencies needed for development"
19
+ This.platform_gemspec.dependencies.each do |dep|
20
+ if dep.matching_specs.empty? then
21
+ puts "Installing : #{dep}"
22
+ installer.install dep
23
+ else
24
+ puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
25
+ end
26
+ end
27
+ puts "\n\nNow run 'rake test'"
28
+ end
29
+
30
+ # Create a Gemfile that just references the gemspec
31
+ file 'Gemfile' => :gemspec do
32
+ File.open( "Gemfile", "w+" ) do |f|
33
+ f.puts 'source :rubygems'
34
+ f.puts 'gemspec'
35
+ end
36
+ end
37
+
38
+ desc "Create a bundler Gemfile"
39
+ task :using_bundler => 'Gemfile' do
40
+ puts "Now you can 'bundle'"
41
+ end
42
+
43
+ # Gemfiles are build artifacts
44
+ CLOBBER << FileList['Gemfile*']
45
+ end
46
+ desc "Boostrap development"
47
+ task :develop => "develop:default"
48
+
49
+ #------------------------------------------------------------------------------
50
+ # Minitest - standard TestTask
51
+ #------------------------------------------------------------------------------
52
+ begin
53
+ require 'rspec/core/rake_task'
54
+ RSpec::Core::RakeTask.new( :test ) do |t|
55
+ t.ruby_opts = %w[ -w ]
56
+ t.rspec_opts = %w[ --color --format documentation ]
57
+ end
58
+ task :default => :test
59
+ task :test_requirements
60
+ task :test => :test_requirements
61
+ rescue LoadError
62
+ This.task_warning( 'test' )
63
+ end
64
+
65
+ #------------------------------------------------------------------------------
66
+ # RDoc - standard rdoc rake task, although we must make sure to use a more
67
+ # recent version of rdoc since it is the one that has 'tomdoc' markup
68
+ #------------------------------------------------------------------------------
69
+ begin
70
+ gem 'rdoc' # otherwise we get the wrong task from stdlib
71
+ require 'rdoc/task'
72
+ RDoc::Task.new do |t|
73
+ t.markup = 'tomdoc'
74
+ t.rdoc_dir = 'doc'
75
+ t.main = 'README.rdoc'
76
+ t.title = "#{This.name} #{This.version}"
77
+ t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
78
+ end
79
+ rescue LoadError => le
80
+ This.task_warning( 'rdoc' )
81
+ end
82
+
83
+ #------------------------------------------------------------------------------
84
+ # Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
85
+ # for the moment only rcov is listed.
86
+ #------------------------------------------------------------------------------
87
+ if RUBY_VERSION < "1.9.0"
88
+ begin
89
+ require 'rcov/rcovtask'
90
+ Rcov::RcovTask.new( 'coverage' ) do |t|
91
+ t.libs << 'spec'
92
+ t.pattern = 'spec/**/*_spec.rb'
93
+ t.verbose = true
94
+ t.rcov_opts << "-x ^/" # remove all the global files
95
+ t.rcov_opts << "--sort coverage" # so we see the worst files at the top
96
+ end
97
+ rescue LoadError
98
+ This.task_warning( 'rcov' )
99
+ end
100
+ else
101
+ begin
102
+ require 'simplecov'
103
+ desc 'Run tests with code coverage'
104
+ task :coverage do
105
+ ENV['COVERAGE'] = 'true'
106
+ Rake::Task[:test].execute
107
+ end
108
+ CLOBBER << FileList["coverage"]
109
+ rescue LoadError
110
+ This.task_warning( 'simplecov' )
111
+ end
112
+ end
113
+
114
+ #------------------------------------------------------------------------------
115
+ # Manifest - We want an explicit list of thos files that are to be packaged in
116
+ # the gem. Most of this is from Hoe.
117
+ #------------------------------------------------------------------------------
118
+ namespace 'manifest' do
119
+ desc "Check the manifest"
120
+ task :check => :clean do
121
+ files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
122
+ files = files.select{ |f| File.file?( f ) }
123
+
124
+ tmp = "Manifest.tmp"
125
+ File.open( tmp, 'w' ) do |f|
126
+ f.puts files.join("\n")
127
+ end
128
+
129
+ begin
130
+ sh "diff -du Manifest.txt #{tmp}"
131
+ ensure
132
+ rm tmp
133
+ end
134
+ puts "Manifest looks good"
135
+ end
136
+
137
+ desc "Generate the manifest"
138
+ task :generate => :clean do
139
+ files = %x[ git ls-files ].split("\n").sort
140
+ files.reject! { |f| f =~ This.exclude_from_manifest }
141
+ File.open( "Manifest.txt", "w" ) do |f|
142
+ f.puts files.join("\n")
143
+ end
144
+ end
145
+ end
146
+
147
+ #------------------------------------------------------------------------------
148
+ # Fixme - look for fixmes and report them
149
+ #------------------------------------------------------------------------------
150
+ namespace :fixme do
151
+ task :default => 'manifest:check' do
152
+ This.manifest.each do |file|
153
+ next if file == __FILE__
154
+ next unless file =~ %r/(txt|rb|md|rdoc|css|html|xml|css)\Z/
155
+ puts "FIXME: Rename #{file}" if file =~ /fixme/i
156
+ IO.readlines( file ).each_with_index do |line, idx|
157
+ prefix = "FIXME: #{file}:#{idx+1}".ljust(42)
158
+ puts "#{prefix} => #{line.strip}" if line =~ /fixme/i
159
+ end
160
+ end
161
+ end
162
+
163
+ def fixme_project_root
164
+ This.project_path( '../fixme' )
165
+ end
166
+
167
+ def fixme_project_path( subtree )
168
+ fixme_project_root.join( subtree )
169
+ end
170
+
171
+ def local_fixme_files
172
+ This.manifest.select { |p| p =~ %r|^tasks/| }
173
+ end
174
+
175
+ def outdated_fixme_files
176
+ local_fixme_files.reject do |local|
177
+ upstream = fixme_project_path( local )
178
+ Digest::SHA256.file( local ) == Digest::SHA256.file( upstream )
179
+ end
180
+ end
181
+
182
+ def fixme_up_to_date?
183
+ outdated_fixme_files.empty?
184
+ end
185
+
186
+ desc "See if the fixme tools are outdated"
187
+ task :outdated => :release_check do
188
+ if fixme_up_to_date? then
189
+ puts "Fixme files are up to date."
190
+ else
191
+ outdated_fixme_files.each do |f|
192
+ puts "#{f} is outdated"
193
+ end
194
+ end
195
+ end
196
+
197
+ desc "Update outdated fixme files"
198
+ task :update => :release_check do
199
+ if fixme_up_to_date? then
200
+ puts "Fixme files are already up to date."
201
+ else
202
+ puts "Updating fixme files:"
203
+ outdated_fixme_files.each do |local|
204
+ upstream = fixme_project_path( local )
205
+ puts " * #{local}"
206
+ FileUtils.cp( upstream, local )
207
+ end
208
+ puts "Use your git commands as appropriate."
209
+ end
210
+ end
211
+ end
212
+ desc "Look for fixmes and report them"
213
+ task :fixme => "fixme:default"
214
+
215
+ #------------------------------------------------------------------------------
216
+ # Gem Specification
217
+ #------------------------------------------------------------------------------
218
+ # Really this is only here to support those who use bundler
219
+ desc "Build the #{This.name}.gemspec file"
220
+ task :gemspec do
221
+ File.open( This.gemspec_file, "wb+" ) do |f|
222
+ f.write This.platform_gemspec.to_ruby
223
+ end
224
+ end
225
+
226
+ # the gemspec is also a dev artifact and should not be kept around.
227
+ CLOBBER << This.gemspec_file.to_s
228
+
229
+ # The standard gem packaging task, everyone has it.
230
+ require 'rubygems/package_task'
231
+ Gem::PackageTask.new( This.platform_gemspec ) do
232
+ # nothing
233
+ end
234
+
235
+
236
+ #------------------------------------------------------------------------------
237
+ # man pages
238
+ #------------------------------------------------------------------------------
239
+ desc "Create the man pages"
240
+ task :man do
241
+ sh "ronn --roff #{FileList["man/*.ronn"]}"
242
+ end
243
+
244
+ #------------------------------------------------------------------------------
245
+ # Release - the steps we go through to do a final release, this is pulled from
246
+ # a compbination of mojombo's rakegem, hoe and hoe-git
247
+ #
248
+ # 1) make sure we are on the master branch
249
+ # 2) make sure there are no uncommitted items
250
+ # 3) check the manifest and make sure all looks good
251
+ # 4) build the gem
252
+ # 5) do an empty commit to have the commit message of the version
253
+ # 6) tag that commit as the version
254
+ # 7) push master
255
+ # 8) push the tag
256
+ # 7) pus the gem
257
+ #------------------------------------------------------------------------------
258
+ task :release_check do
259
+ unless `git branch` =~ /^\* master$/
260
+ abort "You must be on the master branch to release!"
261
+ end
262
+ unless `git status` =~ /^nothing to commit/m
263
+ abort "Nope, sorry, you have unfinished business"
264
+ end
265
+ end
266
+
267
+ desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_name} to rubygems.org"
268
+ task :release => [ :release_check, 'manifest:check', :gem ] do
269
+ sh "git commit --allow-empty -a -m 'Release #{This.version}'"
270
+ sh "git tag -a -m 'v#{This.version}' v#{This.version}"
271
+ sh "git push origin master"
272
+ sh "git push origin v#{This.version}"
273
+ sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
274
+ end