geminabox 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of geminabox might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.markdown +34 -2
- data/lib/geminabox.rb +17 -15
- data/lib/geminabox/disk_cache.rb +1 -1
- data/lib/geminabox/gem_list_merge.rb +6 -34
- data/lib/geminabox/gem_store.rb +1 -1
- data/lib/geminabox/gem_store_error.rb +1 -1
- data/lib/geminabox/http_adapter/http_client_adapter.rb +4 -1
- data/lib/geminabox/proxy/copier.rb +6 -1
- data/lib/geminabox/proxy/file_handler.rb +3 -3
- data/lib/geminabox/proxy/hostess.rb +1 -1
- data/lib/geminabox/rubygems_dependency.rb +3 -2
- data/lib/geminabox/server.rb +3 -3
- data/lib/geminabox/version.rb +1 -1
- data/lib/rubygems/commands/inabox_command.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29caab70af6b8cc64c9bf3ed4f0ef14fc55fdbe5
|
4
|
+
data.tar.gz: 52f389d19e17a11eaab222efeb999cc7cbd792e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c40834351d3cd2d1312c3accd677c85d86492cc8f14d1628440902c290f9ea59a46fe32452e8c346ac0a314cd04488471b9adf994f33c352a8c3fadf54de5ea
|
7
|
+
data.tar.gz: 58c88a1009a4843f64a0230ceb256aa33925f71a909405734dd62fe513776d8ae48612372f01a61cbed65989b69569e7bf51ac951f86f269496ab58dc9ce67d7
|
data/README.markdown
CHANGED
@@ -51,7 +51,7 @@ Or in config.ru (before the run command), set:
|
|
51
51
|
|
52
52
|
If you want Geminabox to carry on providing gems when rubygems.org is unavailable, add this to config.ru:
|
53
53
|
|
54
|
-
Geminabox.allow_remote_failure = true
|
54
|
+
Geminabox.allow_remote_failure = true
|
55
55
|
|
56
56
|
## HTTP adapter
|
57
57
|
|
@@ -66,7 +66,7 @@ and specify it in config.ru:
|
|
66
66
|
It is recommend (but not essential) that your adapter inherits from HttpAdapter.
|
67
67
|
The adapter will need to replace HttpAdapter's methods with those specific to
|
68
68
|
the alternative HTTP gem. It should also be able to handle HTTP proxy
|
69
|
-
settings.
|
69
|
+
settings.
|
70
70
|
|
71
71
|
Defining your own adapter also allows you to configure Geminabox to use the
|
72
72
|
local systems SSL certificates.
|
@@ -123,6 +123,38 @@ Simples!
|
|
123
123
|
Description:
|
124
124
|
Push a gem up to your GemInABox
|
125
125
|
|
126
|
+
## Docker
|
127
|
+
|
128
|
+
Using Gem in a Box is really simple with the Dockerfile. Move this Dockerfile into a directory that you want to use for your server.
|
129
|
+
|
130
|
+
That directory only needs to contain:
|
131
|
+
|
132
|
+
```
|
133
|
+
config.ru (explained above)
|
134
|
+
Gemfile
|
135
|
+
Gemfile.lock
|
136
|
+
```
|
137
|
+
|
138
|
+
Your Gemfile only needs:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
source 'https://rubygems.org'
|
142
|
+
|
143
|
+
gem 'geminabox'
|
144
|
+
```
|
145
|
+
|
146
|
+
From there
|
147
|
+
|
148
|
+
```
|
149
|
+
docker build -t geminabox .
|
150
|
+
```
|
151
|
+
|
152
|
+
```
|
153
|
+
docker run -d -p 9292:9292 geminabox:latest
|
154
|
+
```
|
155
|
+
|
156
|
+
Your server should now be running!
|
157
|
+
|
126
158
|
## Licence
|
127
159
|
|
128
160
|
Fork it, mod it, choose it, use it, make it better. All under the MIT License.
|
data/lib/geminabox.rb
CHANGED
@@ -50,7 +50,8 @@ module Geminabox
|
|
50
50
|
:lockfile,
|
51
51
|
:retry_interval,
|
52
52
|
:allow_remote_failure,
|
53
|
-
:ruby_gems_url
|
53
|
+
:ruby_gems_url,
|
54
|
+
:bundler_ruby_gems_url
|
54
55
|
)
|
55
56
|
|
56
57
|
def set_defaults(defaults)
|
@@ -70,20 +71,21 @@ module Geminabox
|
|
70
71
|
end
|
71
72
|
|
72
73
|
set_defaults(
|
73
|
-
data:
|
74
|
-
public_folder:
|
75
|
-
build_legacy:
|
76
|
-
incremental_updates:
|
77
|
-
views:
|
78
|
-
allow_replace:
|
79
|
-
gem_permissions:
|
80
|
-
rubygems_proxy:
|
81
|
-
allow_delete:
|
82
|
-
http_adapter:
|
83
|
-
lockfile:
|
84
|
-
retry_interval:
|
85
|
-
allow_remote_failure:
|
86
|
-
ruby_gems_url:
|
74
|
+
data: File.join(File.dirname(__FILE__), *%w[.. data]),
|
75
|
+
public_folder: File.join(File.dirname(__FILE__), *%w[.. public]),
|
76
|
+
build_legacy: false,
|
77
|
+
incremental_updates: true,
|
78
|
+
views: File.join(File.dirname(__FILE__), *%w[.. views]),
|
79
|
+
allow_replace: false,
|
80
|
+
gem_permissions: 0644,
|
81
|
+
rubygems_proxy: (ENV['RUBYGEMS_PROXY'] == 'true'),
|
82
|
+
allow_delete: true,
|
83
|
+
http_adapter: HttpClientAdapter.new,
|
84
|
+
lockfile: '/tmp/geminabox.lockfile',
|
85
|
+
retry_interval: 60,
|
86
|
+
allow_remote_failure: false,
|
87
|
+
ruby_gems_url: 'https://rubygems.org/',
|
88
|
+
bundler_ruby_gems_url: 'https://bundler.rubygems.org/'
|
87
89
|
)
|
88
90
|
|
89
91
|
end
|
data/lib/geminabox/disk_cache.rb
CHANGED
@@ -2,6 +2,8 @@ module Geminabox
|
|
2
2
|
class GemListMerge
|
3
3
|
attr_accessor :list
|
4
4
|
|
5
|
+
IGNORE_DEPENDENCIES = 0..-2
|
6
|
+
|
5
7
|
def self.from(*lists)
|
6
8
|
lists.map{|list| new(list)}.inject(:merge)
|
7
9
|
end
|
@@ -11,40 +13,10 @@ module Geminabox
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def merge(other)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def hash
|
20
|
-
list.each do |item|
|
21
|
-
ensure_symbols_as_keys(item)
|
22
|
-
name = item[:name].to_sym
|
23
|
-
collection[name] ||= []
|
24
|
-
collection[name] << item unless collection[name].include?(item)
|
25
|
-
end
|
26
|
-
collection
|
27
|
-
end
|
28
|
-
|
29
|
-
def collection
|
30
|
-
@collection ||= {}
|
31
|
-
end
|
32
|
-
|
33
|
-
def combine_hashes(other)
|
34
|
-
hash.merge(other.hash) do |key, value, other_value|
|
35
|
-
(value + other_value).uniq{|v| v.values[ignore_dependencies]}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def ignore_dependencies
|
40
|
-
0..-2
|
41
|
-
end
|
42
|
-
|
43
|
-
def ensure_symbols_as_keys(item)
|
44
|
-
item.keys.each do |key|
|
45
|
-
next if key.kind_of? Symbol
|
46
|
-
item[key.to_sym] = item.delete(key)
|
47
|
-
end
|
16
|
+
merged = (list + other.list)
|
17
|
+
merged.uniq! {|val| val.values[IGNORE_DEPENDENCIES] }
|
18
|
+
merged.sort_by! {|x| x.values[IGNORE_DEPENDENCIES] }
|
19
|
+
merged
|
48
20
|
end
|
49
21
|
|
50
22
|
end
|
data/lib/geminabox/gem_store.rb
CHANGED
@@ -25,7 +25,10 @@ module Geminabox
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def http_client
|
28
|
-
@http_client ||= HTTPClient.new(ENV['http_proxy'])
|
28
|
+
@http_client ||= HTTPClient.new(ENV['http_proxy']).tap {|client|
|
29
|
+
client.transparent_gzip_decompression = true
|
30
|
+
client.keep_alive_timeout = 32 # sec
|
31
|
+
}
|
29
32
|
end
|
30
33
|
|
31
34
|
end
|
@@ -21,7 +21,12 @@ module Geminabox
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def get_remote
|
24
|
-
|
24
|
+
begin
|
25
|
+
File.open(proxy_path, 'w'){|f| f.write(remote_content)}
|
26
|
+
rescue
|
27
|
+
File.unlink(proxy_path) if File.exists?(proxy_path)
|
28
|
+
raise $!
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
end
|
@@ -31,7 +31,7 @@ module Geminabox
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def file_exists?(path)
|
34
|
-
File.
|
34
|
+
File.exist? path
|
35
35
|
end
|
36
36
|
|
37
37
|
def proxy_folder_path
|
@@ -71,7 +71,7 @@ module Geminabox
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def proxy_folder_exists?
|
74
|
-
Dir.
|
74
|
+
Dir.exist?(proxy_file_folder)
|
75
75
|
end
|
76
76
|
|
77
77
|
def create_proxy_folder
|
@@ -83,7 +83,7 @@ module Geminabox
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def local_folder_exists?
|
86
|
-
Dir.
|
86
|
+
Dir.exist?(local_file_folder)
|
87
87
|
end
|
88
88
|
|
89
89
|
def create_local_folder
|
@@ -58,7 +58,7 @@ module Geminabox
|
|
58
58
|
|
59
59
|
file = File.expand_path(File.join(Server.data, *request.path_info))
|
60
60
|
|
61
|
-
unless File.
|
61
|
+
unless File.exist?(file)
|
62
62
|
ruby_gems_url = Geminabox.ruby_gems_url
|
63
63
|
path = File.join(ruby_gems_url, *request.path_info)
|
64
64
|
content = Geminabox.http_adapter.get_content(path)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
module Geminabox
|
4
5
|
module RubygemsDependency
|
@@ -13,14 +14,14 @@ module Geminabox
|
|
13
14
|
gems.map(&:to_s).join(',')
|
14
15
|
].join
|
15
16
|
body = Geminabox.http_adapter.get_content(url)
|
16
|
-
|
17
|
+
Marshal.load(body)
|
17
18
|
rescue Exception => e
|
18
19
|
return [] if Geminabox.allow_remote_failure
|
19
20
|
raise e
|
20
21
|
end
|
21
22
|
|
22
23
|
def rubygems_uri
|
23
|
-
|
24
|
+
URI.join(Geminabox.bundler_ruby_gems_url, '/api/v1/dependencies')
|
24
25
|
end
|
25
26
|
|
26
27
|
end
|
data/lib/geminabox/server.rb
CHANGED
@@ -125,7 +125,7 @@ module Geminabox
|
|
125
125
|
end
|
126
126
|
|
127
127
|
serialize_update do
|
128
|
-
File.delete file_path if File.
|
128
|
+
File.delete file_path if File.exist? file_path
|
129
129
|
self.class.reindex(:force_rebuild)
|
130
130
|
redirect url("/")
|
131
131
|
end
|
@@ -221,7 +221,7 @@ HTML
|
|
221
221
|
|
222
222
|
def all_gems_with_duplicates
|
223
223
|
specs_files_paths.map do |specs_file_path|
|
224
|
-
if File.
|
224
|
+
if File.exist?(specs_file_path)
|
225
225
|
Marshal.load(Gem.gunzip(Gem.read_binary(specs_file_path)))
|
226
226
|
else
|
227
227
|
[]
|
@@ -279,7 +279,7 @@ HTML
|
|
279
279
|
File::open(spec_file, 'r') do |unzipped_spec_file|
|
280
280
|
unzipped_spec_file.binmode
|
281
281
|
Marshal.load(Gem.inflate(unzipped_spec_file.read))
|
282
|
-
end if File.
|
282
|
+
end if File.exist? spec_file
|
283
283
|
end
|
284
284
|
|
285
285
|
def default_platform
|
data/lib/geminabox/version.rb
CHANGED
@@ -85,7 +85,7 @@ class Gem::Commands::InaboxCommand < Gem::Command
|
|
85
85
|
config = Gem.configuration.load_file(config_path).merge(:host => host)
|
86
86
|
|
87
87
|
dirname = File.dirname(config_path)
|
88
|
-
Dir.mkdir(dirname) unless File.
|
88
|
+
Dir.mkdir(dirname) unless File.exist?(dirname)
|
89
89
|
|
90
90
|
File.open(config_path, 'w') do |f|
|
91
91
|
f.write config.to_yaml
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geminabox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lea
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|