selbackup 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10947b2fe0ea712db590c2700b927473c301b610
4
- data.tar.gz: aa319c2e8e037a72aad2d92bf02faf8c354036ab
3
+ metadata.gz: 0e97a05412606c92716087d77426072ab2591c8e
4
+ data.tar.gz: 580c016bc80a67ddc8c32b95c72202672e85928f
5
5
  SHA512:
6
- metadata.gz: 5399ac1a5e8937ed1c9b9ffdbf977bf9f610171589c319a8940203fa371bfe74860197b01679a8191fdc5636e5c653bd4e3fe3971ed7e0ee79dd8b69b4458c37
7
- data.tar.gz: 055d5e4d7878d2a4632646a0253d94e433a8a641d56c08cfc2471a455895fed38ae4ec019d62608b1950212588857295f5319bd6d8e66fdf27eefa3c37f840dd
6
+ metadata.gz: efd1f00ac92cc3b6e1215671a817c51167e2a3f66b63720ae3a9e32aa8a4e0068ad2be42f6662ae69dd51e4f78c26e12a1ab942863b19463af0205eec5d905f8
7
+ data.tar.gz: 826194d398fb2b4fa36c387fa8efa7301c7f221c9907e393123a6248115de4213984c51f89602a5cc59fd9034864c257c13541f5f6d01d03eb9aa73ae897ffcc
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- CFPropertyList (2.3.1)
5
- activesupport (4.2.4)
4
+ CFPropertyList (2.3.4)
5
+ activesupport (4.2.7.1)
6
6
  i18n (~> 0.7)
7
7
  json (~> 1.7, >= 1.7.7)
8
8
  minitest (~> 5.1)
@@ -10,21 +10,25 @@ GEM
10
10
  tzinfo (~> 1.1)
11
11
  builder (3.2.2)
12
12
  diff-lcs (1.2.5)
13
- excon (0.45.4)
13
+ excon (0.54.0)
14
14
  fission (0.5.0)
15
15
  CFPropertyList (~> 2.2)
16
- fog (1.34.0)
16
+ fog (1.38.0)
17
+ fog-aliyun (>= 0.1.0)
17
18
  fog-atmos
18
19
  fog-aws (>= 0.6.0)
19
20
  fog-brightbox (~> 0.4)
21
+ fog-cloudatcost (~> 0.1.0)
20
22
  fog-core (~> 1.32)
21
23
  fog-dynect (~> 0.0.2)
22
24
  fog-ecloud (~> 0.1)
23
- fog-google (>= 0.0.2)
25
+ fog-google (<= 0.1.0)
24
26
  fog-json
25
27
  fog-local
28
+ fog-openstack
26
29
  fog-powerdns (>= 0.1.1)
27
30
  fog-profitbricks
31
+ fog-rackspace
28
32
  fog-radosgw (>= 0.0.2)
29
33
  fog-riakcs
30
34
  fog-sakuracloud (>= 0.0.4)
@@ -34,53 +38,69 @@ GEM
34
38
  fog-terremark
35
39
  fog-vmfusion
36
40
  fog-voxel
41
+ fog-vsphere (>= 0.4.0)
42
+ fog-xenserver
37
43
  fog-xml (~> 0.1.1)
38
44
  ipaddress (~> 0.5)
39
- nokogiri (~> 1.5, >= 1.5.11)
45
+ fog-aliyun (0.1.0)
46
+ fog-core (~> 1.27)
47
+ fog-json (~> 1.0)
48
+ ipaddress (~> 0.8)
49
+ xml-simple (~> 1.1)
40
50
  fog-atmos (0.1.0)
41
51
  fog-core
42
52
  fog-xml
43
- fog-aws (0.7.6)
44
- fog-core (~> 1.27)
53
+ fog-aws (0.13.0)
54
+ fog-core (~> 1.38)
45
55
  fog-json (~> 1.0)
46
56
  fog-xml (~> 0.1)
47
57
  ipaddress (~> 0.8)
48
- fog-brightbox (0.9.0)
58
+ fog-brightbox (0.11.0)
49
59
  fog-core (~> 1.22)
50
60
  fog-json
51
61
  inflecto (~> 0.0.2)
52
- fog-core (1.32.1)
62
+ fog-cloudatcost (0.1.2)
63
+ fog-core (~> 1.36)
64
+ fog-json (~> 1.0)
65
+ fog-xml (~> 0.1)
66
+ ipaddress (~> 0.8)
67
+ fog-core (1.43.0)
53
68
  builder
54
- excon (~> 0.45)
69
+ excon (~> 0.49)
55
70
  formatador (~> 0.2)
56
- mime-types
57
- net-scp (~> 1.1)
58
- net-ssh (>= 2.1.3)
59
- fog-dynect (0.0.2)
71
+ fog-dynect (0.0.3)
60
72
  fog-core
61
73
  fog-json
62
74
  fog-xml
63
75
  fog-ecloud (0.3.0)
64
76
  fog-core
65
77
  fog-xml
66
- fog-google (0.0.7)
78
+ fog-google (0.1.0)
67
79
  fog-core
68
80
  fog-json
69
81
  fog-xml
70
82
  fog-json (1.0.2)
71
83
  fog-core (~> 1.0)
72
84
  multi_json (~> 1.10)
73
- fog-local (0.2.1)
85
+ fog-local (0.3.1)
74
86
  fog-core (~> 1.27)
87
+ fog-openstack (0.1.18)
88
+ fog-core (>= 1.40)
89
+ fog-json (>= 1.0)
90
+ ipaddress (>= 0.8)
75
91
  fog-powerdns (0.1.1)
76
92
  fog-core (~> 1.27)
77
93
  fog-json (~> 1.0)
78
94
  fog-xml (~> 0.1)
79
- fog-profitbricks (0.0.5)
80
- fog-core
81
- fog-xml
82
- nokogiri
83
- fog-radosgw (0.0.4)
95
+ fog-profitbricks (3.0.0)
96
+ fog-core (~> 1.42)
97
+ fog-json (~> 1.0)
98
+ fog-rackspace (0.1.2)
99
+ fog-core (>= 1.35)
100
+ fog-json (>= 1.0)
101
+ fog-xml (>= 0.1)
102
+ ipaddress (>= 0.8)
103
+ fog-radosgw (0.0.5)
84
104
  fog-core (>= 1.21.0)
85
105
  fog-json
86
106
  fog-xml (>= 0.0.1)
@@ -88,13 +108,13 @@ GEM
88
108
  fog-core
89
109
  fog-json
90
110
  fog-xml
91
- fog-sakuracloud (1.1.1)
111
+ fog-sakuracloud (1.7.5)
92
112
  fog-core
93
113
  fog-json
94
114
  fog-serverlove (0.1.2)
95
115
  fog-core
96
116
  fog-json
97
- fog-softlayer (0.4.7)
117
+ fog-softlayer (1.1.4)
98
118
  fog-core
99
119
  fog-json
100
120
  fog-storm_on_demand (0.1.1)
@@ -109,40 +129,49 @@ GEM
109
129
  fog-voxel (0.1.0)
110
130
  fog-core
111
131
  fog-xml
132
+ fog-vsphere (1.5.2)
133
+ fog-core
134
+ rbvmomi (~> 1.9)
135
+ fog-xenserver (0.2.3)
136
+ fog-core
137
+ fog-xml
112
138
  fog-xml (0.1.2)
113
139
  fog-core
114
140
  nokogiri (~> 1.5, >= 1.5.11)
115
141
  formatador (0.2.5)
116
142
  i18n (0.7.0)
117
143
  inflecto (0.0.2)
118
- ipaddress (0.8.0)
144
+ ipaddress (0.8.3)
119
145
  json (1.8.3)
120
- mime-types (2.6.1)
121
- mini_portile (0.6.2)
122
- minitest (5.8.0)
123
- multi_json (1.11.2)
124
- net-scp (1.2.1)
125
- net-ssh (>= 2.6.5)
126
- net-ssh (2.9.2)
127
- nokogiri (1.6.6.2)
128
- mini_portile (~> 0.6.0)
129
- rake (10.4.2)
130
- rspec (3.3.0)
131
- rspec-core (~> 3.3.0)
132
- rspec-expectations (~> 3.3.0)
133
- rspec-mocks (~> 3.3.0)
134
- rspec-core (3.3.2)
135
- rspec-support (~> 3.3.0)
136
- rspec-expectations (3.3.1)
146
+ mini_portile2 (2.1.0)
147
+ minitest (5.10.1)
148
+ multi_json (1.12.1)
149
+ nokogiri (1.6.8.1)
150
+ mini_portile2 (~> 2.1.0)
151
+ rake (11.3.0)
152
+ rbvmomi (1.9.4)
153
+ builder (~> 3.2)
154
+ json (>= 1.8)
155
+ nokogiri (~> 1.5)
156
+ trollop (~> 2.1)
157
+ rspec (3.5.0)
158
+ rspec-core (~> 3.5.0)
159
+ rspec-expectations (~> 3.5.0)
160
+ rspec-mocks (~> 3.5.0)
161
+ rspec-core (3.5.4)
162
+ rspec-support (~> 3.5.0)
163
+ rspec-expectations (3.5.0)
137
164
  diff-lcs (>= 1.2.0, < 2.0)
138
- rspec-support (~> 3.3.0)
139
- rspec-mocks (3.3.2)
165
+ rspec-support (~> 3.5.0)
166
+ rspec-mocks (3.5.0)
140
167
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.3.0)
142
- rspec-support (3.3.0)
168
+ rspec-support (~> 3.5.0)
169
+ rspec-support (3.5.0)
143
170
  thread_safe (0.3.5)
171
+ trollop (2.1.2)
144
172
  tzinfo (1.2.2)
145
173
  thread_safe (~> 0.1)
174
+ xml-simple (1.1.5)
146
175
 
147
176
  PLATFORMS
148
177
  ruby
@@ -154,3 +183,6 @@ DEPENDENCIES
154
183
  rake
155
184
  rspec
156
185
  rspec-mocks
186
+
187
+ BUNDLED WITH
188
+ 1.11.2
data/lib/selbackup.rb CHANGED
@@ -179,6 +179,16 @@ class SelBackup
179
179
  end
180
180
 
181
181
 
182
+ # Public: Returns the parsed date.
183
+ #
184
+ # filename: "2016-11-26-daily-server_name-project1234.pgsql.gz" for example
185
+ #
186
+ # Returns a Date instance.
187
+ def date_from_filename(filename)
188
+ Date.parse(filename.match(/\d{4}-\d{2}-\d{2}/).to_s)
189
+ end
190
+
191
+
182
192
  # Public: returns lists of file
183
193
  #
184
194
  # filename: "file.tgz" for example
@@ -207,7 +217,7 @@ class SelBackup
207
217
  def give_me_latest_file(files)
208
218
  latest_file = files.first
209
219
  files.each do | file |
210
- if Date.parse(file.key.gsub('-', '')) < Date.parse(latest_file.key.gsub('-', ''))
220
+ if date_from_filename(file.key) < date_from_filename(latest_file.key)
211
221
  latest_file = file
212
222
  end
213
223
  end
@@ -223,7 +233,7 @@ class SelBackup
223
233
  def give_me_recent_file(files)
224
234
  recent_file = files.first
225
235
  files.each do | file |
226
- if Date.parse(file.key.gsub('-', '')) > Date.parse(recent_file.key.gsub('-', ''))
236
+ if date_from_filename(file.key) > date_from_filename(recent_file.key)
227
237
  recent_file = file
228
238
  end
229
239
  end
@@ -316,8 +326,8 @@ class SelBackup
316
326
  # Returns true if datediff between the two files is upper than 7 days. False in other cases
317
327
  def should_weekly?(file1, file2)
318
328
  begin
319
- date1 = Date.parse(file1.gsub('-', ''))
320
- date2 = Date.parse(file2.gsub('-', ''))
329
+ date1 = date_from_filename(file1)
330
+ date2 = date_from_filename(file2)
321
331
  rescue
322
332
  print "Wrong date (Date.parse in should_monthly)."
323
333
  return false
@@ -336,8 +346,8 @@ class SelBackup
336
346
  # Returns true if datediff between the two files is upper than 1 month. False in other cases
337
347
  def should_monthly?(file1, file2)
338
348
  begin
339
- date1 = Date.parse(file1.gsub('-', '')).prev_month
340
- date2 = Date.parse(file2.gsub('-', ''))
349
+ date1 = date_from_filename(file1).prev_month
350
+ date2 = date_from_filename(file2)
341
351
  rescue
342
352
  print "Wrong date (Date.parse in should_monthly)."
343
353
  return false
data/selbackup.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selbackup'
3
- s.version = '0.2.0'
4
- s.date = '2015-09-09'
3
+ s.version = '0.2.1'
4
+ s.date = Date.today.to_s
5
5
  s.summary = "Backup to s3 with rotation system"
6
6
  s.description = "Backups files to Amazon S3 server"
7
7
  s.has_rdoc = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Ninon pour Selectra sarl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Backups files to Amazon S3 server
14
14
  email: simon.ninon@gmail.com
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.4.6
51
+ rubygems_version: 2.6.8
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Backup to s3 with rotation system