pansophy 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pansophy.rb +1 -0
- data/lib/pansophy/config_synchronizer.rb +57 -0
- data/lib/pansophy/tasks.rb +9 -0
- data/lib/pansophy/version.rb +1 -1
- data/pansophy.gemspec +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdebda6b160a82a6835ec062189d36862fe01d42
|
4
|
+
data.tar.gz: aec932b36284a3f205991c4f628b420909d292f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4284eac32c6a539a641d37cc883e35e4f8cbbd5c625fb8a853445bafb1b50b346b70f89d827ed99515969f318e88e2d8d5f99ef80806172586135cd67d25a2b
|
7
|
+
data.tar.gz: c015c8e205e53dbf39bdec273c08a326c4d24684da5b556bb09260d6c89d6154b8900b24d777db181d00bf8c7100725908824fa888e4a1306eb9a7f1f6638a8c
|
data/lib/pansophy.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'pansophy'
|
2
|
+
require 'facets/kernel/blank'
|
3
|
+
|
4
|
+
module Pansophy
|
5
|
+
class ConfigSynchronizer
|
6
|
+
attr_accessor :config_bucket_name, :config_remote_folder, :config_local_folder, :version
|
7
|
+
|
8
|
+
def merge
|
9
|
+
puts "Fetching remote configuration (version #{VERSION})"
|
10
|
+
verify_config_bucket_name!
|
11
|
+
Pansophy.merge(config_bucket_name, remote_path, local_path, overwrite: true)
|
12
|
+
puts 'done'
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def config_bucket_name
|
18
|
+
@config_bucket_name ||= ENV['CONFIG_BUCKET_NAME']
|
19
|
+
end
|
20
|
+
|
21
|
+
def config_remote_folder
|
22
|
+
@config_remote_folder ||= (ENV['CONFIG_REMOTE_FOLDER'] || 'config')
|
23
|
+
end
|
24
|
+
|
25
|
+
def config_local_folder
|
26
|
+
@config_local_folder ||= (ENV['CONFIG_LOCAL_FOLDER'] || ConfigPath.find!)
|
27
|
+
end
|
28
|
+
|
29
|
+
def version
|
30
|
+
@version ||= (ENV['CONFIG_VERSION'] || '1.0')
|
31
|
+
end
|
32
|
+
|
33
|
+
def remote_path
|
34
|
+
Pathname.new(config_remote_folder).join(version.to_s).to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
def local_path
|
38
|
+
config_local_folder.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def verify_config_bucket_name!
|
42
|
+
return unless config_bucket_name.blank?
|
43
|
+
fail ConfigSynchronizerError, 'CONFIG_BUCKET_NAME is undefined'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class ConfigPath
|
48
|
+
def self.find!
|
49
|
+
# TODO: Extract this in a Rails specific gem
|
50
|
+
return Rails.root.join('config') if defined?(Rails)
|
51
|
+
fail ConfigSynchronizerError, 'Could not determine location of config folder'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class ConfigSynchronizerError < StandardError
|
56
|
+
end
|
57
|
+
end
|
data/lib/pansophy/version.rb
CHANGED
data/pansophy.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pansophy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Berardi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: facets
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +185,7 @@ files:
|
|
171
185
|
- bin/console
|
172
186
|
- bin/setup
|
173
187
|
- lib/pansophy.rb
|
188
|
+
- lib/pansophy/config_synchronizer.rb
|
174
189
|
- lib/pansophy/connection.rb
|
175
190
|
- lib/pansophy/helpers.rb
|
176
191
|
- lib/pansophy/helpers/path_builder.rb
|
@@ -185,6 +200,7 @@ files:
|
|
185
200
|
- lib/pansophy/remote/read_directory.rb
|
186
201
|
- lib/pansophy/remote/read_file.rb
|
187
202
|
- lib/pansophy/synchronizer.rb
|
203
|
+
- lib/pansophy/tasks.rb
|
188
204
|
- lib/pansophy/version.rb
|
189
205
|
- pansophy.gemspec
|
190
206
|
homepage: https://github.com/sealink/pansophy
|