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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe7e58da58c18944e118fc19063e7f4c730b8d9d
4
- data.tar.gz: ed5e51504ea2fe809bbc01a6305351d9e73a6811
3
+ metadata.gz: f2451a88f1b59b66d8df49dba624068ad21ca4e6
4
+ data.tar.gz: 2f2d390c425b0aee89919a81674c594cb70f9920
5
5
  SHA512:
6
- metadata.gz: 87f204c3e9f05fc452889a42a16063553c77abe937fed20a71646e3eea3740c960ecb3949c634e181ad5709b7288664f80db7f72d9ba9e41f4fcc6c6c1097f25
7
- data.tar.gz: 305da0681b3c5b7bfd6be10534c490a7dfde10f55ac30add6cbdfd816c66f6cc49ae1c897cd42a53aa863fd4141300510e988ad28a52f99fb8c4029dc13be1ee
6
+ metadata.gz: 2d9c38f14d52a88929ec6ef2bf4079bffdd73ff72f8c3874ed14ff71d0b55635f0d8a101591a42a5aec27163da5f5efcc8397c69a75746e3501d5024921bd15f
7
+ data.tar.gz: e39d920de294e31bf55b161c9283bdd0b46910429d42a21dc4d2eb99749e1568cd8dd4ce107ea08bb6e797b7034bbc1d471d6ca584b66e872eeb14b00fe5751d
@@ -1,3 +1,14 @@
1
+ ## 1.0.3 (2016-10-15)
2
+
3
+ ### Bugfixes
4
+
5
+ - Fix JRuby build ([#110](https://github.com/bundler/gemstash/pull/110), [@smellsblue](https://github.com/smellsblue))
6
+ - Fix nil error when gems are fetched for the first time concurrently ([#111](https://github.com/bundler/gemstash/pull/111), [@smellsblue](https://github.com/smellsblue))
7
+
8
+ ### Features
9
+
10
+ - Embedded documentation via `gemstash help` ([#109](https://github.com/bundler/gemstash/pull/109), [@smellsblue](https://github.com/smellsblue))
11
+
1
12
  ## 1.0.2 (2016-07-07)
2
13
 
3
14
  ### Bugfixes
@@ -23,6 +23,29 @@ module Gemstash
23
23
  true
24
24
  end
25
25
 
26
+ def self.start(args = ARGV)
27
+ help_flags = %w(-h --help)
28
+
29
+ if args.any? {|a| help_flags.include?(a) }
30
+ super(%w(help) + args.reject {|a| help_flags.include?(a) })
31
+ else
32
+ super
33
+ end
34
+ end
35
+
36
+ def help(command = nil)
37
+ command ||= "readme"
38
+ page = manpage(command)
39
+
40
+ if page && which("man")
41
+ exec "man", page
42
+ elsif page
43
+ puts File.read("#{page}.txt")
44
+ else
45
+ super
46
+ end
47
+ end
48
+
26
49
  desc "authorize [PERMISSIONS...]", "Add authorizations to push/yank/unyank private gems"
27
50
  method_option :remove, :type => :boolean, :default => false, :desc =>
28
51
  "Remove an authorization key"
@@ -73,5 +96,28 @@ module Gemstash
73
96
  say "Gemstash version #{Gemstash::VERSION}"
74
97
  end
75
98
  map %w(-v --version) => :version
99
+
100
+ private
101
+
102
+ def manpage(command)
103
+ page = File.expand_path("../man/gemstash-#{command}", __FILE__)
104
+ return page if File.file?(page)
105
+
106
+ 1.upto(8) do |section|
107
+ page = File.expand_path("../man/gemstash-#{command}.#{section}", __FILE__)
108
+ return page if File.file?(page)
109
+ end
110
+
111
+ nil
112
+ end
113
+
114
+ def which(executable)
115
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
116
+ exe_path = File.join(path, executable)
117
+ return exe_path if File.file?(exe_path) && File.executable?(exe_path)
118
+ end
119
+
120
+ nil
121
+ end
76
122
  end
77
123
  end
@@ -143,7 +143,7 @@ module Gemstash
143
143
  def store_config
144
144
  config_dir = File.dirname(config_file)
145
145
  FileUtils.mkpath(config_dir) unless Dir.exist?(config_dir)
146
- File.write(config_file, YAML.dump(@config))
146
+ gemstash_env.atomic_write(config_file) {|f| f.write(YAML.dump(@config)) }
147
147
  end
148
148
 
149
149
  def save_metadata
@@ -1,4 +1,5 @@
1
1
  require "gemstash"
2
+ require "active_support/core_ext/file/atomic"
2
3
  require "dalli"
3
4
  require "fileutils"
4
5
  require "sequel"
@@ -98,6 +99,10 @@ module Gemstash
98
99
  File.join(base_path, path)
99
100
  end
100
101
 
102
+ def atomic_write(file, &block)
103
+ File.atomic_write(file, File.dirname(file), &block)
104
+ end
105
+
101
106
  def rackup
102
107
  File.expand_path("../config.ru", __FILE__)
103
108
  end
@@ -0,0 +1,50 @@
1
+ .\" Automatically generated by Pandoc 1.16.0.2
2
+ .\"
3
+ .TH "gemstash\-authorize" "1" "October 9, 2015" "" ""
4
+ .hy
5
+ .SH NAME
6
+ .PP
7
+ gemstash\-authorize \- Adds or removes authorization to interact with
8
+ privately stored gems
9
+ .SH SYNOPSIS
10
+ .PP
11
+ \f[C]gemstash\ authorize\ [permissions]\ [\-\-remove]\ [\-\-key\ SECURE_KEY]\ [\-\-config\-file\ FILE]\f[]
12
+ .SH DESCRIPTION
13
+ .PP
14
+ Adds or removes authorization to interact with privately stored gems.
15
+ .PP
16
+ Any arguments will be used as specific permissions.
17
+ Valid permissions include \f[C]push\f[], \f[C]yank\f[], and
18
+ \f[C]unyank\f[].
19
+ If no permissions are provided, then all permissions will be granted
20
+ (including any that may be added in future versions of Gemstash).
21
+ .SS USAGE
22
+ .IP
23
+ .nf
24
+ \f[C]
25
+ gemstash\ authorize
26
+ gemstash\ authorize\ push\ yank
27
+ gemstash\ authorize\ yank\ unyank\ \-\-key\ <secure\-key>
28
+ gemstash\ authorize\ \-\-remove\ \-\-key\ <secure\-key>
29
+ \f[]
30
+ .fi
31
+ .SH OPTIONS
32
+ .IP \[bu] 2
33
+ \f[C]\-\-config\-file\ FILE\f[]: Specify the config file to use.
34
+ If you aren\[aq]t using the default config file at
35
+ \f[C]~/.gemstash/config.yml\f[], then you must specify the config file
36
+ via this option.
37
+ .IP \[bu] 2
38
+ \f[C]\-\-key\ SECURE_KEY\f[]: Specify the API key to affect.
39
+ This should be the actual key value, not a name.
40
+ This option is required when using \f[C]\-\-remove\f[] but is optional
41
+ otherwise.
42
+ If adding an authorization, using this will either create or update the
43
+ permissions for the specified API key.
44
+ If missing, a new API key will always be generated.
45
+ Note that a key can only have a maximum length of 255 chars.
46
+ .IP \[bu] 2
47
+ \f[C]\-\-remove\f[]: Remove an authorization rather than add or update
48
+ one.
49
+ When removing, permission values are not allowed.
50
+ The \f[C]\-\-key\ <secure\-key>\f[] option is required.
@@ -0,0 +1,45 @@
1
+ gemstash-authorize(1) gemstash-authorize(1)
2
+
3
+
4
+
5
+ NAME
6
+ gemstash-authorize - Adds or removes authorization to interact with
7
+ privately stored gems
8
+
9
+ SYNOPSIS
10
+ gemstash authorize [permissions] [--remove] [--key SECURE_KEY] [--con-
11
+ fig-file FILE]
12
+
13
+ DESCRIPTION
14
+ Adds or removes authorization to interact with privately stored gems.
15
+
16
+ Any arguments will be used as specific permissions. Valid permissions
17
+ include push, yank, and unyank. If no permissions are provided, then
18
+ all permissions will be granted (including any that may be added in fu-
19
+ ture versions of Gemstash).
20
+
21
+ USAGE
22
+ gemstash authorize
23
+ gemstash authorize push yank
24
+ gemstash authorize yank unyank --key <secure-key>
25
+ gemstash authorize --remove --key <secure-key>
26
+
27
+ OPTIONS
28
+ o --config-file FILE: Specify the config file to use. If you aren't
29
+ using the default config file at ~/.gemstash/config.yml, then you
30
+ must specify the config file via this option.
31
+
32
+ o --key SECURE_KEY: Specify the API key to affect. This should be the
33
+ actual key value, not a name. This option is required when using
34
+ --remove but is optional otherwise. If adding an authorization, us-
35
+ ing this will either create or update the permissions for the speci-
36
+ fied API key. If missing, a new API key will always be generated.
37
+ Note that a key can only have a maximum length of 255 chars.
38
+
39
+ o --remove: Remove an authorization rather than add or update one.
40
+ When removing, permission values are not allowed. The --key <se-
41
+ cure-key> option is required.
42
+
43
+
44
+
45
+ October 9, 2015 gemstash-authorize(1)
@@ -0,0 +1,133 @@
1
+ .\" Automatically generated by Pandoc 1.16.0.2
2
+ .\"
3
+ .TH "gemstash\-configuration" "5" "October 13, 2015" "" ""
4
+ .hy
5
+ .SH NAME
6
+ .PP
7
+ gemstash\-configuration
8
+ .SH SYNOPSIS
9
+ .IP
10
+ .nf
11
+ \f[C]
12
+ #\ ~/.gemstash/config.yml
13
+ \-\-\-
14
+ :base_path:\ "/var/gemstash"
15
+ :cache_type:\ memcached
16
+ :memcached_servers:\ localhost:11211
17
+ :db_adapter:\ postgres
18
+ :db_url:\ postgres:///gemstash
19
+ :rubygems_url:\ https://my.gem\-source.local
20
+ :bind:\ tcp://0.0.0.0:4242
21
+ \f[]
22
+ .fi
23
+ .SH BASE PATH
24
+ .PP
25
+ \f[C]:base_path\f[]
26
+ .PP
27
+ Specifies where to store local files like the server log, cached gem
28
+ files, and the database (when using SQLite).
29
+ If the default is being used, the directory will be created if it does
30
+ not exist.
31
+ Any other directory needs to be created ahead of time and be writable to
32
+ the Gemstash server process.
33
+ Specifying the \f[C]:base_path\f[] via
34
+ \f[C]gemstash\ setup\f[] (gemstash help setup.1) will create the
35
+ directory for you.
36
+ .SS DEFAULT VALUE
37
+ .PP
38
+ \f[C]~/.gemstash\f[]
39
+ .SS VALID VALUES
40
+ .PP
41
+ Any valid path
42
+ .SH CACHE TYPE
43
+ .PP
44
+ \f[C]:cache_type\f[]
45
+ .PP
46
+ Specifies how to cache values other than gem files (such as gem
47
+ dependencies).
48
+ \f[C]memory\f[] will use an in memory cache while \f[C]memcached\f[]
49
+ will point to 1 or more Memcached servers.
50
+ Use the \f[C]:memcached_servers\f[] configuration key for specifying
51
+ where the Memcached server(s) are.
52
+ .SS DEFAULT VALUE
53
+ .PP
54
+ \f[C]memory\f[]
55
+ .SS VALID VALUES
56
+ .PP
57
+ \f[C]memory\f[], \f[C]memcached\f[]
58
+ .SH MEMCACHED SERVERS
59
+ .PP
60
+ \f[C]:memcached_servers\f[]
61
+ .PP
62
+ Specifies the Memcached servers to connect to when using
63
+ \f[C]memcached\f[] for the \f[C]:cache_type\f[].
64
+ Only used when \f[C]memcached\f[] is used for \f[C]:cache_type\f[].
65
+ .SS DEFAULT VALUE
66
+ .PP
67
+ \f[C]localhost:11211\f[]
68
+ .SS VALID VALUES
69
+ .PP
70
+ A comma delimited list of Memcached servers
71
+ .SH DB ADAPTER
72
+ .PP
73
+ \f[C]:db_adapter\f[]
74
+ .PP
75
+ Specifies what database adapter to use.
76
+ When \f[C]sqlite3\f[] is used, the database will be located at
77
+ \f[C]gemstash.db\f[] within the directory specified by
78
+ \f[C]:base_path\f[].
79
+ The database will automatically be created when using \f[C]sqlite3\f[].
80
+ When \f[C]postgres\f[] is used, the database to connect to must be
81
+ specified in the \f[C]:db_url\f[] configuration key.
82
+ The database must already be created when using \f[C]postgres\f[].
83
+ .SS DEFAULT VALUE
84
+ .PP
85
+ \f[C]sqlite3\f[]
86
+ .SS VALID VALUES
87
+ .PP
88
+ \f[C]sqlite3\f[], \f[C]postgres\f[]
89
+ .SH DB URL
90
+ .PP
91
+ \f[C]:db_url\f[]
92
+ .PP
93
+ Specifies the database to connect to when using \f[C]postgres\f[] for
94
+ the \f[C]:db_adapter\f[].
95
+ Only used when \f[C]postgres\f[] is used for \f[C]:db_adapter\f[].
96
+ .SS DEFAULT VALUE
97
+ .PP
98
+ None
99
+ .SS VALID VALUES
100
+ .PP
101
+ A valid database URL for the Sequel gem (http://sequel.jeremyevans.net/)
102
+ .SH RUBYGEMS URL
103
+ .PP
104
+ \f[C]:rubygems_url\f[]
105
+ .PP
106
+ Specifies the default gem source URL.
107
+ When any API endpoint is called without a \f[C]/private\f[] or
108
+ \f[C]/upstream/<url>\f[] prefix, this URL will be used to fetch the
109
+ result.
110
+ This value can be safely changed even if there are already gems stashed
111
+ for the previous value.
112
+ .SS DEFAULT VALUE
113
+ .PP
114
+ \f[C]https://rubygems.org\f[]
115
+ .SS VALID VALUES
116
+ .PP
117
+ A valid gem source URL
118
+ .SH BIND ADDRESS
119
+ .PP
120
+ \f[C]:bind\f[]
121
+ .PP
122
+ Specifies the binding used to start the Gemstash server.
123
+ Keep in mind the user starting Gemstash needs to have access to bind in
124
+ this manner.
125
+ For example, if you use a port below 1024, you will need to run Gemstash
126
+ as the root user.
127
+ .SS DEFAULT VALUE
128
+ .PP
129
+ \f[C]tcp://0.0.0.0:9292\f[]
130
+ .SS VALID VALUES
131
+ .PP
132
+ Any valid binding that is supported by
133
+ Puma (https://github.com/puma/puma#binding-tcp--sockets)
@@ -0,0 +1,121 @@
1
+ gemstash-configuration(5) gemstash-configuration(5)
2
+
3
+
4
+
5
+ NAME
6
+ gemstash-configuration
7
+
8
+ SYNOPSIS
9
+ # ~/.gemstash/config.yml
10
+ ---
11
+ :base_path: "/var/gemstash"
12
+ :cache_type: memcached
13
+ :memcached_servers: localhost:11211
14
+ :db_adapter: postgres
15
+ :db_url: postgres:///gemstash
16
+ :rubygems_url: https://my.gem-source.local
17
+ :bind: tcp://0.0.0.0:4242
18
+
19
+ BASE PATH
20
+ :base_path
21
+
22
+ Specifies where to store local files like the server log, cached gem
23
+ files, and the database (when using SQLite). If the default is being
24
+ used, the directory will be created if it does not exist. Any other
25
+ directory needs to be created ahead of time and be writable to the Gem-
26
+ stash server process. Specifying the :base_path via gemstash setup
27
+ (gemstash help setup.1) will create the directory for you.
28
+
29
+ DEFAULT VALUE
30
+ ~/.gemstash
31
+
32
+ VALID VALUES
33
+ Any valid path
34
+
35
+ CACHE TYPE
36
+ :cache_type
37
+
38
+ Specifies how to cache values other than gem files (such as gem depen-
39
+ dencies). memory will use an in memory cache while memcached will
40
+ point to 1 or more Memcached servers. Use the :memcached_servers con-
41
+ figuration key for specifying where the Memcached server(s) are.
42
+
43
+ DEFAULT VALUE
44
+ memory
45
+
46
+ VALID VALUES
47
+ memory, memcached
48
+
49
+ MEMCACHED SERVERS
50
+ :memcached_servers
51
+
52
+ Specifies the Memcached servers to connect to when using memcached for
53
+ the :cache_type. Only used when memcached is used for :cache_type.
54
+
55
+ DEFAULT VALUE
56
+ localhost:11211
57
+
58
+ VALID VALUES
59
+ A comma delimited list of Memcached servers
60
+
61
+ DB ADAPTER
62
+ :db_adapter
63
+
64
+ Specifies what database adapter to use. When sqlite3 is used, the
65
+ database will be located at gemstash.db within the directory specified
66
+ by :base_path. The database will automatically be created when using
67
+ sqlite3. When postgres is used, the database to connect to must be
68
+ specified in the :db_url configuration key. The database must already
69
+ be created when using postgres.
70
+
71
+ DEFAULT VALUE
72
+ sqlite3
73
+
74
+ VALID VALUES
75
+ sqlite3, postgres
76
+
77
+ DB URL
78
+ :db_url
79
+
80
+ Specifies the database to connect to when using postgres for the
81
+ :db_adapter. Only used when postgres is used for :db_adapter.
82
+
83
+ DEFAULT VALUE
84
+ None
85
+
86
+ VALID VALUES
87
+ A valid database URL for the Sequel gem (http://sequel.jeremye-
88
+ vans.net/)
89
+
90
+ RUBYGEMS URL
91
+ :rubygems_url
92
+
93
+ Specifies the default gem source URL. When any API endpoint is called
94
+ without a /private or /upstream/<url> prefix, this URL will be used to
95
+ fetch the result. This value can be safely changed even if there are
96
+ already gems stashed for the previous value.
97
+
98
+ DEFAULT VALUE
99
+ https://rubygems.org
100
+
101
+ VALID VALUES
102
+ A valid gem source URL
103
+
104
+ BIND ADDRESS
105
+ :bind
106
+
107
+ Specifies the binding used to start the Gemstash server. Keep in mind
108
+ the user starting Gemstash needs to have access to bind in this manner.
109
+ For example, if you use a port below 1024, you will need to run Gem-
110
+ stash as the root user.
111
+
112
+ DEFAULT VALUE
113
+ tcp://0.0.0.0:9292
114
+
115
+ VALID VALUES
116
+ Any valid binding that is supported by Puma
117
+ (https://github.com/puma/puma#binding-tcp--sockets)
118
+
119
+
120
+
121
+ October 13, 2015 gemstash-configuration(5)