gemstash 1.0.0.pre.3 → 1.0.0.pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/gemstash/db.rb +2 -0
- data/lib/gemstash/db/cached_rubygem.rb +17 -0
- data/lib/gemstash/db/upstream.rb +12 -0
- data/lib/gemstash/gem_source/upstream_source.rb +9 -1
- data/lib/gemstash/migrations/03_cached_gems.rb +24 -0
- data/lib/gemstash/storage.rb +13 -2
- data/lib/gemstash/version.rb +1 -1
- data/rake/changelog.citrus +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5a0e21d8484a3788102eb3c17efe992b484f407
|
4
|
+
data.tar.gz: e076bb584f76301f806c8479f1e27d18b5853443
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1339519304f001e2f9ec394d56dd4826ab9775982f45e804eb8b3e028d50a0efd5c3abf8bbb046291c0dc4ea6463b7b08d7adbe3d64935359f9dec3aa9db39
|
7
|
+
data.tar.gz: 9672f47d249e673d79eb76cc0b943fd13497dba969ad363712c608ace051add7feaddab442554cafa11bd2cf4af4cacfb0b5a3ef9ed39d0b346a7185b9328e7d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## 1.0.0.pre.4 (2015-12-23)
|
2
|
+
|
3
|
+
### Upgrade Notes
|
4
|
+
|
5
|
+
Any gems fetched before this release won't be indexed, which means plugins you
|
6
|
+
might install can't know about them. These cached gems might also have
|
7
|
+
incorrect headers stored (which shouldn't affect bundling). If you wish to
|
8
|
+
correct this, you can delete or back up your cache by deleting or moving your
|
9
|
+
`~/.gemstash/gem_cache` directory.
|
10
|
+
|
11
|
+
### Bugfixes
|
12
|
+
|
13
|
+
- Cached gem and spec headers don't clobber each other ([#68](https://github.com/bundler/gemstash/pull/68), [@smellsblue](https://github.com/smellsblue))
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
- Index cached gems and their upstreams for future use of plugins ([#68](https://github.com/bundler/gemstash/pull/68), [@smellsblue](https://github.com/smellsblue))
|
18
|
+
|
1
19
|
## 1.0.0.pre.3 (2015-12-21)
|
2
20
|
|
3
21
|
### Bugfixes
|
data/lib/gemstash/db.rb
CHANGED
@@ -8,8 +8,10 @@ module Gemstash
|
|
8
8
|
Sequel::Model.raise_on_save_failure = true
|
9
9
|
Sequel::Model.plugin :timestamps, update_on_create: true
|
10
10
|
autoload :Authorization, "gemstash/db/authorization"
|
11
|
+
autoload :CachedRubygem, "gemstash/db/cached_rubygem"
|
11
12
|
autoload :Dependency, "gemstash/db/dependency"
|
12
13
|
autoload :Rubygem, "gemstash/db/rubygem"
|
14
|
+
autoload :Upstream, "gemstash/db/upstream"
|
13
15
|
autoload :Version, "gemstash/db/version"
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "gemstash"
|
2
|
+
|
3
|
+
module Gemstash
|
4
|
+
module DB
|
5
|
+
# Sequel model for cached_rubygems table.
|
6
|
+
class CachedRubygem < Sequel::Model
|
7
|
+
def self.store(upstream, gem_name, resource_type)
|
8
|
+
db.transaction do
|
9
|
+
upstream_id = Gemstash::DB::Upstream.find_or_insert(upstream)
|
10
|
+
record = self[upstream_id: upstream_id, name: gem_name.name, resource_type: resource_type.to_s]
|
11
|
+
return record.id if record
|
12
|
+
new(upstream_id: upstream_id, name: gem_name.name, resource_type: resource_type.to_s).tap(&:save).id
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Gemstash
|
2
|
+
module DB
|
3
|
+
# Sequel model for upstreams table.
|
4
|
+
class Upstream < Sequel::Model
|
5
|
+
def self.find_or_insert(upstream)
|
6
|
+
record = self[uri: upstream.to_s]
|
7
|
+
return record.id if record
|
8
|
+
new(uri: upstream.to_s, host_id: upstream.host_id).tap(&:save).id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -160,7 +160,15 @@ module Gemstash
|
|
160
160
|
def fetch_remote_gem(gem_name, gem_resource, resource_type)
|
161
161
|
log.info "Gem #{gem_name.name} is not cached, fetching #{resource_type}"
|
162
162
|
gem_fetcher.fetch(gem_name.id, resource_type) do |content, properties|
|
163
|
-
|
163
|
+
resource_properties = {
|
164
|
+
upstream: upstream.to_s,
|
165
|
+
gem_name: gem_name.name,
|
166
|
+
headers: { resource_type => properties }
|
167
|
+
}
|
168
|
+
|
169
|
+
gem = gem_resource.save({ resource_type => content }, resource_properties)
|
170
|
+
Gemstash::DB::CachedRubygem.store(upstream, gem_name, resource_type)
|
171
|
+
gem
|
164
172
|
end
|
165
173
|
end
|
166
174
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
change do
|
3
|
+
create_table :upstreams do
|
4
|
+
primary_key :id
|
5
|
+
String :uri, size: 191, null: false
|
6
|
+
String :host_id, size: 191, null: false
|
7
|
+
DateTime :created_at, null: false
|
8
|
+
DateTime :updated_at, null: false
|
9
|
+
index [:uri], unique: true
|
10
|
+
index [:host_id], unique: true
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table :cached_rubygems do
|
14
|
+
primary_key :id
|
15
|
+
Integer :upstream_id, null: false
|
16
|
+
String :name, size: 191, null: false
|
17
|
+
String :resource_type, size: 191, null: false
|
18
|
+
DateTime :created_at, null: false
|
19
|
+
DateTime :updated_at, null: false
|
20
|
+
index [:upstream_id, :resource_type, :name], unique: true
|
21
|
+
index [:name]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/gemstash/storage.rb
CHANGED
@@ -139,7 +139,7 @@ module Gemstash
|
|
139
139
|
#
|
140
140
|
# Separate calls to save for the same resource will replace existing files,
|
141
141
|
# and add new ones. Properties on additional calls will be merged with
|
142
|
-
# existing properties.
|
142
|
+
# existing properties. Nested hashes in properties will also be merged.
|
143
143
|
#
|
144
144
|
# Examples:
|
145
145
|
#
|
@@ -181,12 +181,23 @@ module Gemstash
|
|
181
181
|
end
|
182
182
|
|
183
183
|
# Update the metadata properties of this resource. The +props+ will be
|
184
|
-
# merged with any existing properties.
|
184
|
+
# merged with any existing properties. Nested hashes in the properties will
|
185
|
+
# also be merged.
|
185
186
|
#
|
186
187
|
# @param props [Hash] the properties to add
|
187
188
|
# @return [Gemstash::Resource] self for chaining purposes
|
188
189
|
def update_properties(props)
|
189
190
|
load_properties(true)
|
191
|
+
|
192
|
+
deep_merge = proc do |_, old_value, new_value|
|
193
|
+
if old_value.is_a?(Hash) && new_value.is_a?(Hash)
|
194
|
+
old_value.merge(new_value, &deep_merge)
|
195
|
+
else
|
196
|
+
new_value
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
props = properties.merge(props || {}, &deep_merge)
|
190
201
|
save_properties(properties.merge(props || {}))
|
191
202
|
self
|
192
203
|
end
|
data/lib/gemstash/version.rb
CHANGED
data/rake/changelog.citrus
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemstash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Arko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dalli
|
@@ -283,8 +283,10 @@ files:
|
|
283
283
|
- lib/gemstash/configuration.rb
|
284
284
|
- lib/gemstash/db.rb
|
285
285
|
- lib/gemstash/db/authorization.rb
|
286
|
+
- lib/gemstash/db/cached_rubygem.rb
|
286
287
|
- lib/gemstash/db/dependency.rb
|
287
288
|
- lib/gemstash/db/rubygem.rb
|
289
|
+
- lib/gemstash/db/upstream.rb
|
288
290
|
- lib/gemstash/db/version.rb
|
289
291
|
- lib/gemstash/dependencies.rb
|
290
292
|
- lib/gemstash/env.rb
|
@@ -301,6 +303,7 @@ files:
|
|
301
303
|
- lib/gemstash/logging.rb
|
302
304
|
- lib/gemstash/migrations/01_gem_dependencies.rb
|
303
305
|
- lib/gemstash/migrations/02_authorizations.rb
|
306
|
+
- lib/gemstash/migrations/03_cached_gems.rb
|
304
307
|
- lib/gemstash/puma.rb
|
305
308
|
- lib/gemstash/rack_env_rewriter.rb
|
306
309
|
- lib/gemstash/specs_builder.rb
|
@@ -331,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
334
|
version: 1.3.1
|
332
335
|
requirements: []
|
333
336
|
rubyforge_project:
|
334
|
-
rubygems_version: 2.4.
|
337
|
+
rubygems_version: 2.4.6
|
335
338
|
signing_key:
|
336
339
|
specification_version: 4
|
337
340
|
summary: A place to stash gems you'll need
|