eco-helpers 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -20
- data/lib/eco/api/common/session/s3_uploader.rb +6 -5
- data/lib/eco/api/session_config.rb +11 -3
- data/lib/eco/api/session_config/{s3_bucket.rb → s3_storage.rb} +5 -5
- data/lib/eco/version.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: 6946d1680313de425978c9ebbb55f0f59211fee5
|
4
|
+
data.tar.gz: dd889e82758cc4344fdcc5a5a9c28f9467846f8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a51c49225a13b8ec76211571e4082c6e8b4d394ffa2ce886af430c8dfa1d48b2295724de2edf46e6a0c36f3547566ab42e34ee871a8d581dbbf74b888a3a0aa
|
7
|
+
data.tar.gz: de29a8397e45cf8f22b500cffaa56b1e42c1d8ca28abc819b71f6c7adbfa7614479284ee02aa5fa1901ecc7fbcd3390326adc217f4bc3d5cc24c0fce68691059
|
data/README.md
CHANGED
@@ -1,20 +1,19 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
Some helpers to
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
* create **unit tests** to check if the API behaviour meets the specifications and launch them periodically
|
1
|
+
# API Helpers (eco-helpers)
|
2
|
+
|
3
|
+
Some helpers to define a framework of use cases.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'eco-helpers'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install eco-helpers
|
@@ -31,6 +31,7 @@ module Eco
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def upload_directory(path)
|
34
|
+
path = File.expand_path(path)
|
34
35
|
prefix = File.expand_path(File.join(path, ".."))
|
35
36
|
Dir.glob(File.join(path, "**/*")).sort.map do |file|
|
36
37
|
next unless File.file?(file) # Skip directories
|
@@ -84,23 +85,23 @@ module Eco
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def fetch_bucket
|
87
|
-
config.
|
88
|
+
config.s3storage.bucket_name
|
88
89
|
end
|
89
90
|
|
90
91
|
def fetch_prefix
|
91
|
-
config.
|
92
|
+
config.s3storage.prefix
|
92
93
|
end
|
93
94
|
|
94
95
|
def fetch_access_key_id
|
95
|
-
config.
|
96
|
+
config.s3storage.access_key_id || ENV['AWS_ACCESS_KEY_ID']
|
96
97
|
end
|
97
98
|
|
98
99
|
def fetch_secret_access_key
|
99
|
-
config.
|
100
|
+
config.s3storage.secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
|
100
101
|
end
|
101
102
|
|
102
103
|
def fetch_region
|
103
|
-
config.
|
104
|
+
config.s3storage.region || ENV['AWS_REGION']
|
104
105
|
end
|
105
106
|
|
106
107
|
end
|
@@ -21,8 +21,8 @@ module Eco
|
|
21
21
|
self["logger"] ||= SessionConfig::Logger.new(root: self)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
self["
|
24
|
+
def s3storage
|
25
|
+
self["s3_storage"] ||= SessionConfig::S3Storage.new(root: self)
|
26
26
|
end
|
27
27
|
|
28
28
|
def files
|
@@ -67,6 +67,14 @@ module Eco
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# API
|
70
|
+
def dry_run!
|
71
|
+
self["dry-run"] = true
|
72
|
+
end
|
73
|
+
|
74
|
+
def dry_run?
|
75
|
+
self["dry-run"]
|
76
|
+
end
|
77
|
+
|
70
78
|
def run_mode=(mode)
|
71
79
|
apis.active_api.mode = mode
|
72
80
|
end
|
@@ -173,7 +181,7 @@ require_relative 'session_config/api'
|
|
173
181
|
require_relative 'session_config/apis'
|
174
182
|
require_relative 'session_config/logger'
|
175
183
|
require_relative 'session_config/mailer'
|
176
|
-
require_relative 'session_config/
|
184
|
+
require_relative 'session_config/s3_storage'
|
177
185
|
require_relative 'session_config/files'
|
178
186
|
require_relative 'session_config/people'
|
179
187
|
require_relative 'session_config/use_cases'
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module Eco
|
2
2
|
module API
|
3
3
|
class SessionConfig
|
4
|
-
class
|
4
|
+
class S3Storage < Hash
|
5
5
|
|
6
6
|
def initialize(root:)
|
7
7
|
super(nil)
|
8
8
|
@root = root
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
self["
|
11
|
+
def bucket_name=(value)
|
12
|
+
self["bucket_name"] = value
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
self["
|
15
|
+
def bucket_name
|
16
|
+
self["bucket_name"]
|
17
17
|
end
|
18
18
|
|
19
19
|
def prefix=(value)
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -233,7 +233,7 @@ files:
|
|
233
233
|
- lib/eco/api/session_config/logger.rb
|
234
234
|
- lib/eco/api/session_config/mailer.rb
|
235
235
|
- lib/eco/api/session_config/people.rb
|
236
|
-
- lib/eco/api/session_config/
|
236
|
+
- lib/eco/api/session_config/s3_storage.rb
|
237
237
|
- lib/eco/api/session_config/use_cases.rb
|
238
238
|
- lib/eco/api/usecases.rb
|
239
239
|
- lib/eco/api/usecases/base_case.rb
|