selbackup 0.1.3 → 0.2.0

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: 3f72aa466f3a2490e4353381f36449066bf0f80e
4
- data.tar.gz: 70714192da0d8bac93c5580d8ef82586ad20d8ad
3
+ metadata.gz: 10947b2fe0ea712db590c2700b927473c301b610
4
+ data.tar.gz: aa319c2e8e037a72aad2d92bf02faf8c354036ab
5
5
  SHA512:
6
- metadata.gz: 4cabb8fa02e93cb6a67899dd858e26955d4d739438e615a800f58224490b6e5638d82fc407c09e635e07f8cbc317f17a0fbc324457030b9ee3bc37bff5990893
7
- data.tar.gz: a8c0d2afb756c6f91c329b31ba2531fb2ef3d055b0e05a14c2cd0bd4632e3cc8724b361b3c1d4af0db5c41274d4faa29b5e7c888f5e3c5ad7fe924033cd57277
6
+ metadata.gz: 5399ac1a5e8937ed1c9b9ffdbf977bf9f610171589c319a8940203fa371bfe74860197b01679a8191fdc5636e5c653bd4e3fe3971ed7e0ee79dd8b69b4458c37
7
+ data.tar.gz: 055d5e4d7878d2a4632646a0253d94e433a8a641d56c08cfc2471a455895fed38ae4ec019d62608b1950212588857295f5319bd6d8e66fdf27eefa3c37f840dd
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ upload_test/tmp/
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'active_support'
4
- gem 'fog'
3
+ gem 'activesupport', '~> 4.2'
4
+ gem 'fog', '~> 1.34'
5
5
  gem 'i18n'
6
6
  gem 'rake'
7
7
 
8
8
  group :development do
9
9
  gem 'rspec'
10
10
  gem 'rspec-mocks'
11
- end
11
+ end
data/Gemfile.lock CHANGED
@@ -1,47 +1,155 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- active_support (3.0.0)
5
- activesupport (= 3.0.0)
6
- activesupport (3.0.0)
4
+ CFPropertyList (2.3.1)
5
+ activesupport (4.2.4)
6
+ i18n (~> 0.7)
7
+ json (~> 1.7, >= 1.7.7)
8
+ minitest (~> 5.1)
9
+ thread_safe (~> 0.3, >= 0.3.4)
10
+ tzinfo (~> 1.1)
7
11
  builder (3.2.2)
8
- diff-lcs (1.2.4)
9
- excon (0.23.0)
10
- fog (1.12.1)
12
+ diff-lcs (1.2.5)
13
+ excon (0.45.4)
14
+ fission (0.5.0)
15
+ CFPropertyList (~> 2.2)
16
+ fog (1.34.0)
17
+ fog-atmos
18
+ fog-aws (>= 0.6.0)
19
+ fog-brightbox (~> 0.4)
20
+ fog-core (~> 1.32)
21
+ fog-dynect (~> 0.0.2)
22
+ fog-ecloud (~> 0.1)
23
+ fog-google (>= 0.0.2)
24
+ fog-json
25
+ fog-local
26
+ fog-powerdns (>= 0.1.1)
27
+ fog-profitbricks
28
+ fog-radosgw (>= 0.0.2)
29
+ fog-riakcs
30
+ fog-sakuracloud (>= 0.0.4)
31
+ fog-serverlove
32
+ fog-softlayer
33
+ fog-storm_on_demand
34
+ fog-terremark
35
+ fog-vmfusion
36
+ fog-voxel
37
+ fog-xml (~> 0.1.1)
38
+ ipaddress (~> 0.5)
39
+ nokogiri (~> 1.5, >= 1.5.11)
40
+ fog-atmos (0.1.0)
41
+ fog-core
42
+ fog-xml
43
+ fog-aws (0.7.6)
44
+ fog-core (~> 1.27)
45
+ fog-json (~> 1.0)
46
+ fog-xml (~> 0.1)
47
+ ipaddress (~> 0.8)
48
+ fog-brightbox (0.9.0)
49
+ fog-core (~> 1.22)
50
+ fog-json
51
+ inflecto (~> 0.0.2)
52
+ fog-core (1.32.1)
11
53
  builder
12
- excon (~> 0.23.0)
13
- formatador (~> 0.2.0)
54
+ excon (~> 0.45)
55
+ formatador (~> 0.2)
14
56
  mime-types
15
- multi_json (~> 1.0)
16
57
  net-scp (~> 1.1)
17
58
  net-ssh (>= 2.1.3)
18
- nokogiri (~> 1.5.0)
19
- ruby-hmac
20
- formatador (0.2.4)
21
- i18n (0.6.4)
22
- mime-types (1.23)
23
- multi_json (1.7.7)
24
- net-scp (1.1.2)
59
+ fog-dynect (0.0.2)
60
+ fog-core
61
+ fog-json
62
+ fog-xml
63
+ fog-ecloud (0.3.0)
64
+ fog-core
65
+ fog-xml
66
+ fog-google (0.0.7)
67
+ fog-core
68
+ fog-json
69
+ fog-xml
70
+ fog-json (1.0.2)
71
+ fog-core (~> 1.0)
72
+ multi_json (~> 1.10)
73
+ fog-local (0.2.1)
74
+ fog-core (~> 1.27)
75
+ fog-powerdns (0.1.1)
76
+ fog-core (~> 1.27)
77
+ fog-json (~> 1.0)
78
+ fog-xml (~> 0.1)
79
+ fog-profitbricks (0.0.5)
80
+ fog-core
81
+ fog-xml
82
+ nokogiri
83
+ fog-radosgw (0.0.4)
84
+ fog-core (>= 1.21.0)
85
+ fog-json
86
+ fog-xml (>= 0.0.1)
87
+ fog-riakcs (0.1.0)
88
+ fog-core
89
+ fog-json
90
+ fog-xml
91
+ fog-sakuracloud (1.1.1)
92
+ fog-core
93
+ fog-json
94
+ fog-serverlove (0.1.2)
95
+ fog-core
96
+ fog-json
97
+ fog-softlayer (0.4.7)
98
+ fog-core
99
+ fog-json
100
+ fog-storm_on_demand (0.1.1)
101
+ fog-core
102
+ fog-json
103
+ fog-terremark (0.1.0)
104
+ fog-core
105
+ fog-xml
106
+ fog-vmfusion (0.1.0)
107
+ fission
108
+ fog-core
109
+ fog-voxel (0.1.0)
110
+ fog-core
111
+ fog-xml
112
+ fog-xml (0.1.2)
113
+ fog-core
114
+ nokogiri (~> 1.5, >= 1.5.11)
115
+ formatador (0.2.5)
116
+ i18n (0.7.0)
117
+ inflecto (0.0.2)
118
+ ipaddress (0.8.0)
119
+ 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)
25
125
  net-ssh (>= 2.6.5)
26
- net-ssh (2.6.8)
27
- nokogiri (1.5.10)
28
- rake (10.1.0)
29
- rspec (2.14.1)
30
- rspec-core (~> 2.14.0)
31
- rspec-expectations (~> 2.14.0)
32
- rspec-mocks (~> 2.14.0)
33
- rspec-core (2.14.3)
34
- rspec-expectations (2.14.0)
35
- diff-lcs (>= 1.1.3, < 2.0)
36
- rspec-mocks (2.14.1)
37
- ruby-hmac (0.4.0)
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)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.3.0)
139
+ rspec-mocks (3.3.2)
140
+ diff-lcs (>= 1.2.0, < 2.0)
141
+ rspec-support (~> 3.3.0)
142
+ rspec-support (3.3.0)
143
+ thread_safe (0.3.5)
144
+ tzinfo (1.2.2)
145
+ thread_safe (~> 0.1)
38
146
 
39
147
  PLATFORMS
40
148
  ruby
41
149
 
42
150
  DEPENDENCIES
43
- active_support
44
- fog
151
+ activesupport (~> 4.2)
152
+ fog (~> 1.34)
45
153
  i18n
46
154
  rake
47
155
  rspec
data/Rakefile CHANGED
@@ -17,17 +17,20 @@ task :test_upload, :key, :secret, :bucket do |t, args|
17
17
  secret = args[:secret]
18
18
  bucket = args[:bucket]
19
19
 
20
- `mkdir -p upload_test/tmp`
20
+ puts 'Creating folders'
21
+ `mkdir -p upload_test/tmp/{tiny,large}/`
22
+ puts 'Creating fake files (124 tiny files and 4 large files (1GB, 5GB, 10GB, 25GB)'
21
23
  `bash upload_test/create_files.sh`
22
24
  begin
23
25
  sb = SelBackup.new(key, secret, bucket)
24
- files = Dir.glob("upload_test/tmp/*")
26
+ files = Dir.glob('upload_test/tmp/tiny/*')
27
+ files.concat(Dir.glob('upload_test/tmp/large/*'))
25
28
  files.each do | file |
26
29
  puts "Uploading: #{file}"
27
30
  sb.upload_file(file)
28
31
  `rm #{file}`
29
32
  end
30
- rescue
31
- puts 'Authentication to s3 server failed.'
33
+ rescue => error
34
+ puts error.inspect
32
35
  end
33
36
  end
data/lib/selbackup.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext'
2
3
  require 'fog'
3
4
 
@@ -49,7 +50,7 @@ class SelBackup
49
50
  #
50
51
  # * If more than 7 daily files but less than one week datediff between the latest daily file and the most recent weekly file: deletes the latest daily file
51
52
  #
52
- # * If more than 7 daily files but less than one week datediff between the latest daily file and the most recent weekly file: pushes the latest daily file to weekly file
53
+ # * If more than 7 daily files but less than one week datediff between the latest daily file and the most recent weekly file: pushes the latest daily file to weekly file
53
54
  # 2013-01-01-daily-file.tgz -> 2013-01-01-weekly-file.tgz
54
55
  #
55
56
  # Returns true if a file as been push. False in other cases
data/selbackup.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selbackup'
3
- s.version = '0.1.3'
4
- s.date = '2015-09-01'
5
- s.summary = "Backup to s3 with rtation system"
6
- s.description = "Backups files to amazon s3 server"
3
+ s.version = '0.2.0'
4
+ s.date = '2015-09-09'
5
+ s.summary = "Backup to s3 with rotation system"
6
+ s.description = "Backups files to Amazon S3 server"
7
7
  s.has_rdoc = true
8
8
  s.authors = ["Simon Ninon pour Selectra sarl"]
9
9
  s.email = 'simon.ninon@gmail.com'
@@ -1,4 +1,3 @@
1
- require 'rspec/autorun'
2
1
  require File.expand_path("../../lib/selbackup", __FILE__)
3
2
 
4
3
  describe SelBackup do
@@ -31,55 +30,55 @@ describe SelBackup do
31
30
 
32
31
  describe '#gen_daily_file' do
33
32
  it 'pushes a file to daily' do
34
- File.stub(:open).and_return(nil)
33
+ allow(File).to receive(:open).and_return(nil)
35
34
  file = '2013-01-01-file.tgz'
36
35
  expectation = { myname: 'file.tgz', key: 'file.tgz/2013-01-01-daily-file.tgz', body: nil }
37
36
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
38
37
  end
39
38
 
40
39
  it 'has not an extension' do
41
- File.stub(:open).and_return(nil)
40
+ allow(File).to receive(:open).and_return(nil)
42
41
  file = '2013-01-01-file'
43
42
  expectation = { myname: 'file', key: 'file/2013-01-01-daily-file', body: nil }
44
43
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
45
44
  end
46
45
 
47
46
  it 'has not a date' do
48
- File.stub(:open).and_return(nil)
47
+ allow(File).to receive(:open).and_return(nil)
49
48
  file = 'file.tgz'
50
49
  expectation = { myname: 'file.tgz', key: "file.tgz/#{Date.today.to_s}-daily-file.tgz", body: nil }
51
50
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
52
51
  end
53
52
 
54
53
  it 'has not a date and an extension' do
55
- File.stub(:open).and_return(nil)
54
+ allow(File).to receive(:open).and_return(nil)
56
55
  file = 'file'
57
56
  expectation = { myname: 'file', key: "file/#{Date.today.to_s}-daily-file", body: nil }
58
57
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
59
58
  end
60
59
 
61
60
  it 'has an different extension and not a date' do
62
- File.stub(:open).and_return(nil)
61
+ allow(File).to receive(:open).and_return(nil)
63
62
  file = 'file.myextension'
64
63
  expectation = { myname: 'file.myextension', key: "file.myextension/#{Date.today.to_s}-daily-file.myextension", body: nil }
65
64
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
66
65
  end
67
66
 
68
67
  it 'has a different extension' do
69
- File.stub(:open).and_return(nil)
68
+ allow(File).to receive(:open).and_return(nil)
70
69
  file = '2013-01-01-file.myextension'
71
70
  expectation = { myname: 'file.myextension', key: 'file.myextension/2013-01-01-daily-file.myextension', body: nil }
72
71
  expect(@selbackup.gen_daily_file(file)).to include( expectation )
73
72
  end
74
73
 
75
74
  it 'has only a date and an extension' do
76
- File.stub(:open).and_return(nil)
75
+ allow(File).to receive(:open).and_return(nil)
77
76
  file = '2013-01-01.tgz'
78
77
  expect(@selbackup.gen_daily_file(file)).to eq false
79
78
  end
80
79
 
81
80
  it 'has only a date' do
82
- File.stub(:open).and_return(nil)
81
+ allow(File).to receive(:open).and_return(nil)
83
82
  file = '2013-01-01'
84
83
  expect(@selbackup.gen_daily_file(file)).to eq false
85
84
  end
@@ -1,13 +1,19 @@
1
1
  for i in {1..4}; do
2
2
  for j in {1..31}; do
3
3
  if [[ $j -lt 10 ]]; then
4
- echo "tmp/2013-0$i-0$j-file.tgz" > upload_test/tmp/2013-0$i-0$j-file.tgz
4
+ echo "tmp/tiny/2013-0$i-0$j-file.tgz" > upload_test/tmp/tiny/2013-0$i-0$j-file.tgz
5
5
  else
6
- echo "tmp/2013-0$i-$j-file.tgz" > upload_test/tmp/2013-0$i-$j-file.tgz
6
+ echo "tmp/tiny/2013-0$i-$j-file.tgz" > upload_test/tmp/tiny/2013-0$i-$j-file.tgz
7
7
  fi
8
8
  done
9
9
  done
10
- rm upload_test/tmp/2013-02-29-file.tgz
11
- rm upload_test/tmp/2013-02-30-file.tgz
12
- rm upload_test/tmp/2013-02-31-file.tgz
13
- rm upload_test/tmp/2013-04-31-file.tgz
10
+ rm upload_test/tmp/tiny/2013-02-29-file.tgz
11
+ rm upload_test/tmp/tiny/2013-02-30-file.tgz
12
+ rm upload_test/tmp/tiny/2013-02-31-file.tgz
13
+ rm upload_test/tmp/tiny/2013-04-31-file.tgz
14
+
15
+
16
+ mkfile 1024m upload_test/tmp/large/1_1GB_file
17
+ mkfile 5120m upload_test/tmp/large/2_5GB_file
18
+ mkfile 10240m upload_test/tmp/large/3_10GB_file
19
+ mkfile 25600m upload_test/tmp/large/4_25GB_file
metadata CHANGED
@@ -1,21 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
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-01 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Backups files to amazon s3 server
13
+ description: Backups files to Amazon S3 server
14
14
  email: simon.ninon@gmail.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - ".gitignore"
19
20
  - Gemfile
20
21
  - Gemfile.lock
21
22
  - LICENSE
@@ -50,6 +51,6 @@ rubyforge_project:
50
51
  rubygems_version: 2.4.6
51
52
  signing_key:
52
53
  specification_version: 4
53
- summary: Backup to s3 with rtation system
54
+ summary: Backup to s3 with rotation system
54
55
  test_files:
55
56
  - spec/selbackup_spec.rb