gemstash 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +57 -0
- data/lib/gemstash/cache.rb +37 -0
- data/lib/gemstash/cli/authorize.rb +2 -2
- data/lib/gemstash/cli/setup.rb +11 -3
- data/lib/gemstash/configuration.rb +1 -1
- data/lib/gemstash/dependencies.rb +2 -2
- data/lib/gemstash/env.rb +2 -0
- data/lib/gemstash/gem_fetcher.rb +2 -2
- data/lib/gemstash/gem_pusher.rb +2 -2
- data/lib/gemstash/gem_source/private_source.rb +3 -3
- data/lib/gemstash/gem_source.rb +2 -2
- data/lib/gemstash/http_client.rb +8 -3
- data/lib/gemstash/logging.rb +1 -1
- data/lib/gemstash/man/gemstash-authorize.1.txt +0 -45
- data/lib/gemstash/man/gemstash-configuration.5.txt +0 -209
- data/lib/gemstash/man/gemstash-customize.7.txt +0 -186
- data/lib/gemstash/man/gemstash-debugging.7.txt +0 -28
- data/lib/gemstash/man/gemstash-deploy.7.txt +0 -58
- data/lib/gemstash/man/gemstash-mirror.7.txt +0 -32
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +0 -70
- data/lib/gemstash/man/gemstash-private-gems.7.txt +0 -155
- data/lib/gemstash/man/gemstash-readme.7.txt +0 -181
- data/lib/gemstash/man/gemstash-setup.1.txt +0 -39
- data/lib/gemstash/man/gemstash-start.1.txt +0 -25
- data/lib/gemstash/man/gemstash-status.1.txt +0 -21
- data/lib/gemstash/man/gemstash-stop.1.txt +0 -21
- data/lib/gemstash/man/gemstash-version.1.txt +0 -20
- data/lib/gemstash/storage.rb +5 -4
- data/lib/gemstash/upstream.rb +6 -5
- data/lib/gemstash/version.rb +2 -2
- data/lib/gemstash/web.rb +6 -4
- data/lib/gemstash.rb +1 -1
- metadata +31 -171
- data/lib/gemstash/man/gemstash-authorize.1 +0 -51
- data/lib/gemstash/man/gemstash-configuration.5 +0 -229
- data/lib/gemstash/man/gemstash-customize.7 +0 -301
- data/lib/gemstash/man/gemstash-debugging.7 +0 -34
- data/lib/gemstash/man/gemstash-deploy.7 +0 -72
- data/lib/gemstash/man/gemstash-mirror.7 +0 -40
- data/lib/gemstash/man/gemstash-multiple-sources.7 +0 -89
- data/lib/gemstash/man/gemstash-private-gems.7 +0 -227
- data/lib/gemstash/man/gemstash-readme.7 +0 -233
- data/lib/gemstash/man/gemstash-setup.1 +0 -43
- data/lib/gemstash/man/gemstash-start.1 +0 -26
- data/lib/gemstash/man/gemstash-status.1 +0 -20
- data/lib/gemstash/man/gemstash-stop.1 +0 -20
- data/lib/gemstash/man/gemstash-version.1 +0 -22
@@ -1,182 +1 @@
|
|
1
|
-
gemstash-readme(7) gemstash-readme(7)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mGEMSTASH0m
|
6
|
-
1mWHAT IS GEMSTASH?0m
|
7
|
-
Gemstash is both a cache for remote servers such as
|
8
|
-
https://rubygems.org, and a private gem source.
|
9
|
-
|
10
|
-
If you are using bundler (http://bundler.io/) across many machines that
|
11
|
-
have access to a server within your control, you might want to use Gem-
|
12
|
-
stash.
|
13
|
-
|
14
|
-
If you produce gems that you don't want everyone in the world to have
|
15
|
-
access to, you might want to use Gemstash.
|
16
|
-
|
17
|
-
If you frequently bundle the same set of gems across multiple projects,
|
18
|
-
you might want to use Gemstash.
|
19
|
-
|
20
|
-
Are you only using gems from https://rubygems.org, and don't bundle the
|
21
|
-
same gems frequently? Well, maybe you don't need Gemstash... yet.
|
22
|
-
|
23
|
-
Gemstash is maintained by Ruby Together (https://rubytogether.org/), a
|
24
|
-
grassroots initiative committed to supporting the critical Ruby infra-
|
25
|
-
structure you rely on. Contribute today as an individual
|
26
|
-
(https://rubytogether.org/developers) or even better, as a company
|
27
|
-
(https://rubytogether.org/companies), and ensure that Bundler,
|
28
|
-
RubyGems, Gemstash, and other shared tooling is around for years to
|
29
|
-
come.
|
30
|
-
|
31
|
-
1mQUICKSTART GUIDE0m
|
32
|
-
1mSETUP0m
|
33
|
-
Gemstash is designed to be quick and painless to get set up. By the
|
34
|
-
end of this Quickstart Guide, you will be able to bundle stashed gems
|
35
|
-
from public sources against a Gemstash server running on your machine.
|
36
|
-
|
37
|
-
Install Gemstash to get started:
|
38
|
-
|
39
|
-
$ gem install gemstash
|
40
|
-
|
41
|
-
After it is installed, starting Gemstash requires no additional steps.
|
42
|
-
Simply start the Gemstash server with the gemstash command:
|
43
|
-
|
44
|
-
$ gemstash start
|
45
|
-
|
46
|
-
You may have noticed that the command finished quickly. This is be-
|
47
|
-
cause Gemstash will run the server in the background by default. The
|
48
|
-
server runs on port 9292.
|
49
|
-
|
50
|
-
1mBUNDLING0m
|
51
|
-
With the server running, you can bundle against it. Tell Bundler that
|
52
|
-
you want to use Gemstash to find gems from RubyGems.org:
|
53
|
-
|
54
|
-
$ bundle config mirror.https://rubygems.org http://localhost:9292
|
55
|
-
|
56
|
-
Now you can create a Gemfile and install gems through Gemstash:
|
57
|
-
|
58
|
-
# ./Gemfile
|
59
|
-
source "https://rubygems.org"
|
60
|
-
gem "rubywarrior"
|
61
|
-
|
62
|
-
The gems you include should be gems you don't yet have installed, oth-
|
63
|
-
erwise Gemstash will have nothing to stash. Now bundle:
|
64
|
-
|
65
|
-
$ bundle install --path .bundle
|
66
|
-
|
67
|
-
Your Gemstash server has fetched the gems from https://rubygems.org and
|
68
|
-
cached them for you! To prove this, you can disable your Internet con-
|
69
|
-
nection and try again. Gem files (*.gem) are cached indefinitely. Gem
|
70
|
-
dependencies metadata are cached for 30 minutes, so if you bundle again
|
71
|
-
before that, you can successfully bundle without an Internet connec-
|
72
|
-
tion:
|
73
|
-
|
74
|
-
$ # Disable your Internet first!
|
75
|
-
$ rm -rf Gemfile.lock .bundle
|
76
|
-
$ bundle
|
77
|
-
|
78
|
-
1mFALLING BACK TO RUBYGEMS.ORG0m
|
79
|
-
If you want to make sure that your bundling from https://rubygems.org
|
80
|
-
still works as expected when the Gemstash server is not running, you
|
81
|
-
can easily configure Bundler to fallback to https://rubygems.org.
|
82
|
-
|
83
|
-
$ bundle config mirror.https://rubygems.org.fallback_timeout true
|
84
|
-
|
85
|
-
You can also configure this fallback as a number of seconds in case the
|
86
|
-
Gemstash server is simply unresponsive. This example uses a 3 second
|
87
|
-
timeout:
|
88
|
-
|
89
|
-
$ bundle config mirror.https://rubygems.org.fallback_timeout 3
|
90
|
-
|
91
|
-
1mSTOPPING THE SERVER0m
|
92
|
-
Once you've finish using your Gemstash server, you can stop it just as
|
93
|
-
easily as you started it:
|
94
|
-
|
95
|
-
$ gemstash stop
|
96
|
-
|
97
|
-
You'll also want to tell Bundler that it can go back to getting gems
|
98
|
-
from RubyGems.org directly, instead of going through Gemstash:
|
99
|
-
|
100
|
-
$ bundle config --delete mirror.https://rubygems.org
|
101
|
-
|
102
|
-
1mUNDER THE HOOD0m
|
103
|
-
You might wonder where the gems are stored. After running the commands
|
104
|
-
above, you will find a new directory at ~/.gemstash. This directory
|
105
|
-
holds all the cached and private gems. It also has a server log, the
|
106
|
-
database, and configuration for Gemstash. If you prefer, you can point
|
107
|
-
to a different directory (gemstash help customize.7).
|
108
|
-
|
109
|
-
Gemstash uses SQLite (https://www.sqlite.org/) to store details about
|
110
|
-
private gems. The database will be located in ~/.gemstash, however you
|
111
|
-
won't see the database appear until you start using private gems. If
|
112
|
-
you prefer, you can use a different database (gemstash help custom-
|
113
|
-
ize.7).
|
114
|
-
|
115
|
-
Gemstash temporarily caches things like gem dependencies in memory.
|
116
|
-
Anything cached in memory will last for 30 minutes before being re-
|
117
|
-
trieved again. You can use memcached (gemstash help customize.7) in-
|
118
|
-
stead of caching in memory. Gem files are always cached permanently,
|
119
|
-
so bundling with a Gemfile.lock with all gems cached will never call
|
120
|
-
out to https://rubygems.org.
|
121
|
-
|
122
|
-
The server you ran is provided via Puma (http://puma.io/) and Rack
|
123
|
-
(http://rack.github.io/), however they are not customizable at this
|
124
|
-
point.
|
125
|
-
|
126
|
-
1mDEEP DIVE0m
|
127
|
-
Deep dive into more subjects:
|
128
|
-
|
129
|
-
o Private gems (gemstash help private-gems.7)
|
130
|
-
|
131
|
-
o Multiple gem sources (gemstash help multiple-sources.7)
|
132
|
-
|
133
|
-
o Using Gemstash as a mirror (gemstash help mirror.7)
|
134
|
-
|
135
|
-
o Customizing the server (database, storage, caching, and more) (gem-
|
136
|
-
stash help customize.7)
|
137
|
-
|
138
|
-
o Deploying Gemstash (gemstash help deploy.7)
|
139
|
-
|
140
|
-
o Debugging Gemstash (gemstash help debugging.7)
|
141
|
-
|
142
|
-
1mREFERENCE0m
|
143
|
-
An anatomy of various configuration and commands:
|
144
|
-
|
145
|
-
o Configuration (gemstash help configuration.5)
|
146
|
-
|
147
|
-
o Authorize (gemstash help authorize.1)
|
148
|
-
|
149
|
-
o Start (gemstash help start.1)
|
150
|
-
|
151
|
-
o Stop (gemstash help stop.1)
|
152
|
-
|
153
|
-
o Status (gemstash help status.1)
|
154
|
-
|
155
|
-
o Setup (gemstash help setup.1)
|
156
|
-
|
157
|
-
o Version (gemstash help version.1)
|
158
|
-
|
159
|
-
To see what has changed in recent versions of Gemstash, see the
|
160
|
-
CHANGELOG (https://github.com/rubygems/gemstash/blob/master/CHANGEL-
|
161
|
-
OG.md).
|
162
|
-
|
163
|
-
1mDEVELOPMENT0m
|
164
|
-
After checking out the repo, run bin/setup to install dependencies.
|
165
|
-
Then, run rake to run RuboCop and the tests. While developing, you can
|
166
|
-
run bin/gemstash to run Gemstash. You can also run bin/console for an
|
167
|
-
interactive prompt that will allow you to experiment.
|
168
|
-
|
169
|
-
1mCONTRIBUTING0m
|
170
|
-
Bug reports and pull requests are welcome on GitHub at
|
171
|
-
https://github.com/rubygems/gemstash. This project is intended to be a
|
172
|
-
safe, welcoming space for collaboration, and contributors are expected
|
173
|
-
to adhere to the Contributor Covenant (https://github.com/rubygems/gem-
|
174
|
-
stash/blob/master/CODE_OF_CONDUCT.md) code of conduct.
|
175
|
-
|
176
|
-
1mLICENSE0m
|
177
|
-
The gem is available as open source under the terms of the MIT License
|
178
|
-
(http://opensource.org/licenses/MIT).
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
November 30, 2015 gemstash-readme(7)
|
@@ -1,40 +1 @@
|
|
1
|
-
gemstash-setup(1) gemstash-setup(1)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mNAME0m
|
6
|
-
gemstash-setup - Customize your Gemstash configuration interactively
|
7
|
-
|
8
|
-
1mSYNOPSIS0m
|
9
|
-
gemstash setup [--redo] [--debug] [--config-file FILE]
|
10
|
-
|
11
|
-
1mDESCRIPTION0m
|
12
|
-
Customize your Gemstash configuration interactively. This will save
|
13
|
-
your config file, but only if a few checks pass after you've provided
|
14
|
-
your answers.
|
15
|
-
|
16
|
-
1mUSAGE0m
|
17
|
-
gemstash setup
|
18
|
-
gemstash setup --redo
|
19
|
-
gemstash setup --config-file <file>
|
20
|
-
|
21
|
-
1mOPTIONS0m
|
22
|
-
o --redo: Redo the configuration. This does nothing the first time
|
23
|
-
gemstash setup is run. If you want to change your configuration us-
|
24
|
-
ing gemstash setup after you've run it before, you must provide this
|
25
|
-
option, otherwise Gemstash will simply indicate your setup is com-
|
26
|
-
plete.
|
27
|
-
|
28
|
-
o --debug: Output additional information if one of the checks at the
|
29
|
-
end of setup fails. This will do nothing if all checks pass.
|
30
|
-
|
31
|
-
o --config-file FILE: Specify the config file to write to. Without
|
32
|
-
this option, your configuration will be written to ~/.gemstash/con-
|
33
|
-
fig.yml. If you write to a custom location, you will need to pass
|
34
|
-
the --config-file option to all Gemstash commands. If you plan to
|
35
|
-
use ERB in your config file (gemstash help customize.7), you might
|
36
|
-
want to use ~/.gemstash/config.yml.erb.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
October 9, 2015 gemstash-setup(1)
|
@@ -1,26 +1 @@
|
|
1
|
-
gemstash-start(1) gemstash-start(1)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mNAME0m
|
6
|
-
gemstash-start - Starts the Gemstash server
|
7
|
-
|
8
|
-
1mSYNOPSIS0m
|
9
|
-
gemstash start [--no-daemonize] [--config-file FILE]
|
10
|
-
|
11
|
-
1mDESCRIPTION0m
|
12
|
-
Starts the Gemstash server.
|
13
|
-
|
14
|
-
1mOPTIONS0m
|
15
|
-
o --config-file FILE: Specify the config file to use. If you aren't
|
16
|
-
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
17
|
-
stash/config.yml.erb (gemstash help customize.7), then you must spec-
|
18
|
-
ify the config file via this option.
|
19
|
-
|
20
|
-
o --no-daemonize: The Gemstash server daemonizes itself by default.
|
21
|
-
Provide this option to instead run the server until Ctrl-C is typed.
|
22
|
-
When not daemonized, the log will be output to standard out.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
October 9, 2015 gemstash-start(1)
|
@@ -1,22 +1 @@
|
|
1
|
-
gemstash-status(1) gemstash-status(1)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mNAME0m
|
6
|
-
gemstash-status - Checks status of the Gemstash server
|
7
|
-
|
8
|
-
1mSYNOPSIS0m
|
9
|
-
gemstash status [--config-file FILE]
|
10
|
-
|
11
|
-
1mDESCRIPTION0m
|
12
|
-
Checks status of the Gemstash server.
|
13
|
-
|
14
|
-
1mOPTIONS0m
|
15
|
-
o --config-file FILE: Specify the config file to use. If you aren't
|
16
|
-
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
17
|
-
stash/config.yml.erb (gemstash help customize.7), then you must spec-
|
18
|
-
ify the config file via this option.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
October 28, 2015 gemstash-status(1)
|
@@ -1,22 +1 @@
|
|
1
|
-
gemstash-stop(1) gemstash-stop(1)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mNAME0m
|
6
|
-
gemstash-stop - Stops the Gemstash server
|
7
|
-
|
8
|
-
1mSYNOPSIS0m
|
9
|
-
gemstash stop [--config-file FILE]
|
10
|
-
|
11
|
-
1mDESCRIPTION0m
|
12
|
-
Stops the Gemstash server.
|
13
|
-
|
14
|
-
1mOPTIONS0m
|
15
|
-
o --config-file FILE: Specify the config file to use. If you aren't
|
16
|
-
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
17
|
-
stash/config.yml.erb (gemstash help customize.7), then you must spec-
|
18
|
-
ify the config file via this option.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
October 9, 2015 gemstash-stop(1)
|
@@ -1,21 +1 @@
|
|
1
|
-
gemstash-version(1) gemstash-version(1)
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
1mNAME0m
|
6
|
-
gemstash-version - Show what version of Gemstash you are using
|
7
|
-
|
8
|
-
1mSYNOPSIS0m
|
9
|
-
gemstash version
|
10
|
-
|
11
|
-
1mDESCRIPTION0m
|
12
|
-
Show what version of Gemstash you are using.
|
13
|
-
|
14
|
-
1mUSAGE0m
|
15
|
-
gemstash version
|
16
|
-
gemstash --version
|
17
|
-
gemstash -v
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
December 14, 2015 gemstash-version(1)
|
data/lib/gemstash/storage.rb
CHANGED
@@ -68,7 +68,7 @@ module Gemstash
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
YAML.
|
71
|
+
YAML.safe_load_file(file, permitted_classes: [Symbol])
|
72
72
|
end
|
73
73
|
|
74
74
|
private
|
@@ -94,6 +94,7 @@ module Gemstash
|
|
94
94
|
include Gemstash::Env::Helper
|
95
95
|
include Gemstash::Logging
|
96
96
|
attr_reader :name, :folder
|
97
|
+
|
97
98
|
VERSION = 1
|
98
99
|
|
99
100
|
# If the storage engine detects a resource was originally saved from a newer
|
@@ -195,7 +196,7 @@ module Gemstash
|
|
195
196
|
# @param props [Hash] the properties to add
|
196
197
|
# @return [Gemstash::Resource] self for chaining purposes
|
197
198
|
def update_properties(props)
|
198
|
-
load_properties(true)
|
199
|
+
load_properties(force: true)
|
199
200
|
|
200
201
|
deep_merge = proc do |_, old_value, new_value|
|
201
202
|
if old_value.is_a?(Hash) && new_value.is_a?(Hash)
|
@@ -276,11 +277,11 @@ module Gemstash
|
|
276
277
|
@content[key] = read_file(content_filename(key))
|
277
278
|
end
|
278
279
|
|
279
|
-
def load_properties(force
|
280
|
+
def load_properties(force: false)
|
280
281
|
return if @properties && !force
|
281
282
|
return unless File.exist?(properties_filename)
|
282
283
|
|
283
|
-
@properties = YAML.
|
284
|
+
@properties = YAML.safe_load_file(properties_filename, permitted_classes: [Symbol]) || {}
|
284
285
|
check_resource_version
|
285
286
|
end
|
286
287
|
|
data/lib/gemstash/upstream.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "digest"
|
4
|
+
require "forwardable"
|
4
5
|
require "uri"
|
5
6
|
|
6
7
|
module Gemstash
|
7
|
-
|
8
|
+
# :nodoc:
|
8
9
|
class Upstream
|
9
10
|
extend Forwardable
|
10
11
|
|
@@ -15,7 +16,7 @@ module Gemstash
|
|
15
16
|
def initialize(upstream, user_agent: nil)
|
16
17
|
@uri = URI(CGI.unescape(upstream.to_s))
|
17
18
|
@user_agent = user_agent
|
18
|
-
raise "URL '#{@uri}' is not valid!" unless @uri.to_s
|
19
|
+
raise "URL '#{@uri}' is not valid!" unless @uri.to_s&.match?(URI::DEFAULT_PARSER.make_regexp)
|
19
20
|
end
|
20
21
|
|
21
22
|
def url(path = nil, params = nil)
|
@@ -23,7 +24,7 @@ module Gemstash
|
|
23
24
|
|
24
25
|
unless path.to_s.empty?
|
25
26
|
base = "#{base}/" unless base.end_with?("/")
|
26
|
-
path = path[1
|
27
|
+
path = path[1..] if path.to_s.start_with?("/")
|
27
28
|
end
|
28
29
|
|
29
30
|
params = "?#{params}" if !params.nil? && !params.empty?
|
@@ -31,7 +32,7 @@ module Gemstash
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def auth?
|
34
|
-
!user.to_s.empty?
|
35
|
+
!user.to_s.empty? || !password.to_s.empty?
|
35
36
|
end
|
36
37
|
|
37
38
|
# Utilized as the parent directory for cached gems
|
@@ -45,7 +46,7 @@ module Gemstash
|
|
45
46
|
Digest::MD5.hexdigest(to_s)
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
|
+
# :nodoc:
|
49
50
|
class GemName
|
50
51
|
def initialize(upstream, gem_name)
|
51
52
|
@upstream = upstream
|
data/lib/gemstash/version.rb
CHANGED
data/lib/gemstash/web.rb
CHANGED
@@ -5,11 +5,13 @@ require "json"
|
|
5
5
|
require "gemstash"
|
6
6
|
|
7
7
|
module Gemstash
|
8
|
-
|
8
|
+
# :nodoc:
|
9
9
|
class Web < Sinatra::Base
|
10
|
-
def initialize(
|
11
|
-
|
12
|
-
|
10
|
+
ruby2_keywords def initialize(options = {})
|
11
|
+
raise ArgumentError unless options.is_a?(Hash)
|
12
|
+
|
13
|
+
@gemstash_env = options[:gemstash_env] || Gemstash::Env.new
|
14
|
+
@http_client_builder = options[:http_client_builder] || Gemstash::HTTPClient
|
13
15
|
Gemstash::Env.current = @gemstash_env
|
14
16
|
super()
|
15
17
|
end
|