siba 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright (c) 2012 Evgeny Neumerzhitskiy
2
-
3
1
  MIT License
4
2
 
3
+ Copyright (c) 2012 Evgeny Neumerzhitskiy
4
+
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
7
7
  "Software"), to deal in the Software without restriction, including
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Overview
2
2
 
3
+ SIBA is a simple backup and restore utility. It implements daily backup rotation scheme. It is most suitable in sutuations when you need to have a history of backups. When run daily, SIBA retains full year history of backups by keeping 23 files in total: for the last 6 days, 5 weeks and 12 months.
3
4
 
4
- SIBA is a simple backup and restore utility. It implements daily backup rotation scheme. It is most suitable in sutuations when you need to have a history of backups and not just the last one. If run daily, SIBA retains full year history of backups by keeping only 23 files: 6 daily, 5 weekly and 12 monthly full backups.
5
+ <img src="http://webdevelopercv.com/images/works/siba.png" width="326" height="326">
5
6
 
6
7
  ## Main features
7
8
 
8
- * **Ease of use.** Configure, backup and restore with a single command.
9
- * **Secure.** All backups are encrypted on your computer before reaching backup destination.
10
- * **Cross platform.** Utility can be run on any computer with Ruby 1.9 or later.
11
- * **Easy to extend.** Developers can easily add new backup sources, archivers, encryptors and destinations.
12
- * **Free and open source.** Use SIBA for any purpose without restrictions.
9
+ * **Easy to use:** configure, backup and restore with a single command.
10
+ * **Secure:** all backups are encrypted before moving to destination.
11
+ * **Cross platform:** runs on any computer with Ruby 1.9 or later.
12
+ * **Easy to extend:** developers can easily add new backup sources, archivers, encryptions and destinations.
13
+ * **Free and open source:** use SIBA for any purpose without restrictions.
13
14
 
14
15
  ## Installation
15
16
 
@@ -19,30 +20,54 @@ SIBA is a simple backup and restore utility. It implements daily backup rotation
19
20
 
20
21
  ## Usage
21
22
 
22
- 1. Create a configuration file
23
+ 1. Create a configuration file:
23
24
 
24
25
  $ siba generate mybak
25
26
 
26
- 2. Backup
27
+ 2. Backup:
27
28
 
28
29
  $ siba backup mybak
29
30
 
30
- 3. Restore
31
+ 3. Restore:
31
32
 
32
33
  $ siba restore mybak
33
34
 
34
- 4. Show available plugins
35
+ 4. Show available plugins:
35
36
 
36
37
  $ siba list
37
38
 
38
- 5. Create a gem project for a new destination plugin (or for a source, archive, encryption plugin).
39
+ 5. Show other commands and options:
40
+
41
+ $ siba
42
+
43
+ 6. Create a gem skeleton for a new destination plugin:
39
44
 
40
45
  $ siba scaffold destination my-cloud
41
46
 
42
- 6. Show other commands and options
47
+ Tip: to create other plugin types, replace `destination` with `source`, `archive` or `encryption`.
48
+
49
+ [Read more about SIBA plugin development](https://github.com/evgenyneu/siba/blob/master/scaffolds/project/README.md)
43
50
 
44
- $ siba
45
51
 
46
52
  ## Scheduling backups
47
53
 
48
54
  It is recommended to run `siba backup` command daily or hourly. Use your favourite scheduler to automate the process: Cron, Scheduled Tasks, iCal etc.
55
+
56
+ ## Supported plugins
57
+
58
+ ### Source
59
+
60
+ * **Files:** backup local files and directories.
61
+
62
+ ### Archive
63
+
64
+ * **Tar:** archive with optional gzip or bzip2 compression.
65
+
66
+ ### Encryption
67
+
68
+ * **Gpg:** encrypt with AES256, Blowfish, Twofish, 3DES and other ciphers.
69
+
70
+ ### Destination
71
+
72
+ * **Dir:** backup to local directory.
73
+ * **Aws-s3:** upload backup to Amazon S3 storage.
data/lib/siba/console.rb CHANGED
@@ -62,9 +62,12 @@ Options:"
62
62
  end
63
63
 
64
64
  o.on("--version", "Show version") do
65
- show_message "SIBA (SImple BAckup) #{Siba::VERSION}"
65
+ show_message "SIBA #{Siba::VERSION}"
66
66
  return
67
67
  end
68
+
69
+ o.separator ""
70
+ o.separator "Homepage: https://github.com/evgenyneu/siba"
68
71
  end
69
72
 
70
73
  if argv.empty?
@@ -10,9 +10,7 @@ module Siba
10
10
  end
11
11
 
12
12
  def dirs_count(dir)
13
- entries(dir).count do |a|
14
- siba_file.file_directory? File.join(dir, a)
15
- end
13
+ dirs(dir).size
16
14
  end
17
15
 
18
16
  # Reads a file in UTF-8 encoding
@@ -48,6 +46,20 @@ module Siba
48
46
  siba_file.dir_entries(dir) - %w{ . .. }
49
47
  end
50
48
 
49
+ # Retuns an array containing names of sub-directories located in the dir
50
+ def dirs(dir)
51
+ entries(dir).select do |entry|
52
+ siba_file.file_directory?(File.join(dir,entry))
53
+ end
54
+ end
55
+
56
+ # Retuns an array containing names of files located in the dir
57
+ def files(dir)
58
+ entries(dir).select do |entry|
59
+ siba_file.file_file?(File.join(dir,entry))
60
+ end
61
+ end
62
+
51
63
  # Raises error if dirs are not identical
52
64
  def dirs_same?(dir1, dir2)
53
65
  dir1_entries = siba_file.dir_entries dir1
@@ -1,5 +1,6 @@
1
1
  source:
2
2
  files: Backup local files and directories
3
+ mongo-db: Backup and restore MongoDB
3
4
  archive:
4
5
  tar: Archive with optional gzip or bzip2 compression
5
6
  encryption:
data/lib/siba/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Siba
4
- VERSION = "0.4.4"
4
+ VERSION = "0.5.0"
5
5
  end
@@ -1,7 +1,7 @@
1
- Copyright (c) <year> <name>
2
-
3
1
  MIT License
4
2
 
3
+ Copyright (c) <year> <name>
4
+
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
7
7
  "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,6 @@
1
1
  # Developing a SIBA plugin
2
2
 
3
- Follow four simple steps to develop a SIBA extension plugin.
3
+ Follow the four simple steps to develop a SIBA extension plugin.
4
4
 
5
5
  ## 1. Generate project skeleton
6
6
 
@@ -8,11 +8,11 @@ Generate an empty project for a plugin gem:
8
8
 
9
9
  $ siba scaffold CATEGORY plugin-name
10
10
 
11
- where CATEGORY can be: source, archive, encryption or destination.
11
+ where CATEGORY can be: source, archive, encryption or destination.
12
12
 
13
13
  ## 2. Change `init.rb` file
14
14
 
15
- After the project is generated, add your code to init.rb file located in lib/your-plugin-dir. It already has all necessay methods with instructions and examples.
15
+ After the project is generated, add your code to `init.rb` file located in `lib/your-plugin-dir`. It already has all necessary methods with instructions and examples.
16
16
 
17
17
  ## 3. Change `options.yml`
18
18
 
@@ -20,14 +20,25 @@ Add your plugin options to `options.yml`. It is located in the same directory as
20
20
 
21
21
  ## 4. Publish
22
22
 
23
- Publish your plugin gem. If you want your plugin to be shown to users by `siba list` and `siba generate` commands, please add its description to /lib/siba/plugins/plugins.yml file in SIBA project on github and issue a pull request.
23
+ Publish your plugin gem. If you want your plugin to be shown to users by `siba list` and `siba generate` commands, add its description to /lib/siba/plugins/plugins.yml file in [siba github project](https://github.com/evgenyneu/siba) and send a pull request.
24
+
24
25
 
25
26
  ## Testing
26
27
 
27
- The project contains test files with examples. Two types of tests are used: unit and integration. In unit tests file system, shell and other time consuming operations are not performed.
28
+ The project generated with `siba scaffold` command contains test files with examples. Two types of tests are used: unit and integration. In unit tests file system, shell and other time consuming operations are not performed.
29
+
30
+ First, make sure you have bundler installed:
31
+
32
+ $ gem install bundler
33
+
34
+ Then, `cd` to the project directory and install all dependencies:
35
+
36
+ $ bundle install
37
+
38
+ Finally, run unit tests:
39
+
40
+ $ rake
28
41
 
29
- To run unit tests:
30
- rake
42
+ And integration tests:
31
43
 
32
- To run integration tests
33
- rake test:i9n
44
+ $ rake test:i9n
@@ -8,11 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["TODO: Write your name"]
9
9
  s.email = ["TOD0: your@email.com"]
10
10
  s.homepage = ""
11
+ s.license = "MIT"
11
12
  s.summary = %q{TODO: Write a gem summary}
12
13
  s.description = %q{TODO: Write a gem description}
13
14
 
14
- s.rubyforge_project = "siba-c6y-demo"
15
-
16
15
  s.files = `git ls-files`.split("\n")
17
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
data/siba.gemspec CHANGED
@@ -8,8 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Evgeny Neumerzhitskiy"]
9
9
  s.email = ["sausageskin@gmail.com"]
10
10
  s.homepage = "https://github.com/evgenyneu/siba"
11
+ s.license = "MIT"
11
12
  s.summary = %q{Simple backup and restore utility.}
12
- s.description = %q{SIBA is a backup and restore utility. It implements backup rotation scheme. It retains full year history of backups by keeping only 23 files: 6 daily, 5 weekly and 12 monthly backups. Backups are compressed and encrypted. Various backup sources and destinations can be added through extension gems.}
13
+ s.description = %q{SIBA is a backup and restore utility. It implements daily backup rotation scheme. It retains full year history of backups by keeping 23 files in total: for the last 6 days, 5 weeks and 12 months. Backups are archived and encrypted. Various backup sources and destinations can be added through extension gems.}
13
14
 
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -22,6 +22,28 @@ describe Siba::FileHelper do
22
22
  entries.wont_be_empty
23
23
  entries.must_equal entries_to_compare
24
24
  end
25
+
26
+ it "should call dirs" do
27
+ test_dir = prepare_test_dir "dir-not-empty"
28
+ entries = @obj.dirs test_dir
29
+ entries.wont_be_empty
30
+ dirs_to_compare = @obj.entries(test_dir).select {|a| File.directory?(File.join(test_dir, a))}
31
+ entries.size.must_equal dirs_to_compare.size
32
+ entries.each do |a|
33
+ dirs_to_compare.must_include a
34
+ end
35
+ end
36
+
37
+ it "should call files" do
38
+ test_dir = prepare_test_dir "dir-not-empty"
39
+ entries = @obj.files test_dir
40
+ entries.wont_be_empty
41
+ files_to_compare = @obj.entries(test_dir).select {|a| File.file?(File.join(test_dir, a))}
42
+ entries.size.must_equal files_to_compare.size
43
+ entries.each do |a|
44
+ files_to_compare.must_include a
45
+ end
46
+ end
25
47
 
26
48
  it "should call dirs_count" do
27
49
  test_dir = prepare_test_dir "dir-not-empty"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-29 00:00:00.000000000 Z
12
+ date: 2012-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &85332600 !ruby/object:Gem::Requirement
16
+ requirement: &83691080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.10'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *85332600
24
+ version_requirements: *83691080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &85332150 !ruby/object:Gem::Requirement
27
+ requirement: &83690410 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.9'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *85332150
35
+ version_requirements: *83690410
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: guard-minitest
38
- requirement: &85331650 !ruby/object:Gem::Requirement
38
+ requirement: &83689690 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,11 +43,11 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *85331650
47
- description: ! 'SIBA is a backup and restore utility. It implements backup rotation
48
- scheme. It retains full year history of backups by keeping only 23 files: 6 daily,
49
- 5 weekly and 12 monthly backups. Backups are compressed and encrypted. Various backup
50
- sources and destinations can be added through extension gems.'
46
+ version_requirements: *83689690
47
+ description: ! 'SIBA is a backup and restore utility. It implements daily backup rotation
48
+ scheme. It retains full year history of backups by keeping 23 files in total: for
49
+ the last 6 days, 5 weeks and 12 months. Backups are archived and encrypted. Various
50
+ backup sources and destinations can be added through extension gems.'
51
51
  email:
52
52
  - sausageskin@gmail.com
53
53
  executables:
@@ -214,7 +214,8 @@ files:
214
214
  - test/unit/yml/siba_options_backup.yml
215
215
  - test/unit/yml/valid.yml
216
216
  homepage: https://github.com/evgenyneu/siba
217
- licenses: []
217
+ licenses:
218
+ - MIT
218
219
  post_install_message:
219
220
  rdoc_options: []
220
221
  require_paths: