db_replicator 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a550c35aaa759054879bed457b8c93c1c0850eed
4
- data.tar.gz: e982b43bf8ebfe6a4893f375eee65168d06ccb25
3
+ metadata.gz: 37c550fb1526a95cec8f37ba2b70f04d5faa9a1b
4
+ data.tar.gz: 903c1c7fbe92ffce66d16da7ea55849ca8e43caf
5
5
  SHA512:
6
- metadata.gz: 65a35755a6ef13683f1dd46b63d028b12abbe75593265daa590357194aee7e7cdb7a7e0dfd3db76999df3cf01a8bbd361fb03a1ed87f854a323ae6851e4b3d7e
7
- data.tar.gz: d98919eccc50f9702e24f3f1d73b86f8a9afd6a682b4447f600082083e609239cf0091a00535255ff4081cf8f6427370f2593103442980d1883d3c2f03341b83
6
+ metadata.gz: d0c947e06ebc83626781fc14c49ea676b2ff6c5343841062a26135c4521f668b92d4396e5aafbd3c43bd0beef7b56f5a3c2b5d68c9c145f724d07aa81881ef61
7
+ data.tar.gz: e2356f366329c31d6de9d9050f5ca492d433c87e9c44568d18f1b55b07528dab562eb8616b8889fb3b5bf4cd7717d3f87a97c17b4ae9ba0ebcaabea3f6fd7f6e
@@ -20,13 +20,13 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
- spec.add_development_dependency 'generator_spec'
24
- spec.add_development_dependency 'rspec'
25
- spec.add_development_dependency 'rubocop'
26
- spec.add_runtime_dependency 'sequel', '~> 4.15.0'
27
- spec.add_runtime_dependency 'ruby-progressbar'
28
- spec.add_runtime_dependency 'rails', '>= 4'
29
- spec.add_runtime_dependency 'colorize'
23
+ spec.add_development_dependency 'generator_spec', '~> 0'
24
+ spec.add_development_dependency 'rspec', '~> 3', '>= 3'
25
+ spec.add_development_dependency 'rubocop', '~> 0'
26
+ spec.add_runtime_dependency 'sequel', '~> 4.15', '>= 4.15.0'
27
+ spec.add_runtime_dependency 'ruby-progressbar', '~> 0'
28
+ spec.add_runtime_dependency 'rails', '~> 3', '>= 3'
29
+ spec.add_runtime_dependency 'colorize', '~> 0'
30
30
 
31
31
  spec.required_ruby_version = '~> 2.0'
32
32
 
@@ -3,10 +3,15 @@ require 'net/scp'
3
3
  require 'ruby-progressbar'
4
4
  module DbReplicator
5
5
  class Downloader
6
+ def self.mysqldump_command
7
+ "mysqldump -u #{DbReplicator.prod_db_configs['username']} --password=#{DbReplicator.prod_db_configs['password']} --verbose #{DbReplicator.prod_db_configs['database']} > #{DbReplicator.dump_file_name}"
8
+ end
6
9
  def self.download_production
7
10
  Net::SSH.start(DbReplicator.configuration.proxy_host, DbReplicator.configuration.user) do |session|
8
11
  DbReplicator.document_action 'Creating MySQL dump file.', 'Create complete.' do
9
- session.exec! "mysqldump -u #{DbReplicator.prod_db_configs['user']} --password=#{DbReplicator.prod_db_configs['password']} #{DbReplicator.prod_db_configs['database']} > #{DbReplicator.dump_file_name}"
12
+ puts "Connecting to #{DbReplicator.configuration.proxy_host} and executing: #{mysqldump_command}".colorize(:yellow)
13
+ puts "mysqldump output #{"-" * 80}"
14
+ puts session.exec! mysqldump_command
10
15
  end
11
16
  DbReplicator.document_action 'Downloading MySQL dump file', 'Download complete.' do
12
17
  pb = ProgressBar.create(format: '%t %B %p%% %a')
@@ -1,3 +1,3 @@
1
1
  module DbReplicator
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/db_replicator.rb CHANGED
@@ -34,7 +34,7 @@ module DbReplicator
34
34
  end
35
35
 
36
36
  def self.dumps_dir
37
- File.join Rails.root, '.db_replicator_dumps'
37
+ File.join(Rails.root.join('.db_replicator_dumps'))
38
38
  end
39
39
 
40
40
  def self.dump_file
@@ -10,15 +10,16 @@ module DbReplicator
10
10
 
11
11
  def create_dumps_dir
12
12
  empty_directory '.db_replicator_dumps'
13
+ create_file '.db_replicator_dumps/.gitkeep'
13
14
  end
14
15
 
15
16
  def add_dumps_dir_to_gitignore
16
17
  if File.exist?(File.join(destination_root, '.gitignore'))
17
18
  append_to_file '.gitignore' do
18
- '.db_replicator_dumps'
19
+ '/.db_replicator_dumps/*.sql'
19
20
  end
20
21
  else
21
- create_file '.gitignore', '.db_replicator_dumps'
22
+ create_file '.gitignore', '/.db_replicator_dumps/*.sql'
22
23
  end
23
24
  end
24
25
  end
@@ -1 +1 @@
1
- .db_replicator_dumps
1
+ /.db_replicator_dumps/*.sql
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_replicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Eatherly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,42 +42,48 @@ dependencies:
42
42
  name: generator_spec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
59
62
  - - ">="
60
63
  - !ruby/object:Gem::Version
61
- version: '0'
64
+ version: '3'
62
65
  type: :development
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '3'
66
72
  - - ">="
67
73
  - !ruby/object:Gem::Version
68
- version: '0'
74
+ version: '3'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rubocop
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - ">="
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - ">="
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  - !ruby/object:Gem::Dependency
@@ -85,6 +91,9 @@ dependencies:
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '4.15'
96
+ - - ">="
88
97
  - !ruby/object:Gem::Version
89
98
  version: 4.15.0
90
99
  type: :runtime
@@ -92,48 +101,57 @@ dependencies:
92
101
  version_requirements: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '4.15'
106
+ - - ">="
95
107
  - !ruby/object:Gem::Version
96
108
  version: 4.15.0
97
109
  - !ruby/object:Gem::Dependency
98
110
  name: ruby-progressbar
99
111
  requirement: !ruby/object:Gem::Requirement
100
112
  requirements:
101
- - - ">="
113
+ - - "~>"
102
114
  - !ruby/object:Gem::Version
103
115
  version: '0'
104
116
  type: :runtime
105
117
  prerelease: false
106
118
  version_requirements: !ruby/object:Gem::Requirement
107
119
  requirements:
108
- - - ">="
120
+ - - "~>"
109
121
  - !ruby/object:Gem::Version
110
122
  version: '0'
111
123
  - !ruby/object:Gem::Dependency
112
124
  name: rails
113
125
  requirement: !ruby/object:Gem::Requirement
114
126
  requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '3'
115
130
  - - ">="
116
131
  - !ruby/object:Gem::Version
117
- version: '4'
132
+ version: '3'
118
133
  type: :runtime
119
134
  prerelease: false
120
135
  version_requirements: !ruby/object:Gem::Requirement
121
136
  requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '3'
122
140
  - - ">="
123
141
  - !ruby/object:Gem::Version
124
- version: '4'
142
+ version: '3'
125
143
  - !ruby/object:Gem::Dependency
126
144
  name: colorize
127
145
  requirement: !ruby/object:Gem::Requirement
128
146
  requirements:
129
- - - ">="
147
+ - - "~>"
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :runtime
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
135
153
  requirements:
136
- - - ">="
154
+ - - "~>"
137
155
  - !ruby/object:Gem::Version
138
156
  version: '0'
139
157
  description: ''
@@ -230,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
248
  version: '0'
231
249
  requirements: []
232
250
  rubyforge_project:
233
- rubygems_version: 2.2.0
251
+ rubygems_version: 2.2.2
234
252
  signing_key:
235
253
  specification_version: 4
236
254
  summary: ''
@@ -284,4 +302,3 @@ test_files:
284
302
  - spec/spec_helper.rb
285
303
  - spec/tmp/.gitignore
286
304
  - spec/tmp/config/initializers/db_replicator.rb
287
- has_rdoc: