trove 0.1.0 → 0.1.1
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 +4 -0
- data/README.md +12 -3
- data/lib/trove.rb +37 -9
- data/lib/trove/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c0c10ad31a90a41e67d077eecc0798aff8db36db9224a3917282eec6f366c6
|
4
|
+
data.tar.gz: 6322af80220b7113b04769489d66f204d24e9dee0736db633dc13ffd361766d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '041901519ddfb9483e8f51744c0a77cbddad7ede8ea70cdd9e0f7fd9476615e3632914b9bd026c79a40c20cfeebe0e137539e8941073a48c6d684e6fa211c63d'
|
7
|
+
data.tar.gz: e9da6f28d950add9f6dfc109c2150e406f4fc86601ee1f3395fdbb930c4fb2b6050e18b201c6c5f200326b38c2f9b90567a8b559de31d57d49748003d220e398
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -82,7 +82,7 @@ If your production servers only need to pull files, only give them `s3:GetObject
|
|
82
82
|
|
83
83
|
Git is great for code, but it’s not ideal for large files like models. Instead, we use an object store like Amazon S3 to store and version them.
|
84
84
|
|
85
|
-
Trove creates
|
85
|
+
Trove creates a `trove` directory for you to use as a workspace. Files in this directory are ignored by Git but can be pushed and pulled from the object store. By default, files are tracked in `.trove.yml` to make it easy to deploy specific versions with code changes.
|
86
86
|
|
87
87
|
## Getting Started
|
88
88
|
|
@@ -132,7 +132,7 @@ remote: Asset precompilation completed (30.00s)
|
|
132
132
|
|
133
133
|
### Docker
|
134
134
|
|
135
|
-
|
135
|
+
Add to your `Dockerfile`:
|
136
136
|
|
137
137
|
```Dockerfile
|
138
138
|
RUN bundle exec trove pull
|
@@ -200,7 +200,7 @@ This makes it easy to perform operations from code, iRuby notebooks, and the Rai
|
|
200
200
|
|
201
201
|
## Automated Training
|
202
202
|
|
203
|
-
By default, Trove tracks files in `.trove.yml`
|
203
|
+
By default, Trove tracks files in `.trove.yml` to make it easy to deploy specific versions with code changes. However, this functionality is entirely optional. Disable it with:
|
204
204
|
|
205
205
|
```yml
|
206
206
|
vcs: false
|
@@ -208,6 +208,15 @@ vcs: false
|
|
208
208
|
|
209
209
|
This is useful if you want to automate training or build more complex workflows.
|
210
210
|
|
211
|
+
## Non-Ruby
|
212
|
+
|
213
|
+
Trove can be used in non-Ruby projects as well.
|
214
|
+
|
215
|
+
```sh
|
216
|
+
gem install trove
|
217
|
+
trove init
|
218
|
+
```
|
219
|
+
|
211
220
|
## History
|
212
221
|
|
213
222
|
View the [changelog](https://github.com/ankane/trove/blob/master/CHANGELOG.md)
|
data/lib/trove.rb
CHANGED
@@ -30,7 +30,7 @@ module Trove
|
|
30
30
|
# could use upload_file method for multipart uploads over a certain size
|
31
31
|
# but multipart uploads have extra cost and cleanup, so keep it simple for now
|
32
32
|
def push(filename)
|
33
|
-
src =
|
33
|
+
src = resolve_path(filename)
|
34
34
|
raise "File not found" unless File.exist?(src)
|
35
35
|
|
36
36
|
info = storage.info(filename)
|
@@ -89,7 +89,7 @@ module Trove
|
|
89
89
|
private
|
90
90
|
|
91
91
|
def pull_file(filename, version: nil, all: false)
|
92
|
-
dest =
|
92
|
+
dest = resolve_path(filename)
|
93
93
|
|
94
94
|
if !version
|
95
95
|
file = (config["files"] || []).find { |f| f["name"] == filename }
|
@@ -120,15 +120,36 @@ module Trove
|
|
120
120
|
Digest::MD5.file(src).hexdigest != info[:md5]
|
121
121
|
end
|
122
122
|
|
123
|
-
# TODO test file not found
|
124
123
|
def config
|
125
124
|
@config ||= begin
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
config = YAML.load_file(config_path)
|
126
|
+
raise "Empty config" unless config.is_a?(Hash)
|
127
|
+
config
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def config_path
|
132
|
+
@config_path ||= search_tree(".trove.yml")
|
133
|
+
end
|
134
|
+
|
135
|
+
def config_dir
|
136
|
+
File.dirname(config_path)
|
137
|
+
end
|
138
|
+
|
139
|
+
def search_tree(file)
|
140
|
+
path = Dir.pwd
|
141
|
+
# prevent infinite loop
|
142
|
+
20.times do
|
143
|
+
absolute_file = File.join(path, file)
|
144
|
+
return absolute_file if File.exist?(absolute_file)
|
145
|
+
path = File.dirname(path)
|
146
|
+
break if path == "/"
|
131
147
|
end
|
148
|
+
raise "Config not found"
|
149
|
+
end
|
150
|
+
|
151
|
+
def resolve_path(filename)
|
152
|
+
File.join(config_dir, root, filename)
|
132
153
|
end
|
133
154
|
|
134
155
|
def root
|
@@ -137,7 +158,14 @@ module Trove
|
|
137
158
|
|
138
159
|
def storage
|
139
160
|
@storage ||= begin
|
140
|
-
|
161
|
+
raise "Missing storage" unless config["storage"]
|
162
|
+
|
163
|
+
uri =
|
164
|
+
begin
|
165
|
+
URI.parse(config["storage"])
|
166
|
+
rescue URI::InvalidURIError => e
|
167
|
+
raise "Invalid storage"
|
168
|
+
end
|
141
169
|
|
142
170
|
case uri.scheme
|
143
171
|
when "s3"
|
data/lib/trove/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|