stickler 2.0.0a → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/.bnsignore +14 -0
  2. data/.gitignore +17 -0
  3. data/HISTORY.asciidoc +20 -0
  4. data/README.asciidoc +126 -0
  5. data/Rakefile +22 -3
  6. data/bin/stickler +50 -0
  7. data/bin/stickler-passenger-config +112 -0
  8. data/bin/stickler-server +109 -0
  9. data/examples/config.ru +6 -3
  10. data/examples/gemcutter_repo.ru +2 -0
  11. data/examples/index_repo.ru +2 -0
  12. data/examples/local_repo.ru +6 -3
  13. data/examples/mirror_repo.ru +2 -0
  14. data/examples/not_found.ru +2 -0
  15. data/lib/stickler.rb +12 -0
  16. data/lib/stickler/client.rb +47 -0
  17. data/lib/stickler/client/config.rb +35 -0
  18. data/lib/stickler/client/config_file.rb +58 -0
  19. data/lib/stickler/client/mirror.rb +61 -0
  20. data/lib/stickler/client/push.rb +50 -0
  21. data/lib/stickler/client/yank.rb +51 -0
  22. data/lib/stickler/logable.rb +35 -0
  23. data/lib/stickler/middleware/gemcutter.rb +5 -0
  24. data/lib/stickler/middleware/helpers.rb +32 -0
  25. data/lib/stickler/middleware/index.rb +30 -4
  26. data/lib/stickler/middleware/mirror.rb +8 -3
  27. data/lib/stickler/middleware/not_found.rb +4 -2
  28. data/lib/stickler/paths.rb +53 -0
  29. data/lib/stickler/repository/local.rb +12 -12
  30. data/lib/stickler/repository/mirror.rb +13 -6
  31. data/lib/stickler/repository/null.rb +1 -0
  32. data/lib/stickler/repository/remote.rb +10 -4
  33. data/lib/stickler/repository/rubygems_authenticator.rb +32 -0
  34. data/lib/stickler/server.rb +34 -0
  35. data/lib/stickler/server/public/css/blueprint/LICENSE +22 -0
  36. data/lib/stickler/server/public/css/blueprint/ie.css +35 -0
  37. data/lib/stickler/server/public/css/blueprint/screen.css +266 -0
  38. data/lib/stickler/server/public/css/style.css +19 -0
  39. data/lib/stickler/server/public/images/apple-touch-icon.png +0 -0
  40. data/lib/stickler/server/public/images/favicon.ico +0 -0
  41. data/lib/stickler/server/public/js/modernizr-1.5.min.js +28 -0
  42. data/lib/stickler/server/views/index.erb +35 -0
  43. data/lib/stickler/server/views/layout.erb +42 -0
  44. data/lib/stickler/spec_lite.rb +16 -6
  45. data/lib/stickler/version.rb +1 -1
  46. data/man/asciidoc.conf +25 -0
  47. data/man/stickler-passenger-config.asciidoc +74 -0
  48. data/man/stickler-server.asciidoc +87 -0
  49. data/man/stickler.asciidoc +148 -0
  50. data/spec/middleware/common_gem_server_helpers.rb +4 -2
  51. data/spec/middleware/index_spec.rb +3 -3
  52. data/spec/middleware/legacy_gem_server_behavior.rb +0 -2
  53. data/spec/middleware/local_spec.rb +3 -3
  54. data/spec/middleware/modern_gem_server_behavior.rb +2 -0
  55. data/spec/paths_spec.rb +13 -0
  56. data/spec/spec_lite_spec.rb +14 -0
  57. data/tasks/man.rake +19 -0
  58. metadata +183 -56
  59. data/HISTORY.rdoc +0 -12
  60. data/README.rdoc +0 -88
  61. data/lib/stickler/web.rb +0 -19
  62. data/stickler.gemspec +0 -60
  63. data/views/index.erb +0 -19
  64. data/views/layout.erb +0 -39
@@ -0,0 +1,25 @@
1
+ ## linkstick: macro
2
+ #
3
+ # Usage: linkstick:command[manpage-section]
4
+ #
5
+ # Modelled after the linkgit macro
6
+ #
7
+ # {0} is the manpage section, {target} is the command
8
+ #
9
+ ##
10
+
11
+ [macros]
12
+ (?su)[\\]?(?P<name>linkstick):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
13
+
14
+ ifdef::backend-docbook[]
15
+ [linkstick-inlinemacro]
16
+ {0%{target}}
17
+ {0#<citerefentry>}
18
+ {0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
19
+ {0#</citerefentry>}
20
+ endif::backend-docbook[]
21
+
22
+ ifdef::backend-xhtml11[]
23
+ [linkstick-inlinemacro]
24
+ <strong><a href="{target}.html">{target}{0?({0})}</a></strong>
25
+ endif::backend-xhtml11[]
@@ -0,0 +1,74 @@
1
+ STICKLER-PASSENGER-CONFIG(1)
2
+ ============================
3
+
4
+ NAME
5
+ ----
6
+ stickler-passenger-config - output a Phusion Passenger config for stickler
7
+
8
+
9
+ SYNOPSIS
10
+ --------
11
+ *stickler-passenger-config* ['--help'] ['COMMAND'] ['COMMAND_OPTIONS'] /path/to/stickler/root
12
+
13
+
14
+ DESCRIPTION
15
+ -----------
16
+ *stickler-passenger-config* will create a stickler web application directory,
17
+ including the config.ru file for use with link:http://modrails.com/[Phusion
18
+ Passenger]. It will then output the stanza to be incorporated into an
19
+ link:http://httpd.apache.org/[Apache] or link:http://nginx.net[Nginx]
20
+ configuration.
21
+
22
+
23
+ COMMANDS
24
+ --------
25
+ [horizontal]
26
+ *apache2*:: Output an Apache config.
27
+
28
+ *nginx*:: Output an Nginx config.
29
+
30
+
31
+ OPTIONS
32
+ -------
33
+ *-h, --help*::
34
+ Show the help message
35
+
36
+ *-v, --version*::
37
+ Output the version.
38
+
39
+
40
+ EXAMPLES
41
+ --------
42
+ Output a passenger config for use with apache.
43
+
44
+ ---------------------------------------------------
45
+ stickler-passenger-config apache2 /var/lib/stickler
46
+ ---------------------------------------------------
47
+
48
+
49
+ Output a pasenger a config to be integrated with an nginx config.
50
+ -------------------------------------------------
51
+ stickler-passenger-config nginx /var/lib/stickler
52
+ -------------------------------------------------
53
+
54
+
55
+ SEE ALSO
56
+ --------
57
+ linkstick:stickler[1], linkstick:stickler-server[1]
58
+
59
+
60
+ AUTHOR
61
+ ------
62
+ Written by Jeremy Hinegardner <jeremy@hinegardner.org>
63
+
64
+
65
+ RESOURCES
66
+ ---------
67
+ GitHub project: http://www.github.com/copiousfreetime/stickler
68
+
69
+
70
+ BUGS
71
+ ----
72
+ Please report bugs to the github issue tracker
73
+ http://github.com/copiousfreetime/stickler/issues
74
+
@@ -0,0 +1,87 @@
1
+ STICKLER-SERVER(1)
2
+ ==================
3
+
4
+ NAME
5
+ ----
6
+ stickler-server - start and stop the stickler server process
7
+
8
+
9
+ SYNOPSIS
10
+ --------
11
+ *stickler-server* ['--help'] ['COMMAND'] ['COMMAND_OPTIONS'] /path/to/stickler/root
12
+
13
+
14
+ DESCRIPTION
15
+ -----------
16
+ stickler-server is the daemon process that houses the repositories of
17
+ proprietary gems and/or mirrors of third party gems.
18
+
19
+
20
+ COMMANDS
21
+ --------
22
+ [horizontal]
23
+ *start*:: Start the stickler server process
24
+
25
+ *stop*:: Stop the stickler server process
26
+
27
+
28
+ OPTIONS
29
+ -------
30
+ *-d, --daemonize*::
31
+ Daemonize the server
32
+
33
+ *--help*::
34
+ Show the help message
35
+
36
+ *-h, --host*='HOST'::
37
+ The host address to bind to (default: 0.0.0.0)
38
+
39
+ *-o, --port*='PORT'::
40
+ The port to bind to (default: 6789)
41
+
42
+ *-p, --pid*='PID_FILE'::
43
+ Path to wriate a pid file to after daemonizing
44
+
45
+ *-s, --server*='SERVER'::
46
+ The rack handler to use: thin, mongrel, webrick, etc.
47
+
48
+ *-v, --version*::
49
+ Output the version.
50
+
51
+
52
+ EXAMPLES
53
+ --------
54
+ Start the server, daemonized, using /var/lib/stickler as the root directory of
55
+ all the repositories.
56
+
57
+ ---------------------------------------------------
58
+ stickler-server start --daemonize /var/lib/stickler
59
+ ---------------------------------------------------
60
+
61
+ Stop the server that is using /var/lib/stickler as its root directory.
62
+
63
+ --------------------------------------
64
+ stickler-server stop /var/lib/stickler
65
+ --------------------------------------
66
+
67
+
68
+ SEE ALSO
69
+ --------
70
+ linkstick:stickler[1], linkstick:stickler-passenger-config[1]
71
+
72
+
73
+ AUTHOR
74
+ ------
75
+ Written by Jeremy Hinegardner <jeremy@hinegardner.org>
76
+
77
+
78
+ RESOURCES
79
+ ---------
80
+ GitHub project: http://www.github.com/copiousfreetime/stickler
81
+
82
+
83
+ BUGS
84
+ ----
85
+ Please report bugs to the github issue tracker
86
+ http://github.com/copiousfreetime/stickler/issues
87
+
@@ -0,0 +1,148 @@
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 linkstick:stickler[1] command interacts with an instance of
20
+ linkstick:stickler-server[1] to control the publishing and mirroring of ruby
21
+ gems.
22
+
23
+
24
+ COMMANDS
25
+ --------
26
+ [horizontal]
27
+ *push*:: Push one or more gems to a gemserver. This works the same as `gem
28
+ push` although there is no authorization mechanism.
29
+
30
+ *yank*:: Remove a gem from the gemserver's index. It will still be available
31
+ from direct download. This works the same as `gem yank`.
32
+
33
+ *mirror*:: Pull a specific version of a gem from an upstream gem server and
34
+ store it in a linkstick:stickler-server[1]
35
+
36
+ *config*:: Access or update the stickler client configuration.
37
+
38
+
39
+ OPTIONS
40
+ -------
41
+ These are the options for all commands. Not all options apply to all commands.
42
+
43
+ *-a, --add*::
44
+ Add the `--server` or `--upstream` items to the config file when using the
45
+ `config` command.
46
+
47
+ *-d, --debug*::
48
+ Output debug information
49
+
50
+ *-g, --gem-version*='VERSION'::
51
+ The version of the gem to yank from `--server` or to mirror from
52
+ `--upstream`.
53
+
54
+ *-h, --help*::
55
+ Show the help message
56
+
57
+ *-l, --list*::
58
+ Display the current configuration when using the `config` command.
59
+
60
+ *-p, --platform*='PLATFORM'::
61
+ The platform of the gem to yank from `--server` or to mirror from
62
+ `--upstream` (e.g. ruby, java, mswin32)
63
+
64
+ *-s, --server*='SERVER'::
65
+ The gem server or linkstick:stickler-server[1] URL. This is used by all the commands.
66
+
67
+ *-u, --upstream*='SERVER'::
68
+ The upstream server from which to mirror a gem when using the `mirror` command.
69
+
70
+ *-v, --version*::
71
+ Output the version.
72
+
73
+
74
+ CONFIGURATION
75
+ -------------
76
+ Stickler uses the `.gem/stickler` file to hold its configuration. It is a yaml
77
+ file and Currently there are two options. These are altered using the `stickler
78
+ config` command.
79
+
80
+ [horizontal]
81
+ *upstream*:: The default upstream server from which to mirror gems.
82
+ *server*:: The default linkstick:stickler-server[1] to interact with.
83
+
84
+ An example config file
85
+
86
+ ------------------------------------
87
+ ---
88
+ :server: http://stickler.example.com
89
+ :upstream: https://rubygems.org
90
+ ------------------------------------
91
+
92
+
93
+ EXAMPLES
94
+ --------
95
+ Push the local `my_gem-1.0.0.gem` file to the linkstick:stickler-server[1] at
96
+ *stickler.example.com*
97
+
98
+ ----------------------------------------------------------------------
99
+ stickler push ./my_gem-1.0.0.gem --server http://stickler.example.com/
100
+ ----------------------------------------------------------------------
101
+
102
+ Push all the gems in the `pkg` directory to the linkstick:stickler-server[1] at
103
+ *stickler.example.com*
104
+
105
+ ----------------------------------------------------------------------
106
+ stickler push --server http://stickler.example.com/ ./pkg/*.gem
107
+ ----------------------------------------------------------------------
108
+
109
+ Yank vesion 1.0.0 of my_gem from the gem index on sticker.example.com
110
+
111
+ --------------------------------------------------------------------------
112
+ stickler yank my_gem --version 1.0.0 --server http://stickler.example.com/
113
+ --------------------------------------------------------------------------
114
+
115
+ Take the +third_party+ gem, version +1.4.2+ that is on *rubygems.org* and mirror it
116
+ on *stickler.example.com*
117
+
118
+ -----------------------------------------------------------------------------------------------------------------
119
+ stickler mirror third_party --version 0.4.2 --upstream http://rubygems.org/ --server http://stickler.example.com/
120
+ stickler mirror --help
121
+ -----------------------------------------------------------------------------------------------------------------
122
+
123
+ Set the `server` and `upstream` configration values in the `.gem/stickler` file.
124
+
125
+ ------------------------------------------------------------------------------------------
126
+ stickler config --add --server http://stickler.example.com --upstream http://rubygems.org/
127
+ ------------------------------------------------------------------------------------------
128
+
129
+
130
+ SEE ALSO
131
+ --------
132
+ linkstick:stickler-server[1], linkstick:stickler-passenger-config[1]
133
+
134
+
135
+ AUTHOR
136
+ ------
137
+ Written by Jeremy Hinegardner <jeremy@hinegardner.org>
138
+
139
+
140
+ RESOURCES
141
+ ---------
142
+ GitHub project: http://www.github.com/copiousfreetime/stickler
143
+
144
+
145
+ BUGS
146
+ ----
147
+ Please report bugs to the github issue tracker
148
+ http://github.com/copiousfreetime/stickler/issues
@@ -4,9 +4,9 @@ require 'rubygems/server'
4
4
  shared_examples_for "common gem server before after" do
5
5
 
6
6
  before do
7
- @spec_dir = File.join( @gem_dir, "specifications" )
7
+ @webrick_spec_dir = File.join( @webrick_gem_dir, "specifications" )
8
8
 
9
- @webrick = ::Gem::Server.new(@gem_dir,4567,false)
9
+ @webrick = ::Gem::Server.new(@webrick_gem_dir,4567,false)
10
10
  @underlying_server = @webrick.instance_variable_get("@server")
11
11
  @webrick_thread = Thread.new( @webrick ) do |webrick|
12
12
  webrick.run
@@ -58,6 +58,8 @@ shared_examples_for "common gem server before after" do
58
58
  :body => last_response.body
59
59
  }.should == verify_webrick
60
60
  else
61
+ puts "webrick: #{verify_webrick[:body]}"
62
+ #puts "sinatra: #{last_response.body}"
61
63
  last_response.status.should == verify_webrick[:status]
62
64
  end
63
65
 
@@ -14,12 +14,12 @@ describe Stickler::Middleware::Index do
14
14
  end
15
15
 
16
16
  before do
17
- @gem_dir = File.expand_path( File.join( File.dirname( __FILE__ ), "tmp" ) )
18
- FileUtils.mkdir_p( File.join( @gem_dir, "specifications" ))
17
+ @webrick_gem_dir = File.expand_path( File.join( File.dirname( __FILE__ ), "tmp" ) )
18
+ FileUtils.mkdir_p( File.join( @webrick_gem_dir , "specifications" ))
19
19
  end
20
20
 
21
21
  after do
22
- FileUtils.rm_rf( @gem_dir )
22
+ FileUtils.rm_rf( @webrick_gem_dir )
23
23
  end
24
24
 
25
25
  it_should_behave_like "modern gem server indexes"
@@ -16,9 +16,7 @@ shared_examples_for "legacy gem server indexes" do
16
16
  "/quick/index.rz",
17
17
  "/quick/latest_index",
18
18
  "/quick/latest_index.rz",
19
- "/quick/Marshal.#{Gem.marshal_version}/foo-1.0.0.gemspec.rz",
20
19
  "/quick/foo-1.0.0.gemspec.rz",
21
- "/quick/Marshal.#{Gem.marshal_version}/bar-1.0.0.gemspec.rz",
22
20
  "/quick/bar-1.0.0.gemspec.rz",
23
21
  "/quick/does-not-exist-1.2.0.gemspec.rz"
24
22
  ]
@@ -7,16 +7,16 @@ require 'stickler/middleware/compression'
7
7
 
8
8
  describe ::Stickler::Middleware::Local do
9
9
  def app
10
- gem_dir = @gem_dir
10
+ repo_root = @sinatra_gem_dir
11
11
  ::Rack::Builder.new do
12
12
  use ::Stickler::Middleware::Compression
13
- use ::Stickler::Middleware::Local, :repo_root => gem_dir
13
+ use ::Stickler::Middleware::Local, :repo_root => repo_root
14
14
  run ::Sinatra::Base
15
15
  end
16
16
  end
17
17
 
18
18
  before do
19
- @gem_dir = File.join( @spec_dir, "data" )
19
+ @sinatra_gem_dir = @webrick_gem_dir = @gem_root
20
20
  end
21
21
 
22
22
  it_should_behave_like "modern gem server indexes"
@@ -10,6 +10,8 @@ shared_examples_for "modern gem server indexes" do
10
10
  "/specs.#{Gem.marshal_version}.gz",
11
11
  "/latest_specs.#{Gem.marshal_version}",
12
12
  "/latest_specs.#{Gem.marshal_version}.gz",
13
+ "/quick/Marshal.#{Gem.marshal_version}/foo-1.0.0.gemspec.rz",
14
+ "/quick/Marshal.#{Gem.marshal_version}/bar-1.0.0.gemspec.rz",
13
15
  ]
14
16
 
15
17
  MODERN_URLS.each do |url|
@@ -0,0 +1,13 @@
1
+ require File.expand_path( File.join( File.dirname( __FILE__ ), "spec_helper.rb" ) )
2
+
3
+ require 'stickler/paths'
4
+
5
+ describe Stickler::Paths do
6
+ it "can access the root dir of the project" do
7
+ Stickler::Paths.root_dir.should == File.expand_path( File.join( File.dirname( __FILE__ ), ".." ) ) + ::File::SEPARATOR
8
+ end
9
+
10
+ it "can access the lib path of the project" do
11
+ Stickler::Paths.lib_path.should == File.expand_path( File.join( File.dirname( __FILE__ ), "..", "lib" ) ) + ::File::SEPARATOR
12
+ end
13
+ end
@@ -53,6 +53,20 @@ describe Stickler::SpecLite do
53
53
  (@specs[:ruby] =~ @specs[:win]).should == false
54
54
  end
55
55
 
56
+ it "can be compared against something with the same name and version but different platform" do
57
+ list = []
58
+ list << r = Stickler::SpecLite.new( 'alib', '4.2' )
59
+ list << u = Stickler::SpecLite.new( 'alib', '4.2', 'x86-mswin32' )
60
+ list.sort.should == [ r, u ]
61
+ end
62
+
63
+ it 'converts platform comparisons to something that can be compared' do
64
+ list = []
65
+ list << h2 = Stickler::SpecLite.new( 'htimes', '1.1.1', 'x86-mingw32' )
66
+ list << h1 = Stickler::SpecLite.new( 'htimes', '1.1.1', 'java' )
67
+ list.sort.should == [ h1, h2 ]
68
+ end
69
+
56
70
  it "can be sorted" do
57
71
  list = @specs.values
58
72
  alib = Stickler::SpecLite.new( 'alib', '4.2' )