gemstash 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/lib/gemstash/cli.rb +46 -0
  4. data/lib/gemstash/cli/setup.rb +1 -1
  5. data/lib/gemstash/env.rb +5 -0
  6. data/lib/gemstash/man/gemstash-authorize.1 +50 -0
  7. data/lib/gemstash/man/gemstash-authorize.1.txt +45 -0
  8. data/lib/gemstash/man/gemstash-configuration.5 +133 -0
  9. data/lib/gemstash/man/gemstash-configuration.5.txt +121 -0
  10. data/lib/gemstash/man/gemstash-customize.7 +224 -0
  11. data/lib/gemstash/man/gemstash-customize.7.txt +137 -0
  12. data/lib/gemstash/man/gemstash-debugging.7 +34 -0
  13. data/lib/gemstash/man/gemstash-debugging.7.txt +29 -0
  14. data/lib/gemstash/man/gemstash-deploy.7 +40 -0
  15. data/lib/gemstash/man/gemstash-deploy.7.txt +34 -0
  16. data/lib/gemstash/man/gemstash-mirror.7 +40 -0
  17. data/lib/gemstash/man/gemstash-mirror.7.txt +33 -0
  18. data/lib/gemstash/man/gemstash-multiple-sources.7 +89 -0
  19. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +71 -0
  20. data/lib/gemstash/man/gemstash-private-gems.7 +195 -0
  21. data/lib/gemstash/man/gemstash-private-gems.7.txt +133 -0
  22. data/lib/gemstash/man/gemstash-readme.7 +204 -0
  23. data/lib/gemstash/man/gemstash-readme.7.txt +160 -0
  24. data/lib/gemstash/man/gemstash-setup.1 +41 -0
  25. data/lib/gemstash/man/gemstash-setup.1.txt +38 -0
  26. data/lib/gemstash/man/gemstash-start.1 +25 -0
  27. data/lib/gemstash/man/gemstash-start.1.txt +25 -0
  28. data/lib/gemstash/man/gemstash-status.1 +19 -0
  29. data/lib/gemstash/man/gemstash-status.1.txt +21 -0
  30. data/lib/gemstash/man/gemstash-stop.1 +19 -0
  31. data/lib/gemstash/man/gemstash-stop.1.txt +21 -0
  32. data/lib/gemstash/man/gemstash-version.1 +22 -0
  33. data/lib/gemstash/man/gemstash-version.1.txt +21 -0
  34. data/lib/gemstash/storage.rb +7 -4
  35. data/lib/gemstash/version.rb +1 -1
  36. metadata +79 -48
  37. data/Gemfile +0 -4
  38. data/README.md +0 -161
  39. data/Rakefile +0 -25
  40. data/bin/console +0 -14
  41. data/bin/gemstash +0 -3
  42. data/bin/setup +0 -5
  43. data/docs/config.md +0 -136
  44. data/docs/debug.md +0 -24
  45. data/docs/deploy.md +0 -30
  46. data/docs/mirror.md +0 -30
  47. data/docs/multiple_sources.md +0 -68
  48. data/docs/private_gems.md +0 -140
  49. data/docs/reference.md +0 -323
  50. data/gemstash.gemspec +0 -49
  51. data/gemstash.png +0 -0
  52. data/rake/changelog.citrus +0 -157
  53. data/rake/changelog.rb +0 -201
  54. data/rake/table_of_contents.rb +0 -36
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in gemstash.gemspec
4
- gemspec
data/README.md DELETED
@@ -1,161 +0,0 @@
1
- [![Build Status](https://travis-ci.org/bundler/gemstash.svg?branch=master)](https://travis-ci.org/bundler/gemstash)
2
-
3
- <p align="center"><img src="gemstash.png" /></p>
4
-
5
- ## What is Gemstash?
6
-
7
- Gemstash is both a cache for remote servers such as https://rubygems.org, and a
8
- private gem source.
9
-
10
- If you are using [bundler](http://bundler.io/) across many machines that have
11
- access to a server within your control, you might want to use Gemstash.
12
-
13
- If you produce gems that you don't want everyone in the world to have access to,
14
- you might want to use Gemstash.
15
-
16
- If you frequently bundle the same set of gems across multiple projects, you
17
- might want to use Gemstash.
18
-
19
- Are you only using gems from https://rubygems.org, and don't bundle the same
20
- gems frequently? Well, maybe you don't need Gemstash... yet.
21
-
22
- ## Quickstart Guide
23
-
24
- ### Setup
25
-
26
- Gemstash is designed to be quick and painless to get set up. By the end of this
27
- Quickstart Guide, you will be able to bundle stashed gems from public sources
28
- against a Gemstash server running on your machine.
29
-
30
- Install Gemstash to get started:
31
-
32
- ```
33
- $ gem install gemstash
34
- ```
35
-
36
- After it is installed, starting Gemstash requires no additional steps. Simply
37
- start the Gemstash server with the `gemstash` command:
38
-
39
- ```
40
- $ gemstash start
41
- ```
42
-
43
- You may have noticed that the command finished quickly. This is because Gemstash
44
- will run the server in the background by default. The server runs on port 9292.
45
-
46
- ### Bundling
47
-
48
- With the server running, you can bundle against it. Tell Bundler that you want
49
- to use Gemstash to find gems from RubyGems.org:
50
-
51
- ```
52
- $ bundle config mirror.https://rubygems.org http://localhost:9292
53
- ```
54
-
55
- Now you can create a Gemfile and install gems through Gemstash:
56
-
57
- ```ruby
58
- # ./Gemfile
59
- source "https://rubygems.org"
60
- gem "rubywarrior"
61
- ```
62
-
63
- The gems you include should be gems you don't yet have installed,
64
- otherwise Gemstash will have nothing to stash. Now bundle:
65
-
66
- ```
67
- $ bundle install --path .bundle
68
- ```
69
-
70
- Your Gemstash server has fetched the gems from https://rubygems.org and cached
71
- them for you! To prove this, you can disable your Internet connection and try
72
- again. The gem dependencies from https://rubygems.org are cached for 30 minutes,
73
- so if you bundle again before that, you can successfully bundle without an
74
- Internet connection:
75
-
76
- ```
77
- $ # Disable your Internet first!
78
- $ rm -rf Gemfile.lock .bundle
79
- $ bundle
80
- ```
81
-
82
- ### Stopping the Server
83
-
84
- Once you've finish using your Gemstash server, you can stop it just as easily as
85
- you started it:
86
-
87
- ```
88
- $ gemstash stop
89
- ```
90
-
91
- You'll also want to tell Bundler that it can go back to getting gems from
92
- RubyGems.org directly, instead of going through Gemstash:
93
-
94
- ```
95
- $ bundle config --delete mirror.https://rubygems.org
96
- ```
97
-
98
- ### Under the Hood
99
-
100
- You might wonder where the gems are stored. After running the commands above,
101
- you will find a new directory at `~/.gemstash`. This directory holds all the
102
- cached and private gems. It also has a server log, the database, and
103
- configuration for Gemstash. If you prefer, you can [point to a different
104
- directory](docs/config.md#files).
105
-
106
- Gemstash uses [SQLite](https://www.sqlite.org/) to store details about private
107
- gems. The database will be located in `~/.gemstash`, however you won't see the
108
- database appear until you start using private gems. If you prefer, you can [use
109
- a different database](docs/config.md#database).
110
-
111
- Gemstash temporarily caches things like gem dependencies in memory. Anything
112
- cached in memory will last for 30 minutes before being retrieved again. You can
113
- [use memcached](docs/config.md#cache) instead of caching in memory. Gem files
114
- are always cached permanently, so bundling with a `Gemfile.lock` with all gems
115
- cached will never call out to https://rubygems.org.
116
-
117
- The server you ran is provided via [Puma](http://puma.io/) and
118
- [Rack](http://rack.github.io/), however they are not customizable at this point.
119
-
120
- ## Deep Dive
121
-
122
- For a deep dive into the following subjects, follow the links:
123
- * [Private gems](docs/private_gems.md)
124
- * [Multiple gem sources](docs/multiple_sources.md)
125
- * [Using Gemstash as a mirror](docs/mirror.md)
126
- * [Customizing the server (database, storage, caching, and more)](docs/config.md)
127
- * [Deploying Gemstash](docs/deploy.md)
128
- * [Debugging Gemstash](docs/debug.md)
129
-
130
- ## Reference
131
-
132
- For an anatomy of various configuration and commands, follow the links:
133
- * [Configuration](docs/reference.md#configuration)
134
- * [Authorize](docs/reference.md#authorize)
135
- * [Start](docs/reference.md#start)
136
- * [Stop](docs/reference.md#stop)
137
- * [Status](docs/reference.md#status)
138
- * [Setup](docs/reference.md#setup)
139
- * [Version](docs/reference.md#version)
140
-
141
- To see what has changed in recent versions of Gemstash, see the
142
- [CHANGELOG](CHANGELOG.md).
143
-
144
- ## Development
145
-
146
- After checking out the repo, run `bin/setup` to install dependencies. Then, run
147
- `rake` to run RuboCop and the tests. While developing, you can run
148
- `bin/gemstash` to run Gemstash. You can also run `bin/console` for an
149
- interactive prompt that will allow you to experiment.
150
-
151
- ## Contributing
152
-
153
- Bug reports and pull requests are welcome on GitHub at
154
- https://github.com/bundler/gemstash. This project is intended to be a safe,
155
- welcoming space for collaboration, and contributors are expected to adhere to
156
- the [Contributor Covenant](CODE_OF_CONDUCT.md) code of conduct.
157
-
158
- ## License
159
-
160
- The gem is available as open source under the terms of the
161
- [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
- require "rubocop/rake_task"
4
- require_relative "rake/changelog.rb"
5
- require_relative "rake/table_of_contents.rb"
6
-
7
- RuboCop::RakeTask.new
8
-
9
- desc "Run specs"
10
- RSpec::Core::RakeTask.new(:spec) do |t|
11
- t.rspec_opts = %w(--color)
12
- end
13
-
14
- task spec: :rubocop
15
- task default: :spec
16
-
17
- desc "Generate Table of Contents for certain docs"
18
- task :toc do
19
- TableOfContents.new.run
20
- end
21
-
22
- desc "Update ChangeLog based on commits in master"
23
- task :changelog do
24
- Changelog.new.run
25
- end
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "gemstash"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "bundler/setup"
3
- exec "exe/gemstash", *ARGV
data/bin/setup DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
@@ -1,136 +0,0 @@
1
- # Customizing the Server
2
-
3
- Although Gemstash is designed for as minimal setup as possible, there may be
4
- times you will want to change some of the default configuration. By the end of
5
- this guide, you will be able to customize some of the Gemstash behavior,
6
- including where files are stored, what database Gemstash uses, and how Gemstash
7
- caches certain requests.
8
-
9
- ## Setup
10
-
11
- Several customizable options are available via an interactive Gemstash command.
12
- Run `gemstash setup` and answer the questions it provides (a blank answer will
13
- use the default value):
14
- <pre>
15
- $ gemstash setup
16
- Where should files go? [~/.gemstash]
17
- Cache with what? [MEMORY, memcached] <strong>memcached</strong>
18
- What is the comma separated Memcached servers? [localhost:11211]
19
- What database adapter? [SQLITE3, postgres] <strong>postgres</strong>
20
- Where is the database? [postgres:///gemstash]
21
- Checking that the cache is available
22
- Checking that the database is available
23
- The database is not available
24
- </pre>
25
-
26
- Once you've answered the questsions, some checks will be made to ensure the
27
- configuration will work. For example, the database didn't exist in the previous
28
- example, so the command failed and the configuration wasn't saved. If the
29
- command passes, you may provide the `--redo` option to force configuration to be
30
- redone:
31
- <pre>
32
- $ gemstash setup --redo
33
- Where should files go? [~/.gemstash]
34
- Cache with what? [MEMORY, memcached] <strong>memcached</strong>
35
- What is the comma separated Memcached servers? [localhost:11211]
36
- What database adapter? [SQLITE3, postgres]
37
- Checking that the cache is available
38
- Checking that the database is available
39
- You are all setup!
40
- </pre>
41
-
42
- Once all checks have passed, Gemstash will store your answers in the
43
- configuration file located at `~/.gemstash/config.yml`.
44
-
45
- ## Files
46
-
47
- Storage in Gemstash defaults to `~/.gemstash` unless otherwise specified. You
48
- can change this in your config file via the `:base_path` key:
49
- ```yaml
50
- # ~/.gemstash/config.yml
51
- ---
52
- :base_path: "/var/gemstash"
53
- ```
54
-
55
- When customizing the `base_path`, the directory must exist, otherwise Gemstash
56
- will fail to run. Thus, if you want to use `/var/gemstash` like in the previous
57
- example, make sure to `mkdir /var/gemstash` and grant access to the directory
58
- for the user you run Gemstash with.
59
-
60
- ## Database
61
-
62
- The `:db_adapter` configuration key specifies what database you will be using.
63
- The default `:db_adapter` is [`sqlite3`](https://www.sqlite.org/), which will
64
- use a database file located within your `:base_path`. The database file will
65
- always be named `gemstash.db`.
66
-
67
- You may also use [`postgres`](http://www.postgresql.org/) for your
68
- `:db_adapter`. When using PostgreSQL, you need to specify the `:db_url` to point
69
- to an existing database. Here is an example configuration to use the `postgres`
70
- adapter:
71
- ```yaml
72
- # ~/.gemstash/config.yml
73
- ---
74
- :db_adapter: postgres
75
- :db_url: postgres:///gemstash
76
- ```
77
-
78
- Regardless of the adapter you choose, the database will automatically migrate to
79
- your version of Gemstash whenever the database is needed. Except for `sqlite3`,
80
- you only need to ensure the database exists and Gemstash will do the rest.
81
-
82
- ## Cache
83
-
84
- Certain things (like dependencies) are cached in memory. This avoids web calls
85
- to the gem source, and database calls for private gems. The memory cache can
86
- optionally be swapped out with a [Memcached](http://memcached.org/) server (or
87
- cluster of servers). To use Memcached, you must update the `:cache_type`
88
- configuration key to be `memcached`, and provide the servers via the
89
- `:memcached_servers` configuration key:
90
- ```yaml
91
- # ~/.gemstash/config.yml
92
- ---
93
- :cache_type: memcached
94
- :memcached_servers: memcached1.local:11211,memcached2.local:11211
95
- ```
96
-
97
- Note that the `:memcached_servers` requires a comma separated list of servers.
98
- All caching lasts for 30 minutes.
99
-
100
- ## Server
101
-
102
- Gemstash uses [Puma](http://puma.io/) and [Rack](http://rack.github.io/) as the
103
- server. Alternate server configurations are not currently supported, but you can
104
- take a look at the [Puma configuration](../lib/gemstash/puma.rb) and the [rackup
105
- file](../lib/gemstash/config.ru) for inspiration.
106
-
107
- While the server is not customizable, the way Gemstash binds the port can be
108
- changed. To change the binding, update the `:bind` configuration key:
109
- ```yaml
110
- # ~/.gemstash/config.yml
111
- ---
112
- :bind: tcp://0.0.0.0:4242
113
- ```
114
-
115
- This maps directly to the [Puma bind
116
- flag](https://github.com/puma/puma#binding-tcp--sockets), and will support
117
- anything valid for that flag.
118
-
119
- ## Config File Location
120
-
121
- By default, configuration for Gemstash will be at `~/.gemstash/config.yml`. This
122
- can be changed by providing the `--config-file` option to the various Gemstash
123
- commands:
124
- ```
125
- $ gemstash setup --config-file ./gemstash-config.yml
126
- $ gemstash authorize --config-file ./gemstash-config.yml
127
- $ gemstash start --config-file ./gemstash-config.yml
128
- $ gemstash stop --config-file ./gemstash-config.yml
129
- $ gemstash status --config-file ./gemstash-config.yml
130
- ```
131
-
132
- When providing `--config-file` to `gemstash setup`, the provided file will be
133
- output to with the provided configuration. **This will overwrite** any existing
134
- configuration. If the file doesn't exist when providing `--config-file` to
135
- `gemstash start`, `gemstash stop`, `gemstash status`, and `gemstash authorize`,
136
- the default configuration will be used.
@@ -1,24 +0,0 @@
1
- # Debugging Gemstash
2
-
3
- If you are finding Gemstash isn't behaving as you would expect, you might want
4
- to start by looking at the server log. You can find the log at `server.log`
5
- within your base directory. By default, this will be at
6
- `~/.gemstash/server.log`.
7
-
8
- You might find it easier to view the log directly in your terminal. If you run
9
- Gemstash [in non-daemonized form](reference.md#--no-daemonize), the log will be
10
- output directly to standard out:
11
- ```
12
- $ gemstash start --no-daemonize
13
- ```
14
-
15
- You can also [check the status](reference.md#status) of the server:
16
- ```
17
- $ gemstash status
18
- ```
19
-
20
- The server status is checked by passing through to
21
- [pumactl](https://github.com/puma/puma#pumactl).
22
-
23
- If you find a bug, please don't hesitate to [open a bug
24
- report](../README.md#contributing)!
@@ -1,30 +0,0 @@
1
- # Deploying Gemstash
2
-
3
- Bundler is here for the rescue to keep Gemstash up to date! Create a `Gemfile`
4
- pointing to Gemstash:
5
- ```ruby
6
- # ./Gemfile
7
- source "https://rubygems.org"
8
- gem "gemstash"
9
- ```
10
-
11
- Then `bundle` to create your `Gemfile.lock`. When you are ready to upgrade,
12
- simply `bundle update`. You may need to run `gemstash` via `bundle exec`.
13
- Alternatively, you can `gem uninstall gemstash` and `gem install gemstash` when
14
- you want to upgrade.
15
-
16
- Gemstash will automatically run any necessary migrations, so updating the gem is
17
- all that needs to be done.
18
-
19
- It is probably wise to stop Gemstash before upgrading, then starting again once
20
- you are done:
21
- ```
22
- $ bundle exec gemstash stop
23
- $ bundle update
24
- $ bundle exec gemstash start
25
- ```
26
-
27
- ## Downgrading
28
-
29
- It is not recommended to go backwards in Gemstash versions. Migrations may have
30
- run that could leave the database in a bad state.
@@ -1,30 +0,0 @@
1
- # Using Gemstash as a Mirror
2
-
3
- If you don't have control over your `Gemfile`, or you don't want to force
4
- everyone on your team to go through the Gemstash server, you can use Bundler
5
- mirroring to bundle against your Gemstash server.
6
-
7
- For each source in your `Gemfile`, add a mirror pointing to your Gemstash
8
- server:
9
- ```
10
- $ bundle config mirror.http://rubygems.org http://localhost:9292
11
- $ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e 'puts CGI.escape("https://my.gem-source.local")')
12
- ```
13
-
14
- From now on, bundler will fetch gems from those sources via your Gemstash
15
- server.
16
-
17
- # Simpler Gemstash Mirrors
18
-
19
- **WARNING: This feature is not yet available.**
20
-
21
- **This feature requires Bundler to be at least version `1.11.0`.**
22
-
23
- If you are using Bundler version `1.11.0` or greater, the mirroring becomes a
24
- bit easier:
25
- ```
26
- $ bundle config mirror.http://rubygems.org http://localhost:9292
27
- $ bundle config mirror.https://my.gem-source.local http://localhost:9292
28
- ```
29
-
30
- Bundler will then send headers to Gemstash to indicate the correct upstream.
@@ -1,68 +0,0 @@
1
- # Multiple Gem Sources
2
-
3
- Gemstash will stash from any amount of gem sources. By the end of this guide,
4
- you will be able to bundle using multiple gem sources, all stashed within your
5
- Gemstash server.
6
-
7
- ## Default Source
8
-
9
- When you don't provide an explicit source (as with the [Quickstart
10
- Guide](../README.md#quickstart-guide)), your gems will be fetched from
11
- https://rubygems.org. This default source is not set in stone. To change it, you
12
- need only edit the Gemstash configuration found at `~/.gemstash/config.yml`:
13
- ```yaml
14
- # ~/.gemstash/config.yml
15
- ---
16
- :rubygems_url: https://my.gem-source.local
17
- ```
18
-
19
- Make sure to restart your Gemstash server after changing the config:
20
- ```
21
- $ gemstash stop
22
- $ gemstash start
23
- ```
24
-
25
- Once restarted, bundling against `http://localhost:9292` will fetch gems from
26
- `https://my.gem-source.local`. If you had bundled before making these changes,
27
- fear not; bundling with a different default gem source will store gems in a
28
- separate location, ensuring different sources won't leak between each other.
29
-
30
- ## Bundling with Multiple Sources
31
-
32
- Changing the default source won't help you if you need to bundle against
33
- https://rubygems.org along with additional sources. If you need to bundle with
34
- multiple gem sources, Gemstash doesn't need to be specially configured. Your
35
- Gemstash server will honor any gem source specified via a specialized URL.
36
- Consider the following `Gemfile`:
37
- ```ruby
38
- # ./Gemfile
39
- require "cgi"
40
- source "http://localhost:9292"
41
- gem "rubywarrior"
42
-
43
- source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" do
44
- gem "my-gem"
45
- end
46
- ```
47
-
48
- Notice the `CGI.escape` call in the second source. This is important, as it
49
- properly URL escapes the source URL so Gemstash knows what gem source you want.
50
- The `/upstream` prefix tells Gemstash to use a gem source other than the default
51
- source. You can now bundle with the additional source.
52
-
53
- ## Redirecting
54
-
55
- Gemstash supports an alternate mode of specifying your gem sources. If you want
56
- Gemstash to redirect Bundler to your given gem sources, then you can specify
57
- your `Gemfile` like so:
58
- ```ruby
59
- # ./Gemfile
60
- require "cgi"
61
- source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
62
- gem "rubywarrior"
63
- ```
64
-
65
- Notice the `/redirect` prefix. This prefix tells Gemstash to redirect API calls
66
- to the provided URL. Redirected calls like this will not be cached by Gemstash,
67
- and gem files will not be stashed, even if they were previously cached or
68
- stashed from the same gem source.