siba 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/Rakefile +6 -6
- data/lib/siba/backup.rb +2 -2
- data/lib/siba/console.rb +13 -13
- data/lib/siba/generator.rb +4 -5
- data/lib/siba/helpers/file_helper.rb +6 -6
- data/lib/siba/helpers/password_strength.rb +5 -5
- data/lib/siba/helpers/security_helper.rb +9 -9
- data/lib/siba/helpers/test/extend_test.rb +7 -7
- data/lib/siba/helpers/test/helper.rb +3 -3
- data/lib/siba/logger_plug.rb +1 -1
- data/lib/siba/plugins/archive/tar/archive.rb +8 -8
- data/lib/siba/plugins/archive/tar/init.rb +3 -3
- data/lib/siba/plugins/destination/dir/dest_dir.rb +7 -7
- data/lib/siba/plugins/destination/dir/init.rb +2 -2
- data/lib/siba/plugins/encryption/gpg/encryption.rb +10 -10
- data/lib/siba/plugins/encryption/gpg/init.rb +1 -1
- data/lib/siba/plugins/installed_plugins.rb +10 -6
- data/lib/siba/plugins/plugin_loader.rb +6 -5
- data/lib/siba/plugins/source/files/files.rb +7 -7
- data/lib/siba/plugins/source/files/init.rb +2 -2
- data/lib/siba/restore.rb +5 -5
- data/lib/siba/scaffold.rb +17 -17
- data/lib/siba/siba_check.rb +3 -3
- data/lib/siba/siba_file.rb +6 -6
- data/lib/siba/siba_logger.rb +11 -11
- data/lib/siba/tasks/siba_task.rb +1 -1
- data/lib/siba/tasks/siba_tasks.rb +7 -7
- data/lib/siba/test_files.rb +4 -4
- data/lib/siba/tmp_dir.rb +4 -4
- data/lib/siba/version.rb +1 -1
- data/scaffolds/archive.rb +3 -3
- data/scaffolds/destination.rb +4 -4
- data/scaffolds/encryption.rb +3 -3
- data/scaffolds/project/siba-c6y-demo.gemspec +2 -2
- data/scaffolds/project/test/helper/require_integration.rb +1 -1
- data/scaffolds/project/test/integration/i9n_init.rb +4 -4
- data/scaffolds/project/test/unit/test_init.rb +8 -8
- data/scaffolds/shared/examples.rb +4 -4
- data/scaffolds/source.rb +4 -4
- data/siba.gemspec +1 -1
- data/test/integration/helpers/i9n_file_helper.rb +1 -1
- data/test/integration/i9n_backup.rb +1 -1
- data/test/integration/i9n_scaffold.rb +1 -1
- data/test/integration/i9n_test_unicode_files.rb +1 -1
- data/test/integration/i9n_tmp_dir.rb +2 -2
- data/test/integration/plugins/destination/dir/i9n_dest_dir.rb +1 -1
- data/test/integration/plugins/encryption/gpg/i9n_encryption.rb +4 -4
- data/test/integration/plugins/source/files/i9n_files.rb +6 -6
- data/test/integration/tasks/i9n_siba_tasks.rb +2 -2
- data/test/unit/helpers/test_encoding_helper.rb +1 -1
- data/test/unit/helpers/test_gem_helper.rb +1 -1
- data/test/unit/helpers/test_security_helper.rb +1 -1
- data/test/unit/helpers/test_string_helper.rb +1 -1
- data/test/unit/plugins/archive/tar/test_archive.rb +2 -2
- data/test/unit/plugins/archive/tar/test_init.rb +2 -2
- data/test/unit/plugins/destination/dir/test_dest_dir.rb +1 -1
- data/test/unit/plugins/destination/dir/test_init.rb +1 -1
- data/test/unit/plugins/encryption/gpg/test_encryption.rb +2 -14
- data/test/unit/plugins/encryption/gpg/test_init.rb +3 -3
- data/test/unit/plugins/source/files/test_files.rb +2 -2
- data/test/unit/plugins/source/files/test_init.rb +3 -3
- data/test/unit/plugins/source/files/test_path_match.rb +6 -6
- data/test/unit/plugins/test_installed_plugins.rb +4 -0
- data/test/unit/plugins/test_plugin_loader.rb +6 -3
- data/test/unit/tasks/test_siba_task.rb +2 -2
- data/test/unit/tasks/test_siba_tasks.rb +3 -3
- data/test/unit/test_backup.rb +2 -2
- data/test/unit/test_console.rb +5 -5
- data/test/unit/test_generator.rb +1 -1
- data/test/unit/test_globals.rb +1 -1
- data/test/unit/test_log_message.rb +1 -1
- data/test/unit/test_logger_plug.rb +1 -1
- data/test/unit/test_options_backup.rb +1 -1
- data/test/unit/test_options_loader.rb +27 -39
- data/test/unit/test_password_strength.rb +14 -14
- data/test/unit/test_restore.rb +2 -2
- data/test/unit/test_siba_logger.rb +18 -18
- data/test/unit/test_tmp_dir.rb +1 -1
- metadata +5 -5
data/lib/siba/siba_check.rb
CHANGED
@@ -44,7 +44,7 @@ module Siba
|
|
44
44
|
raise Siba::CheckError, "'#{name}' option should be of [Hash] type" unless obj.is_a? Hash
|
45
45
|
obj
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
# Tries to conver value to string
|
49
49
|
def try_to_s(value, key_name)
|
50
50
|
raise Siba::CheckError, "'#{key_name}' option should be string" if [Array, Hash].any?{|a| value.is_a?(a)}
|
@@ -65,8 +65,8 @@ module Siba
|
|
65
65
|
if item_type == String
|
66
66
|
value = try_to_s value, key_name
|
67
67
|
else
|
68
|
-
item_type = [item_type] unless item_type.is_a?(Array)
|
69
|
-
raise Siba::CheckError, "'#{key_name}' option should be of #{item_type.to_s} type" if item_type.none? {|i| value.is_a? i }
|
68
|
+
item_type = [item_type] unless item_type.is_a?(Array)
|
69
|
+
raise Siba::CheckError, "'#{key_name}' option should be of #{item_type.to_s} type" if item_type.none? {|i| value.is_a? i }
|
70
70
|
end
|
71
71
|
value
|
72
72
|
end
|
data/lib/siba/siba_file.rb
CHANGED
@@ -24,11 +24,11 @@ module Siba
|
|
24
24
|
return File, meth.to_s.gsub(FILE_REGEXP, "")
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def method_missing(meth, *args, &block)
|
29
29
|
file_class, class_meth = SibaFile.get_file_class meth
|
30
30
|
if file_class
|
31
|
-
file_class.send(class_meth, *args, &block)
|
31
|
+
file_class.send(class_meth, *args, &block)
|
32
32
|
else
|
33
33
|
super
|
34
34
|
end
|
@@ -56,10 +56,10 @@ module Siba
|
|
56
56
|
rescue Exception => ex
|
57
57
|
fail_message ||= "Failed to run the command: #{command}"
|
58
58
|
raise Siba::Error, "#{fail_message}
|
59
|
-
#{ex.message}"
|
59
|
+
#{ex.message}"
|
60
60
|
end
|
61
61
|
|
62
|
-
# Runs the shell command.
|
62
|
+
# Runs the shell command.
|
63
63
|
# Works the same way as Kernel.system method but without showing the output.
|
64
64
|
# Returns true if it was successfull.
|
65
65
|
def shell_ok?(command)
|
@@ -70,7 +70,7 @@ module Siba
|
|
70
70
|
return false
|
71
71
|
end
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
# Used to inject "siba_file" to classes that include this module
|
75
75
|
module FilePlug
|
76
76
|
def siba_file
|
@@ -78,7 +78,7 @@ module Siba
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.siba_file
|
81
|
-
@siba_file ||= SibaFile.new
|
81
|
+
@siba_file ||= SibaFile.new
|
82
82
|
end
|
83
83
|
|
84
84
|
# It is used in test to insert mock SibaFile object
|
data/lib/siba/siba_logger.rb
CHANGED
@@ -25,10 +25,10 @@ module Siba
|
|
25
25
|
return 0 if SibaLogger.messages.nil?
|
26
26
|
return SibaLogger.messages.size if severity.nil?
|
27
27
|
severity_i = SibaLogger.level_to_i severity
|
28
|
-
SibaLogger.messages.count do |i|
|
29
|
-
if exact_level
|
30
|
-
i.level == severity_i
|
31
|
-
else
|
28
|
+
SibaLogger.messages.count do |i|
|
29
|
+
if exact_level
|
30
|
+
i.level == severity_i
|
31
|
+
else
|
32
32
|
i.level >= severity_i
|
33
33
|
end
|
34
34
|
end
|
@@ -38,15 +38,15 @@ module Siba
|
|
38
38
|
def count_messages(msg, severity=nil, exact_level=true)
|
39
39
|
return 0 if SibaLogger.messages.nil?
|
40
40
|
severity_i = SibaLogger.level_to_i severity unless severity.nil?
|
41
|
-
SibaLogger.messages.count do |i|
|
41
|
+
SibaLogger.messages.count do |i|
|
42
42
|
match_level = true
|
43
43
|
if severity_i
|
44
|
-
if exact_level
|
44
|
+
if exact_level
|
45
45
|
match_level = i.level == severity_i
|
46
|
-
else
|
46
|
+
else
|
47
47
|
match_level = i.level >= severity_i
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
50
50
|
if match_level
|
51
51
|
!((i.msg =~ /#{msg}/).nil?)
|
52
52
|
else
|
@@ -68,13 +68,13 @@ module Siba
|
|
68
68
|
@loggers << Logger.new(@strlog)
|
69
69
|
|
70
70
|
unless SibaLogger.quiet
|
71
|
-
@stdout_log = Logger.new(STDOUT)
|
71
|
+
@stdout_log = Logger.new(STDOUT)
|
72
72
|
@loggers << stdout_log
|
73
73
|
end
|
74
74
|
|
75
75
|
unless path_to_log_file.nil? || SibaLogger.no_log
|
76
76
|
@file = File.open(path_to_log_file, "a:utf-8")
|
77
|
-
@file_log = Logger.new(file)
|
77
|
+
@file_log = Logger.new(file)
|
78
78
|
@loggers << file_log
|
79
79
|
end
|
80
80
|
|
@@ -127,7 +127,7 @@ module Siba
|
|
127
127
|
def log_exception(exception, log_only_backtrace=false)
|
128
128
|
log('debug',exception.message) unless log_only_backtrace
|
129
129
|
unless exception.backtrace.nil?
|
130
|
-
log('debug',"\n--- stack trace ---\n#{exception.backtrace.join("\n")}\n--- stack trace ---")
|
130
|
+
log('debug',"\n--- stack trace ---\n#{exception.backtrace.join("\n")}\n--- stack trace ---")
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
data/lib/siba/tasks/siba_task.rb
CHANGED
@@ -39,7 +39,7 @@ module Siba
|
|
39
39
|
end
|
40
40
|
path_to_backup = File.join encryption_dir, name_of_encrypted_file
|
41
41
|
unless siba_file.file_file? path_to_backup
|
42
|
-
raise Siba::Error, "Failed to encrypt backup: #{path_to_backup}"
|
42
|
+
raise Siba::Error, "Failed to encrypt backup: #{path_to_backup}"
|
43
43
|
end
|
44
44
|
|
45
45
|
@tasks["destination"].backup path_to_backup
|
@@ -53,7 +53,7 @@ module Siba
|
|
53
53
|
unless siba_file.file_file? path_to_backup
|
54
54
|
raise Siba::Error, "Failed to get backup from destination: #{backup_file_name}"
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
archive_file_name = @tasks["encryption"].restore path_to_backup, encryption_dir
|
58
58
|
path_to_archive = File.join encryption_dir, archive_file_name
|
59
59
|
unless siba_file.file_file? path_to_archive
|
@@ -64,7 +64,7 @@ module Siba
|
|
64
64
|
if Siba::FileHelper.dir_empty? source_dir
|
65
65
|
raise Siba::Error, "Failed to extract archive: #{path_to_archive}"
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
@tasks["source"] = OptionsBackup.load_source_from_backup source_dir if @tasks["source"].nil?
|
69
69
|
@tasks["source"].restore source_dir
|
70
70
|
end
|
@@ -76,7 +76,7 @@ module Siba
|
|
76
76
|
|
77
77
|
def self.backup_name(now=nil)
|
78
78
|
if Siba::StringHelper.nil_or_empty Siba.backup_name
|
79
|
-
raise Siba::Error, "Backup task name is not specified"
|
79
|
+
raise Siba::Error, "Backup task name is not specified"
|
80
80
|
end
|
81
81
|
"#{Siba.backup_name}-#{SibaTasks.backup_name_suffix(now)}"
|
82
82
|
end
|
@@ -96,7 +96,7 @@ module Siba
|
|
96
96
|
def encryption_dir
|
97
97
|
@encryption_dir ||= TestFiles::mkdir_in_tmp_dir("enc").freeze
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def destination_dir
|
101
101
|
@destination_dir ||= TestFiles::mkdir_in_tmp_dir("dest").freeze
|
102
102
|
end
|
@@ -106,7 +106,7 @@ module Siba
|
|
106
106
|
|
107
107
|
# Monthly backup on the 1st day of each month
|
108
108
|
# "month-01" through "month-12"
|
109
|
-
return "month-#{"%02d" % now.month}" if now.day == 1
|
109
|
+
return "month-#{"%02d" % now.month}" if now.day == 1
|
110
110
|
|
111
111
|
# Weekly backup on Sunday
|
112
112
|
# "week-1-sun" through "week-5-sun"
|
@@ -114,7 +114,7 @@ module Siba
|
|
114
114
|
|
115
115
|
# Daily backup
|
116
116
|
# "day-2-mon" through "day-7-sat"
|
117
|
-
"day-#{now.wday+1}-#{now.strftime("%a").downcase}"
|
117
|
+
"day-#{now.wday+1}-#{now.strftime("%a").downcase}"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
data/lib/siba/test_files.rb
CHANGED
@@ -9,11 +9,11 @@ module Siba::TestFiles
|
|
9
9
|
|
10
10
|
def test_file
|
11
11
|
File.join test_files_dir, "a_file"
|
12
|
-
end
|
12
|
+
end
|
13
13
|
|
14
14
|
def test_dir
|
15
15
|
File.join test_files_dir, "files_and_dirs"
|
16
|
-
end
|
16
|
+
end
|
17
17
|
|
18
18
|
def prepare_test_dir(dest_dir_name_part, tmp_dir=nil)
|
19
19
|
tmp_dir ||= Siba.tmp_dir
|
@@ -22,7 +22,7 @@ module Siba::TestFiles
|
|
22
22
|
siba_file.file_utils_cp_r test_dir, dest_dir
|
23
23
|
dest_dir
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def prepare_test_file(dest_file_name_part, tmp_dir=nil)
|
27
27
|
tmp_dir ||= Siba.tmp_dir
|
28
28
|
dest_file = File.join(tmp_dir,"#{dest_file_name_part}#{random_suffix}")
|
@@ -34,7 +34,7 @@ module Siba::TestFiles
|
|
34
34
|
def generate_path(dest_file_name_part, tmp_dir=nil)
|
35
35
|
tmp_dir ||= Siba.tmp_dir
|
36
36
|
File.join(tmp_dir,"#{dest_file_name_part}#{random_suffix}")
|
37
|
-
end
|
37
|
+
end
|
38
38
|
|
39
39
|
def mkdir_in_tmp_dir(prefix, tmp_dir=nil)
|
40
40
|
tmp_dir ||= Siba.tmp_dir
|
data/lib/siba/tmp_dir.rb
CHANGED
@@ -30,8 +30,8 @@ module Siba
|
|
30
30
|
raise unless siba_file.file_directory? test_dir
|
31
31
|
tmp_dir_obj.cleanup
|
32
32
|
rescue Exception
|
33
|
-
logger.error %q{Can not create temporary directory.
|
34
|
-
Please make sure you have write permissions to the system temporary folder.
|
33
|
+
logger.error %q{Can not create temporary directory.
|
34
|
+
Please make sure you have write permissions to the system temporary folder.
|
35
35
|
You can also specify the alternative location for temporary folder in options:
|
36
36
|
|
37
37
|
settings:
|
@@ -51,7 +51,7 @@ settings:
|
|
51
51
|
tmp_dir_from_settings = Siba.settings && Siba.settings["tmp_dir"]
|
52
52
|
tmp_path = nil
|
53
53
|
if tmp_dir_from_settings.nil?
|
54
|
-
tmp_path = siba_file.dir_mktmpdir TmpDirPrefix
|
54
|
+
tmp_path = siba_file.dir_mktmpdir TmpDirPrefix
|
55
55
|
else
|
56
56
|
tmp_path = File.join(siba_file.file_expand_path(tmp_dir_from_settings),
|
57
57
|
"#{TmpDirPrefix}#{Siba::TestFiles.random_suffix}")
|
@@ -61,7 +61,7 @@ settings:
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
module TmpDirPlug
|
66
66
|
include Siba::FilePlug
|
67
67
|
include Siba::LoggerPlug
|
data/lib/siba/version.rb
CHANGED
data/scaffolds/archive.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Siba::C6y
|
4
|
-
module Demo
|
5
|
-
class Init
|
4
|
+
module Demo
|
5
|
+
class Init
|
6
6
|
include Siba::FilePlug
|
7
7
|
include Siba::LoggerPlug
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
## init_example.rb ##
|
11
|
-
end
|
11
|
+
end
|
12
12
|
|
13
13
|
# Archive the contents of sources_dir and put it to dest_dir.
|
14
14
|
# Return the archive file name. It must start with dest_file_name
|
data/scaffolds/destination.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Siba::C6y
|
4
|
-
module Demo
|
5
|
-
class Init
|
4
|
+
module Demo
|
5
|
+
class Init
|
6
6
|
include Siba::FilePlug
|
7
7
|
include Siba::LoggerPlug
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
## init_example.rb ##
|
11
|
-
end
|
11
|
+
end
|
12
12
|
|
13
13
|
# Put backup file (path_to_backup_file) to destination
|
14
14
|
# No return value is expected
|
15
|
-
def backup(path_to_backup_file)
|
15
|
+
def backup(path_to_backup_file)
|
16
16
|
## examples.rb ##
|
17
17
|
end
|
18
18
|
|
data/scaffolds/encryption.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Siba::C6y
|
4
|
-
module Demo
|
5
|
-
class Init
|
4
|
+
module Demo
|
5
|
+
class Init
|
6
6
|
include Siba::FilePlug
|
7
7
|
include Siba::LoggerPlug
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
## init_example.rb ##
|
11
|
-
end
|
11
|
+
end
|
12
12
|
|
13
13
|
# Encrypt backup archive file (path_to_archive) and put it to dest_dir.
|
14
14
|
# Return the name of encrypted file. It must begin with archive name
|
@@ -16,10 +16,10 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
|
-
|
19
|
+
|
20
20
|
s.add_runtime_dependency 'siba', '~>siba_version'
|
21
21
|
|
22
|
-
s.add_development_dependency 'minitest', '~>
|
22
|
+
s.add_development_dependency 'minitest', '~>3.0'
|
23
23
|
s.add_development_dependency 'rake', '~>0.9'
|
24
24
|
s.add_development_dependency 'guard-minitest', '~>0.4'
|
25
25
|
end
|
@@ -8,11 +8,11 @@ require 'siba-c6y-demo/init'
|
|
8
8
|
describe Siba::C6y::Demo::Init do
|
9
9
|
it "should run integration test" do
|
10
10
|
# All file operations will work normally in integration tests
|
11
|
-
# You can use the following helper methods
|
12
|
-
|
11
|
+
# You can use the following helper methods
|
12
|
+
|
13
13
|
# Get path to test tmp dir (will be cleaned automatically after each test)
|
14
14
|
SibaTest.tmp_dir
|
15
|
-
|
15
|
+
|
16
16
|
# Make a sub dir with a random name in a test tmp dir
|
17
17
|
tmp_sub_dir = mkdir_in_tmp_dir "prefix"
|
18
18
|
|
@@ -27,7 +27,7 @@ describe Siba::C6y::Demo::Init do
|
|
27
27
|
dirs_same? path_to_test_dir, path_to_test_dir2
|
28
28
|
|
29
29
|
# Read test yml and replace values (see siba/test/integration/yml/valid.yml)
|
30
|
-
# path_to_options = prepare_options path_to_yml,
|
30
|
+
# path_to_options = prepare_options path_to_yml,
|
31
31
|
# { src_dir: path_to_test_dir,
|
32
32
|
# src_file: path_to_test_file,
|
33
33
|
# dest_dir: path_to_test_dir2 }
|
@@ -7,31 +7,31 @@ require 'siba-c6y-demo/init'
|
|
7
7
|
# 'rake' command runs unit tests
|
8
8
|
# 'guard' command will run unit tests automatically
|
9
9
|
describe Siba::C6y::Demo do
|
10
|
-
before do
|
10
|
+
before do
|
11
11
|
@yml_path = File.expand_path('../yml', __FILE__)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should load plugin" do
|
15
15
|
# helper to load options from YAML from @yml_path dir
|
16
|
-
options_hash = load_options "valid"
|
16
|
+
options_hash = load_options "valid"
|
17
17
|
|
18
18
|
plugin = Siba::C6y::Demo::Init.new options_hash
|
19
19
|
plugin.must_be_instance_of Siba::C6y::Demo::Init
|
20
20
|
end
|
21
21
|
|
22
|
-
it "siba should load plugin" do
|
22
|
+
it "siba should load plugin" do
|
23
23
|
# helper to load the plugin by siba (build and install demo gem to make it work)
|
24
|
-
# @plugin_category = "c6y"
|
25
|
-
# @plugin_type = "demo"
|
26
|
-
# plugin = create_plugin "valid"
|
24
|
+
# @plugin_category = "c6y"
|
25
|
+
# @plugin_type = "demo"
|
26
|
+
# plugin = create_plugin "valid"
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should check log" do
|
30
30
|
# ... code
|
31
31
|
# must_log "info"
|
32
32
|
# wont_log "warn"
|
33
33
|
# wont_log_from "warn"
|
34
|
-
# show_log
|
34
|
+
# show_log
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should verify file operations" do
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
# -- File operations --
|
12
12
|
# "siba_file" object is available after including Siba::FilePlug
|
13
|
-
# You can use it for file operations
|
13
|
+
# You can use it for file operations
|
14
14
|
# instead of calling Dir, File, FileUtils directly.
|
15
15
|
# It mocks all methods of these classes in unit tests
|
16
16
|
# but runs them normally and in integration tests.
|
@@ -35,11 +35,11 @@
|
|
35
35
|
tmp_dir = Siba.tmp_dir
|
36
36
|
|
37
37
|
# Create a sub-dir with a random name in the temp dir
|
38
|
-
path_to_tmp_dir = Siba::TestFiles.mkdir_in_tmp_dir "you_dir_prefix"
|
38
|
+
path_to_tmp_dir = Siba::TestFiles.mkdir_in_tmp_dir "you_dir_prefix"
|
39
39
|
|
40
|
-
# Note: Siba.tmp_dir will be removed automatically,
|
40
|
+
# Note: Siba.tmp_dir will be removed automatically,
|
41
41
|
# so there is no need to clean anything.
|
42
|
-
|
42
|
+
|
43
43
|
# Some Siba::FileHelper methods
|
44
44
|
files_and_dirs = Siba::FileHelper.entries current_dir
|
45
45
|
my_file = File.join tmp_dir, "myfile"
|
data/scaffolds/source.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Siba::C6y
|
4
|
-
module Demo
|
5
|
-
class Init
|
4
|
+
module Demo
|
5
|
+
class Init
|
6
6
|
include Siba::FilePlug
|
7
7
|
include Siba::LoggerPlug
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
## init_example.rb ##
|
11
|
-
end
|
11
|
+
end
|
12
12
|
|
13
13
|
# Collect source files and put them into dest_dir
|
14
14
|
# No return value is expected
|
@@ -16,7 +16,7 @@ module Siba::C6y
|
|
16
16
|
## examples.rb ##
|
17
17
|
end
|
18
18
|
|
19
|
-
# Restore source files from_dir
|
19
|
+
# Restore source files from_dir
|
20
20
|
# No return value is expected
|
21
21
|
def restore(from_dir)
|
22
22
|
end
|