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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1be39cfd739ccf1346f635fb4b341faf84567869
4
- data.tar.gz: e7b0a20c6a4438a8cb7475d93c84a098339ed2b2
3
+ metadata.gz: 6946d1680313de425978c9ebbb55f0f59211fee5
4
+ data.tar.gz: dd889e82758cc4344fdcc5a5a9c28f9467846f8c
5
5
  SHA512:
6
- metadata.gz: 85d763bfd6a440ed19d6bb43b130073cb625eb4da0076d2e09430b6c09709a5aa87218c588988dca3ffd11e771174dac4bdcf688eab59630441d6635e170eb45
7
- data.tar.gz: a26f655e2f9afc47ffdd4e9a545e8223d248a5430b94ef0dc972e926b1a3ac425bb1a7f23474b6680c4a06875a159111c269f3cdd7f88aa97ba4fb8c3ac01688
6
+ metadata.gz: 3a51c49225a13b8ec76211571e4082c6e8b4d394ffa2ce886af430c8dfa1d48b2295724de2edf46e6a0c36f3547566ab42e34ee871a8d581dbbf74b888a3a0aa
7
+ data.tar.gz: de29a8397e45cf8f22b500cffaa56b1e42c1d8ca28abc819b71f6c7adbfa7614479284ee02aa5fa1901ecc7fbcd3390326adc217f4bc3d5cc24c0fce68691059
data/README.md CHANGED
@@ -1,20 +1,19 @@
1
- # Script API Helpers (script_api_helpers)
2
-
3
- Some helpers to simplify things:
4
-
5
- * managing **files**: keep your updates with a timestamp, find the last version, encrypt/decrypt the data, shortcuts to avoid messing around with language specificities,...
6
- generate fake data: different topics, use different distributions,...
7
- * API:
8
- * custom multiple *presets* profiles,
9
- * get the highest of each flag among different custom presets
10
-
11
- To do:
12
-
13
- * more **fake data** features: link api details field, randomize your policy groups or apply a fixed distribution based on location
14
- * API:
15
- * **map** different **account properties**, such as policy groups to presets or preferences
16
- * use an assistant to map **CSV** columns to the correct account or details properties
17
- * use batch helpers that store and manage your update files and provide log errors, or use them as an example
18
- * validate tagtree tags
19
- * create configuration files for orgs you manage the **HRIS** (a weekly feed will become a one time execution script)
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.s3bucket.name
88
+ config.s3storage.bucket_name
88
89
  end
89
90
 
90
91
  def fetch_prefix
91
- config.s3bucket.prefix
92
+ config.s3storage.prefix
92
93
  end
93
94
 
94
95
  def fetch_access_key_id
95
- config.s3bucket.access_key_id || ENV['AWS_ACCESS_KEY_ID']
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.s3bucket.secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
100
+ config.s3storage.secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
100
101
  end
101
102
 
102
103
  def fetch_region
103
- config.s3bucket.region || ENV['AWS_REGION']
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 s3bucket
25
- self["s3_bucket"] ||= SessionConfig::S3Bucket.new(root: 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/s3_bucket'
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 S3Bucket < Hash
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 name=(value)
12
- self["name"] = value
11
+ def bucket_name=(value)
12
+ self["bucket_name"] = value
13
13
  end
14
14
 
15
- def name
16
- self["name"]
15
+ def bucket_name
16
+ self["bucket_name"]
17
17
  end
18
18
 
19
19
  def prefix=(value)
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
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.1
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/s3_bucket.rb
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