s3_config 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/lib/s3_config/application.rb +11 -3
- data/lib/s3_config/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 778a5e7ca679476ec5d9e4c753a314899e8684ac
|
4
|
+
data.tar.gz: e968f60a39d9eb5f412ae2a2e4b5896e1911d2f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 859819057c87ff3a9eed95caf7d1d1c1e4b975a78aa27fef3cbb0a843970bbc75364d554418985588113be2d31f2e683e09378a2be43b2d5a96daf3a577e6cf0
|
7
|
+
data.tar.gz: cc510e7933bc6858bcb855f544864d3a9a685c28cadb4e52a1c7c006ab57617ae5229a178d446b190a5c70da8a906fd922907f5c4d32ec65833d6854b3cc299e
|
@@ -51,8 +51,12 @@ module S3Config
|
|
51
51
|
!client.nil? and !bucket.nil?
|
52
52
|
end
|
53
53
|
|
54
|
+
def versions_count
|
55
|
+
bucket.objects({prefix: "#{environment}/"}).count
|
56
|
+
end
|
57
|
+
|
54
58
|
def latest_version
|
55
|
-
[
|
59
|
+
[versions_count - 1, 0].max
|
56
60
|
end
|
57
61
|
|
58
62
|
def read(key)
|
@@ -61,7 +65,11 @@ module S3Config
|
|
61
65
|
end
|
62
66
|
|
63
67
|
def write(key, value)
|
64
|
-
|
68
|
+
begin
|
69
|
+
config = read_configuration
|
70
|
+
rescue ConfigNotDefinedError
|
71
|
+
config = {}
|
72
|
+
end
|
65
73
|
unless config[key] == value
|
66
74
|
config[key] = value
|
67
75
|
write_configuration config
|
@@ -110,7 +118,7 @@ module S3Config
|
|
110
118
|
end
|
111
119
|
|
112
120
|
def write_configuration(config)
|
113
|
-
if e = environment and next_version =
|
121
|
+
if e = environment and next_version = versions_count
|
114
122
|
serialized_config = YAML.dump(config)
|
115
123
|
bucket.put_object({
|
116
124
|
body: serialized_config,
|
data/lib/s3_config/version.rb
CHANGED