trove 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a501c7fded530b2dc537d412eae735c19cfa25f04e2e21dd8d6861ae42b2a271
4
- data.tar.gz: 0cf407da8dce52a446e053a7e03791622ecd303a6514bdf551ce12bd31ebe788
3
+ metadata.gz: c2c0c10ad31a90a41e67d077eecc0798aff8db36db9224a3917282eec6f366c6
4
+ data.tar.gz: 6322af80220b7113b04769489d66f204d24e9dee0736db633dc13ffd361766d7
5
5
  SHA512:
6
- metadata.gz: 4ad4fa70071eb4745046938a9b042b7df87eaa85964bc4d9a71fa90837335e40d8195f9de7ea27d70963c83a4facd163a1542527f7f88a5ffeb6aec8b4b71649
7
- data.tar.gz: 73b4037bf7a50b498ef6d6bb640f2d62e237c7a1effba0aa298c9a54cf8d56edbd6efd539bdfc0768e1e6e1c85d3e8d2f524c60f5b996469881b6d67a66f9d1d
6
+ metadata.gz: '041901519ddfb9483e8f51744c0a77cbddad7ede8ea70cdd9e0f7fd9476615e3632914b9bd026c79a40c20cfeebe0e137539e8941073a48c6d684e6fa211c63d'
7
+ data.tar.gz: e9da6f28d950add9f6dfc109c2150e406f4fc86601ee1f3395fdbb930c4fb2b6050e18b201c6c5f200326b38c2f9b90567a8b559de31d57d49748003d220e398
@@ -1,3 +1,7 @@
1
+ ## 0.1.1 (2020-12-04)
2
+
3
+ - Added support for running in subdirectories
4
+
1
5
  ## 0.1.0 (2020-10-30)
2
6
 
3
7
  - First release
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 an `trove` directory for you to use as a workspace. Files in the 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.
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
- And add to your `Dockerfile`:
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` so you can deploy specific versions with `trove pull`. However, this functionality is entirely optional. Disable it with:
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)
@@ -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 = File.join(root, filename)
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 = File.join(root, filename)
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
- begin
127
- YAML.load_file(".trove.yml")
128
- rescue Errno::ENOENT
129
- raise "Config not found"
130
- end
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
- uri = URI.parse(config["storage"])
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"
@@ -1,3 +1,3 @@
1
1
  module Trove
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-10-31 00:00:00.000000000 Z
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