gemstash 2.3.2 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -36
  3. data/lib/gemstash/authorization.rb +5 -2
  4. data/lib/gemstash/cli/authorize.rb +42 -1
  5. data/lib/gemstash/cli.rb +4 -0
  6. data/lib/gemstash/db/authorization.rb +3 -3
  7. data/lib/gemstash/man/gemstash-authorize.1 +21 -33
  8. data/lib/gemstash/man/gemstash-authorize.1.txt +23 -15
  9. data/lib/gemstash/man/gemstash-configuration.5 +63 -118
  10. data/lib/gemstash/man/gemstash-configuration.5.txt +54 -54
  11. data/lib/gemstash/man/gemstash-customize.7 +60 -103
  12. data/lib/gemstash/man/gemstash-customize.7.txt +35 -35
  13. data/lib/gemstash/man/gemstash-debugging.7 +8 -27
  14. data/lib/gemstash/man/gemstash-debugging.7.txt +6 -6
  15. data/lib/gemstash/man/gemstash-deploy.7 +15 -39
  16. data/lib/gemstash/man/gemstash-deploy.7.txt +16 -16
  17. data/lib/gemstash/man/gemstash-mirror.7 +10 -31
  18. data/lib/gemstash/man/gemstash-mirror.7.txt +3 -3
  19. data/lib/gemstash/man/gemstash-multiple-sources.7 +72 -44
  20. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +59 -11
  21. data/lib/gemstash/man/gemstash-private-gems.7 +51 -102
  22. data/lib/gemstash/man/gemstash-private-gems.7.txt +21 -21
  23. data/lib/gemstash/man/gemstash-readme.7 +29 -75
  24. data/lib/gemstash/man/gemstash-readme.7.txt +10 -10
  25. data/lib/gemstash/man/gemstash-setup.1 +13 -33
  26. data/lib/gemstash/man/gemstash-setup.1.txt +11 -11
  27. data/lib/gemstash/man/gemstash-start.1 +7 -25
  28. data/lib/gemstash/man/gemstash-start.1.txt +6 -6
  29. data/lib/gemstash/man/gemstash-status.1 +5 -23
  30. data/lib/gemstash/man/gemstash-status.1.txt +4 -4
  31. data/lib/gemstash/man/gemstash-stop.1 +5 -23
  32. data/lib/gemstash/man/gemstash-stop.1.txt +4 -4
  33. data/lib/gemstash/man/gemstash-version.1 +4 -24
  34. data/lib/gemstash/man/gemstash-version.1.txt +1 -1
  35. data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
  36. data/lib/gemstash/upstream.rb +33 -2
  37. data/lib/gemstash/version.rb +1 -1
  38. metadata +18 -3
@@ -4,16 +4,16 @@
4
4
 
5
5
  1mDeploying Gemstash0m
6
6
  Bundler is here for the rescue to keep Gemstash up to date! Create a
7
- 1mGemfile 22mpointing to Gemstash:
7
+ Gemfile pointing to Gemstash:
8
8
 
9
9
  # ./Gemfile
10
10
  source "https://rubygems.org"
11
11
  gem "gemstash"
12
12
 
13
- Then 1mbundle 22mto create your 1mGemfile.lock22m. When you are ready to up-
14
- grade, simply 1mbundle update22m. You may need to run 1mgemstash 22mvia 1mbundle0m
15
- 1mexec22m. Alternatively, you can 1mgem uninstall gemstash 22mand 1mgem install0m
16
- 1mgemstash 22mwhen you want to upgrade.
13
+ Then bundle to create your Gemfile.lock. When you are ready to up-
14
+ grade, simply bundle update. You may need to run gemstash via bundle
15
+ exec. Alternatively, you can gem uninstall gemstash and gem install
16
+ gemstash when you want to upgrade.
17
17
 
18
18
  Gemstash will automatically run any necessary migrations, so updating
19
19
  the gem is all that needs to be done.
@@ -26,12 +26,12 @@
26
26
  $ bundle exec gemstash start
27
27
 
28
28
  1mMonitoring0m
29
- Health monitoring is built in to Gemstash using the serv-
30
- er_health_check-rack (https://github.com/on-site/server_health_check-
31
- rack) gem. If you request 1m/health 22mfrom your Gemstash instance, you
32
- will get a JSON response along with an HTTP status code indicating suc-
33
- cess or failure. The JSON response will look something like this for a
34
- success case:
29
+ Health monitoring is built in to Gemstash using the
30
+ server_health_check-rack (https://github.com/on-
31
+ site/server_health_check-rack) gem. If you request /health from your
32
+ Gemstash instance, you will get a JSON response along with an HTTP sta-
33
+ tus code indicating success or failure. The JSON response will look
34
+ something like this for a success case:
35
35
 
36
36
  {
37
37
  "status": {
@@ -43,11 +43,11 @@
43
43
  }
44
44
  }
45
45
 
46
- This request will test storage and database access and report on the
47
- result. Each key in the status can be requested alone to just report
48
- on that status. For example, if you would like a health check that
49
- doesn't interact with storage or the database, you can use
50
- 1m/health/heartbeat 22mwhich will always respond with a success while your
46
+ This request will test storage and database access and report on the
47
+ result. Each key in the status can be requested alone to just report
48
+ on that status. For example, if you would like a health check that
49
+ doesn't interact with storage or the database, you can use
50
+ /health/heartbeat which will always respond with a success while your
51
51
  Gemstash server is running.
52
52
 
53
53
  1mDowngrading0m
@@ -1,55 +1,34 @@
1
1
  <!-- Automatically generated by Pandoc -->
2
- .\" Automatically generated by Pandoc 3.1.6.2
2
+ .\" Automatically generated by Pandoc 3.1.8
3
3
  .\"
4
- .\" Define V font for inline verbatim, using C font in formats
5
- .\" that render this, and otherwise B font.
6
- .ie "\f[CB]x\f[]"x" \{\
7
- . ftr V B
8
- . ftr VI BI
9
- . ftr VB B
10
- . ftr VBI BI
11
- .\}
12
- .el \{\
13
- . ftr V CR
14
- . ftr VI CI
15
- . ftr VB CB
16
- . ftr VBI CBI
17
- .\}
18
4
  .TH "gemstash-mirror" "7" "October 25, 2015" "" ""
19
- .hy
20
5
  .SH Using Gemstash as a Mirror
21
- .PP
22
- If you don\[cq]t have control over your \f[V]Gemfile\f[R], or you
6
+ If you don\[cq]t have control over your \f[CR]Gemfile\f[R], or you
23
7
  don\[cq]t want to force everyone on your team to go through the Gemstash
24
8
  server, you can use Bundler mirroring to bundle against your Gemstash
25
9
  server.
26
10
  .PP
27
- For each source in your \f[V]Gemfile\f[R], add a mirror pointing to your
28
- Gemstash server:
11
+ For each source in your \f[CR]Gemfile\f[R], add a mirror pointing to
12
+ your Gemstash server:
29
13
  .IP
30
- .nf
31
- \f[C]
14
+ .EX
32
15
  $ bundle config mirror.http://rubygems.org http://localhost:9292
33
16
  $ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e \[aq]puts CGI.escape(\[dq]https://my.gem-source.local\[dq])\[aq])
34
- \f[R]
35
- .fi
17
+ .EE
36
18
  .PP
37
19
  From now on, bundler will fetch gems from those sources via your
38
20
  Gemstash server.
39
21
  .SH Simpler Gemstash Mirrors
40
- .PP
41
22
  \f[B]This feature requires Bundler to be at least version
42
- \f[VB]1.11.0\f[B].\f[R]
23
+ \f[CB]1.11.0\f[B].\f[R]
43
24
  .PP
44
- If you are using Bundler version \f[V]1.11.0\f[R] or greater, the
25
+ If you are using Bundler version \f[CR]1.11.0\f[R] or greater, the
45
26
  mirroring becomes a bit easier:
46
27
  .IP
47
- .nf
48
- \f[C]
28
+ .EX
49
29
  $ bundle config mirror.http://rubygems.org http://localhost:9292
50
30
  $ bundle config mirror.https://my.gem-source.local http://localhost:9292
51
- \f[R]
52
- .fi
31
+ .EE
53
32
  .PP
54
33
  Bundler will then send headers to Gemstash to indicate the correct
55
34
  upstream.
@@ -3,11 +3,11 @@
3
3
  <!-- Automatically generated by Pandoc -->
4
4
 
5
5
  1mUsing Gemstash as a Mirror0m
6
- If you don't have control over your 1mGemfile22m, or you don't want to force
6
+ If you don't have control over your Gemfile, or you don't want to force
7
7
  everyone on your team to go through the Gemstash server, you can use
8
8
  Bundler mirroring to bundle against your Gemstash server.
9
9
 
10
- For each source in your 1mGemfile22m, add a mirror pointing to your Gemstash
10
+ For each source in your Gemfile, add a mirror pointing to your Gemstash
11
11
  server:
12
12
 
13
13
  $ bundle config mirror.http://rubygems.org http://localhost:9292
@@ -19,7 +19,7 @@
19
19
  1mSimpler Gemstash Mirrors0m
20
20
  1mThis feature requires Bundler to be at least version 1.11.0.0m
21
21
 
22
- If you are using Bundler version 1m1.11.0 22mor greater, the mirroring be-
22
+ If you are using Bundler version 1.11.0 or greater, the mirroring be-
23
23
  comes a bit easier:
24
24
 
25
25
  $ bundle config mirror.http://rubygems.org http://localhost:9292
@@ -1,69 +1,46 @@
1
1
  <!-- Automatically generated by Pandoc -->
2
- .\" Automatically generated by Pandoc 3.1.6.2
2
+ .\" Automatically generated by Pandoc 3.1.8
3
3
  .\"
4
- .\" Define V font for inline verbatim, using C font in formats
5
- .\" that render this, and otherwise B font.
6
- .ie "\f[CB]x\f[]"x" \{\
7
- . ftr V B
8
- . ftr VI BI
9
- . ftr VB B
10
- . ftr VBI BI
11
- .\}
12
- .el \{\
13
- . ftr V CR
14
- . ftr VI CI
15
- . ftr VB CB
16
- . ftr VBI CBI
17
- .\}
18
4
  .TH "gemstash-multiple-sources" "7" "October 8, 2015" "" ""
19
- .hy
20
5
  .SH Multiple Gem Sources
21
- .PP
22
6
  Gemstash will stash from any amount of gem sources.
23
7
  By the end of this guide, you will be able to bundle using multiple gem
24
8
  sources, all stashed within your Gemstash server.
25
9
  .SS Default Source
26
- .PP
27
10
  When you don\[cq]t provide an explicit source (as with the Quickstart
28
11
  Guide), your gems will be fetched from https://rubygems.org.
29
12
  This default source is not set in stone.
30
13
  To change it, you need only edit the Gemstash configuration found at
31
- \f[V]\[ti]/.gemstash/config.yml\f[R]:
14
+ \f[CR]\[ti]/.gemstash/config.yml\f[R]:
32
15
  .IP
33
- .nf
34
- \f[C]
16
+ .EX
35
17
  # \[ti]/.gemstash/config.yml
36
18
  ---
37
19
  :rubygems_url: https://my.gem-source.local
38
- \f[R]
39
- .fi
20
+ .EE
40
21
  .PP
41
22
  Make sure to restart your Gemstash server after changing the config:
42
23
  .IP
43
- .nf
44
- \f[C]
24
+ .EX
45
25
  $ gemstash stop
46
26
  $ gemstash start
47
- \f[R]
48
- .fi
27
+ .EE
49
28
  .PP
50
- Once restarted, bundling against \f[V]http://localhost:9292\f[R] will
51
- fetch gems from \f[V]https://my.gem-source.local\f[R].
29
+ Once restarted, bundling against \f[CR]http://localhost:9292\f[R] will
30
+ fetch gems from \f[CR]https://my.gem-source.local\f[R].
52
31
  If you had bundled before making these changes, fear not; bundling with
53
32
  a different default gem source will store gems in a separate location,
54
33
  ensuring different sources won\[cq]t leak between each other.
55
34
  .SS Bundling with Multiple Sources
56
- .PP
57
35
  Changing the default source won\[cq]t help you if you need to bundle
58
36
  against https://rubygems.org along with additional sources.
59
37
  If you need to bundle with multiple gem sources, Gemstash doesn\[cq]t
60
38
  need to be specially configured.
61
39
  Your Gemstash server will honor any gem source specified via a
62
40
  specialized URL.
63
- Consider the following \f[V]Gemfile\f[R]:
41
+ Consider the following \f[CR]Gemfile\f[R]:
64
42
  .IP
65
- .nf
66
- \f[C]
43
+ .EX
67
44
  # ./Gemfile
68
45
  require \[dq]cgi\[dq]
69
46
  source \[dq]http://localhost:9292\[dq]
@@ -72,31 +49,82 @@ gem \[dq]rubywarrior\[dq]
72
49
  source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]https://my.gem-source.local\[dq])}\[dq] do
73
50
  gem \[dq]my-gem\[dq]
74
51
  end
75
- \f[R]
76
- .fi
52
+
53
+ source \[dq]http://localhost:9292/upstream/my-other.gem-source.local\[dq] do
54
+ gem \[dq]my-other-gem\[dq]
55
+ end
56
+ .EE
77
57
  .PP
78
- Notice the \f[V]CGI.escape\f[R] call in the second source.
58
+ Notice the \f[CR]CGI.escape\f[R] call in the second source.
79
59
  This is important, as it properly URL escapes the source URL so Gemstash
80
60
  knows what gem source you want.
81
- The \f[V]/upstream\f[R] prefix tells Gemstash to use a gem source other
61
+ The \f[CR]/upstream\f[R] prefix tells Gemstash to use a gem source other
82
62
  than the default source.
83
63
  You can now bundle with the additional source.
84
- .SS Redirecting
85
64
  .PP
65
+ Notice that the third source doesn\[cq]t need to be escaped.
66
+ This is because the \f[CR]https://\f[R] is used by default when no
67
+ scheme is set, and the source URL does not contain any characters that
68
+ need to be escaped.
69
+ .SS Authentication with Multiple Sources
70
+ You can use basic authentication or API keys on sources directly in
71
+ Gemfile or using ENV variables on the Gemstash instance.
72
+ .PP
73
+ Example \f[CR]Gemfile\f[R]:
74
+ .IP
75
+ .EX
76
+ # ./Gemfile
77
+ require \[dq]cgi\[dq]
78
+ source \[dq]http://localhost:9292\[dq]
79
+
80
+ source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]user:password\[at]my.gem-source.local\[dq])}\[dq] do
81
+ gem \[dq]my-gem\[dq]
82
+ end
83
+
84
+ source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]api_key\[at]my-other.gem-source.local\[dq])}\[dq] do
85
+ gem \[dq]my-other-gem\[dq]
86
+ end
87
+ .EE
88
+ .PP
89
+ If you set \f[CR]GEMSTASH_<HOST>\f[R] ENV variable with your
90
+ authentication information, you can omit it from the \f[CR]Gemfile\f[R]:
91
+ .IP
92
+ .EX
93
+ # ./Gemfile
94
+ source \[dq]http://localhost:9292\[dq]
95
+
96
+ source \[dq]http://localhost:9292/upstream/my.gem-source.local\[dq] do
97
+ gem \[dq]my-gem\[dq]
98
+ end
99
+ .EE
100
+ .PP
101
+ And run the Gemstash with the credentials set in an ENV variable:
102
+ .IP
103
+ .EX
104
+ GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --no-daemonize --config-file config.yml.erb
105
+ .EE
106
+ .PP
107
+ The name of the ENV variable is the uppercase version of the host name,
108
+ with all \f[CR].\f[R] characters replaced with \f[CR]__\f[R], all
109
+ \f[CR]-\f[R] with \f[CR]___\f[R] and a \f[CR]GEMSTASH_\f[R] prefix (it
110
+ uses the same syntax as
111
+ Bundler (https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCES)).
112
+ .PP
113
+ Example: \f[CR]my.gem-source.local\f[R] =>
114
+ \f[CR]GEMSTASH_MY__GEM___SOURCE__LOCAL\f[R]
115
+ .SS Redirecting
86
116
  Gemstash supports an alternate mode of specifying your gem sources.
87
117
  If you want Gemstash to redirect Bundler to your given gem sources, then
88
- you can specify your \f[V]Gemfile\f[R] like so:
118
+ you can specify your \f[CR]Gemfile\f[R] like so:
89
119
  .IP
90
- .nf
91
- \f[C]
120
+ .EX
92
121
  # ./Gemfile
93
122
  require \[dq]cgi\[dq]
94
123
  source \[dq]http://localhost:9292/redirect/#{CGI.escape(\[dq]https://rubygems.org\[dq])}\[dq]
95
124
  gem \[dq]rubywarrior\[dq]
96
- \f[R]
97
- .fi
125
+ .EE
98
126
  .PP
99
- Notice the \f[V]/redirect\f[R] prefix.
127
+ Notice the \f[CR]/redirect\f[R] prefix.
100
128
  This prefix tells Gemstash to redirect API calls to the provided URL.
101
129
  Redirected calls like this will not be cached by Gemstash, and gem files
102
130
  will not be stashed, even if they were previously cached or stashed from
@@ -11,7 +11,7 @@
11
11
  When you don't provide an explicit source (as with the Quickstart
12
12
  Guide), your gems will be fetched from https://rubygems.org. This de-
13
13
  fault source is not set in stone. To change it, you need only edit the
14
- Gemstash configuration found at 1m~/.gemstash/config.yml22m:
14
+ Gemstash configuration found at ~/.gemstash/config.yml:
15
15
 
16
16
  # ~/.gemstash/config.yml
17
17
  ---
@@ -22,8 +22,8 @@
22
22
  $ gemstash stop
23
23
  $ gemstash start
24
24
 
25
- Once restarted, bundling against 1mhttp://localhost:9292 22mwill fetch gems
26
- from 1mhttps://my.gem-source.local22m. If you had bundled before making
25
+ Once restarted, bundling against http://localhost:9292 will fetch gems
26
+ from https://my.gem-source.local. If you had bundled before making
27
27
  these changes, fear not; bundling with a different default gem source
28
28
  will store gems in a separate location, ensuring different sources
29
29
  won't leak between each other.
@@ -33,7 +33,7 @@
33
33
  against https://rubygems.org along with additional sources. If you
34
34
  need to bundle with multiple gem sources, Gemstash doesn't need to be
35
35
  specially configured. Your Gemstash server will honor any gem source
36
- specified via a specialized URL. Consider the following 1mGemfile22m:
36
+ specified via a specialized URL. Consider the following Gemfile:
37
37
 
38
38
  # ./Gemfile
39
39
  require "cgi"
@@ -44,25 +44,73 @@
44
44
  gem "my-gem"
45
45
  end
46
46
 
47
- Notice the 1mCGI.escape 22mcall in the second source. This is important, as
47
+ source "http://localhost:9292/upstream/my-other.gem-source.local" do
48
+ gem "my-other-gem"
49
+ end
50
+
51
+ Notice the CGI.escape call in the second source. This is important, as
48
52
  it properly URL escapes the source URL so Gemstash knows what gem
49
- source you want. The 1m/upstream 22mprefix tells Gemstash to use a gem
53
+ source you want. The /upstream prefix tells Gemstash to use a gem
50
54
  source other than the default source. You can now bundle with the ad-
51
55
  ditional source.
52
56
 
57
+ Notice that the third source doesn't need to be escaped. This is be-
58
+ cause the https:// is used by default when no scheme is set, and the
59
+ source URL does not contain any characters that need to be escaped.
60
+
61
+ 1mAuthentication with Multiple Sources0m
62
+ You can use basic authentication or API keys on sources directly in
63
+ Gemfile or using ENV variables on the Gemstash instance.
64
+
65
+ Example Gemfile:
66
+
67
+ # ./Gemfile
68
+ require "cgi"
69
+ source "http://localhost:9292"
70
+
71
+ source "http://localhost:9292/upstream/#{CGI.escape("user:password@my.gem-source.local")}" do
72
+ gem "my-gem"
73
+ end
74
+
75
+ source "http://localhost:9292/upstream/#{CGI.escape("api_key@my-other.gem-source.local")}" do
76
+ gem "my-other-gem"
77
+ end
78
+
79
+ If you set GEMSTASH_<HOST> ENV variable with your authentication infor-
80
+ mation, you can omit it from the Gemfile:
81
+
82
+ # ./Gemfile
83
+ source "http://localhost:9292"
84
+
85
+ source "http://localhost:9292/upstream/my.gem-source.local" do
86
+ gem "my-gem"
87
+ end
88
+
89
+ And run the Gemstash with the credentials set in an ENV variable:
90
+
91
+ GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --no-daemonize --config-file config.yml.erb
92
+
93
+ The name of the ENV variable is the uppercase version of the host name,
94
+ with all . characters replaced with __, all - with ___ and a GEMSTASH_
95
+ prefix (it uses the same syntax as Bundler
96
+ (https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-
97
+ SOURCES)).
98
+
99
+ Example: my.gem-source.local => GEMSTASH_MY__GEM___SOURCE__LOCAL
100
+
53
101
  1mRedirecting0m
54
102
  Gemstash supports an alternate mode of specifying your gem sources. If
55
- you want Gemstash to redirect Bundler to your given gem sources, then
56
- you can specify your 1mGemfile 22mlike so:
103
+ you want Gemstash to redirect Bundler to your given gem sources, then
104
+ you can specify your Gemfile like so:
57
105
 
58
106
  # ./Gemfile
59
107
  require "cgi"
60
108
  source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
61
109
  gem "rubywarrior"
62
110
 
63
- Notice the 1m/redirect 22mprefix. This prefix tells Gemstash to redirect
64
- API calls to the provided URL. Redirected calls like this will not be
65
- cached by Gemstash, and gem files will not be stashed, even if they
111
+ Notice the /redirect prefix. This prefix tells Gemstash to redirect
112
+ API calls to the provided URL. Redirected calls like this will not be
113
+ cached by Gemstash, and gem files will not be stashed, even if they
66
114
  were previously cached or stashed from the same gem source.
67
115
 
68
116
  October 8, 2015 4mgemstash-multiple-sources24m(7)