dustcart 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 +4 -4
- data/lib/dustcart/group.rb +6 -0
- data/lib/dustcart/input/postgres.rb +8 -8
- data/lib/dustcart/resource_base.rb +8 -0
- data/lib/dustcart/version.rb +1 -1
- data/lib/helper/zip_file_generator.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f6f4cdffc6b9b6d502c261fb85d5ac562982730
|
4
|
+
data.tar.gz: c24258a740ddc6f15ba5eab0d93bec3564e6ccd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c27992ffc124339e4ee32395af7bd1b09306e7641f6d802d50d7fa23f9a0253efe9f9caa48d31f001af9f619a850dba40a5e9818fa8e6b6b65fae7941b017bf7
|
7
|
+
data.tar.gz: 09efcf880baef4bc355c06bd13db02a3b781eee5cda6db860039927805ac4d8d4d6a7fa3e7c98d235f62b2bd4dbe7d6706734b713d7c789571ef8d91ac21f8cc
|
data/lib/dustcart/group.rb
CHANGED
@@ -15,6 +15,8 @@ module Dustcart
|
|
15
15
|
].freeze
|
16
16
|
|
17
17
|
def initialize(group_class, dir)
|
18
|
+
print_initialize_comment(group_class)
|
19
|
+
|
18
20
|
@temp_dir = dir
|
19
21
|
initialize_classes(group_class)
|
20
22
|
end
|
@@ -69,5 +71,9 @@ module Dustcart
|
|
69
71
|
def require_files(files)
|
70
72
|
files.each { |file| require file }
|
71
73
|
end
|
74
|
+
|
75
|
+
def print_initialize_comment(group_class)
|
76
|
+
puts "Group: #{group_class}"
|
77
|
+
end
|
72
78
|
end
|
73
79
|
end
|
@@ -10,17 +10,17 @@ module Dustcart
|
|
10
10
|
define_attribute :port
|
11
11
|
define_attribute :user
|
12
12
|
define_attribute :pass
|
13
|
+
define_attribute :command
|
13
14
|
attr_reader :database_name
|
14
15
|
|
15
|
-
COMMAND = 'pg_dump'.freeze
|
16
|
-
|
17
16
|
def initialize(to_dir, database_name, &block)
|
18
17
|
super(to_dir, &block)
|
19
18
|
@database_name = database_name
|
20
19
|
|
21
|
-
host
|
22
|
-
port
|
23
|
-
label
|
20
|
+
host '127.0.0.1' unless host
|
21
|
+
port '5432' unless port
|
22
|
+
label 'database.dump' unless label
|
23
|
+
command 'pg_dump' unless command
|
24
24
|
end
|
25
25
|
|
26
26
|
def precheck
|
@@ -28,8 +28,8 @@ module Dustcart
|
|
28
28
|
|
29
29
|
requirements
|
30
30
|
|
31
|
-
raise <<-EOS.unindent unless SystemCommand.exists?(
|
32
|
-
#{
|
31
|
+
raise <<-EOS.unindent unless SystemCommand.exists?(command)
|
32
|
+
#{command} command is not installed
|
33
33
|
EOS
|
34
34
|
|
35
35
|
raise <<-EOS.unindent unless database_name
|
@@ -56,7 +56,7 @@ module Dustcart
|
|
56
56
|
def create_dump
|
57
57
|
pipeline = CommandPipeline.new
|
58
58
|
pipeline.add(
|
59
|
-
"#{password_env} #{
|
59
|
+
"#{password_env} #{Shellwords.escape(command)} #{options} #{Shellwords.escape(database_name)}"
|
60
60
|
)
|
61
61
|
pipeline.run
|
62
62
|
end
|
@@ -8,6 +8,8 @@ module Dustcart
|
|
8
8
|
@defined_attributes ||= {}
|
9
9
|
|
10
10
|
def initialize(dir, &block)
|
11
|
+
print_initialize_comment
|
12
|
+
|
11
13
|
@dump_dir = dir
|
12
14
|
@attributes ||= {}
|
13
15
|
instance_eval(&block) if block
|
@@ -54,6 +56,12 @@ module Dustcart
|
|
54
56
|
@defined_attributes[name] = nil unless @defined_attributes.key?(name)
|
55
57
|
end
|
56
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def print_initialize_comment
|
63
|
+
puts " Resource: #{self.class.name.split('::').last}"
|
64
|
+
end
|
57
65
|
end
|
58
66
|
end
|
59
67
|
end
|
data/lib/dustcart/version.rb
CHANGED
@@ -34,7 +34,7 @@ class ZipFileGenerator
|
|
34
34
|
entries.each do |entry|
|
35
35
|
zip_file_path = path == '' ? entry : File.join(path, entry)
|
36
36
|
disk_file_path = File.join(@input_dir, zip_file_path)
|
37
|
-
puts "Deflating #{disk_file_path}"
|
37
|
+
puts " Deflating #{disk_file_path}"
|
38
38
|
|
39
39
|
if File.directory? disk_file_path
|
40
40
|
recursively_deflate_directory(disk_file_path, io, zip_file_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dustcart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya TAMANO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|