dbmanager 0.4.0 → 0.4.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTA4NzU3YWVlMjAzYmIxNDUxZmRlM2QzMzRkM2Y0MDM3ODM5NzFiNg==
4
+ MjcwZmJiMTE4YzU4Nzk1NDhlZGYxZTQ1MWI3MjgxMDRmOWFiZjIxNQ==
5
5
  data.tar.gz: !binary |-
6
- NTgxYmExNWYxZmE5ZGE5MDU0MmQxYjliOGU5NDQxMzkwOGQwNmFkZA==
6
+ ODUxYzM5NGZlZWU0NDQ0OGQ5ZWM3ZWQzODFlYzc2OGFhOGZjZDg0Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDFhYTlkZDQzZDMzNTY3NmM3NDQ2NTVmZTU0OTcyYTg0ZjcyMmRkODE1YjFm
10
- YjNmNjljY2RkYWY1MmNhN2NlYTU4ZjdmNWJmMTBjYjA1NzY0ZTUzMmQxNzk2
11
- NWNhNzIwMGI3Njc2YWVlYTViMTVmNTk0ZGUwYTUxMzE2NTc2ZTA=
9
+ MjZmMDhkZjliMjZiOTQwMGQwZTBmYzY5YjRkNDY3NDA1ZDBhMzI1ZmVmMDM3
10
+ NzU2ZWZjYmQ4MGZiZjAwYzUyNWFiNWE4OGU1MzY1MzNiMzgxYjgwMTIxMGM3
11
+ YzkxNmRhM2ZkZWIzOGMwNGM4YzcyZTUwMDNkNjdiMTgxZDYwZjc=
12
12
  data.tar.gz: !binary |-
13
- M2ZiOWI1Y2YxNGNkNDJhMzc5MmQ0NDYwNGNmMGJjNGFlZmRiNjY1OGE1MDE5
14
- NWE3YjZkM2NkNDMwMTRiYmQ1MTJhYTZiMGI0NjJlZDQwNzMzZWUzODRlZjg5
15
- NDAwMmFhNDEyY2RhNDRlN2Y3YmI5YjZjNWU1MjA5ZjlmZmM1YTk=
13
+ Y2JhODRmNWQ0OTU3MTZkNGJiNmVlNWQ1MjkyNWJiYTMxNTVhZDc3Y2VlNzJj
14
+ OGJmYzI2YjkxNjZjMzMzMmY5YWVlNGExNWRmZGQ5Mzc0N2QzZGQ5MmU0MzFl
15
+ YWIyZDc5NDYxOTdhOTVmMmM2MTRjYThmMTQ1MzQ2ZjNkZTNmMWI=
@@ -1,3 +1,7 @@
1
+ ## v0.4.1
2
+
3
+ * capistrano recipe bug fixes
4
+
1
5
  ## v0.4.0
2
6
 
3
7
  * add capistrano integration via db:import task
data/README.md CHANGED
@@ -113,6 +113,35 @@ ignoretables directive:
113
113
  ```
114
114
 
115
115
 
116
+ ## Capistrano Integration
117
+
118
+ You can use DBmanager via Capistrano as well. At the moment the only available
119
+ task is import the remote databases into your local machine. The use is currently
120
+ limited to Capistrano 2.x
121
+
122
+ You can do that by running
123
+
124
+ ```bash
125
+ bundle exec cap <environment> db:import
126
+ ```
127
+
128
+ ### Custom Capistrano configuration
129
+
130
+ If you need to change some configuration option (notably overwrite database configurations from
131
+ database.yml such as username, password and so on) you need to set those custom values in your
132
+ deployment recipe.
133
+ For example, if you need to set the remote database password using the remote ENV values you
134
+ should add:
135
+
136
+ ```ruby
137
+ set :dbmanager_remote_env, lambda {
138
+ Dbmanager::YmlParser.environments[rails_env.to_s].tap do |env|
139
+ env.password = capture('echo $MYSQL_PASSWORD').chomp
140
+ end
141
+ }
142
+ ```
143
+
144
+
116
145
  ## Documentation
117
146
 
118
147
  You can find some more documentation on the workings of the gem on relish:
@@ -19,7 +19,12 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'rails'
22
+ if RUBY_VERSION.to_f > 1.8
23
+ s.add_dependency 'rails'
24
+ else
25
+ s.add_dependency 'rails', '< 4'
26
+ s.add_development_dependency 'listen', '1.3.1'
27
+ end
23
28
  s.add_development_dependency 'rspec', '~> 2.12'
24
29
  s.add_development_dependency 'rake'
25
30
  s.add_development_dependency 'mysql2'
@@ -113,6 +113,35 @@ ignoretables directive:
113
113
  ```
114
114
 
115
115
 
116
+ ## Capistrano Integration
117
+
118
+ You can use DBmanager via Capistrano as well. At the moment the only available
119
+ task is import the remote databases into your local machine. The use is currently
120
+ limited to Capistrano 2.x
121
+
122
+ You can do that by running
123
+
124
+ ```bash
125
+ bundle exec cap <environment> db:import
126
+ ```
127
+
128
+ ### Custom Capistrano configuration
129
+
130
+ If you need to change some configuration option (notably overwrite database configurations from
131
+ database.yml such as username, password and so on) you need to set those custom values in your
132
+ deployment recipe.
133
+ For example, if you need to set the remote database password using the remote ENV values you
134
+ should add:
135
+
136
+ ```ruby
137
+ set :dbmanager_remote_env, lambda {
138
+ Dbmanager::YmlParser.environments[rails_env.to_s].tap do |env|
139
+ env.password = capture('echo $MYSQL_PASSWORD').chomp
140
+ end
141
+ }
142
+ ```
143
+
144
+
116
145
  ## Documentation
117
146
 
118
147
  You can find some more documentation on the workings of the gem on relish:
@@ -1,3 +1,4 @@
1
+ require 'active_support/deprecation'
1
2
  require 'active_support/all'
2
3
 
3
4
  module Dbmanager
@@ -1,34 +1,41 @@
1
- _cset :dbmanager_remote_env, lambda {
2
- Dbmanager::YmlParser.environments[rails_env.to_s]
3
- }
4
-
1
+ if defined?(Capistrano::Version) && Gem::Version.new(Capistrano::Version).release >= Gem::Version.new("3.0")
2
+ raise 'Capistrano 3 is not supported yet!'
3
+ end
5
4
 
6
- _cset :dbmanager_local_env, lambda {
7
- Dbmanager::YmlParser.environments[Rails.env]
8
- }
5
+ Capistrano::Configuration.instance(:must_exist).load do
6
+ # Those config vars can be overridden in your recipes
7
+ # in order to customize the dbmanager settings:
8
+ _cset :dbmanager_remote_env, lambda {
9
+ Dbmanager::YmlParser.environments[rails_env.to_s]
10
+ }
9
11
 
12
+ _cset :dbmanager_local_env, lambda {
13
+ Dbmanager::YmlParser.environments[Rails.env]
14
+ }
10
15
 
11
- namespace :db do
12
- task :import do
13
- require File.expand_path('../environment', __FILE__)
14
- require 'dbmanager'
15
- require 'open3'
16
+ namespace :db do
17
+ task :import do
18
+ require 'config/environment.rb'
19
+ require 'active_support/core_ext'
20
+ require 'dbmanager'
21
+ require 'open3'
16
22
 
17
- dumper = Dbmanager::Adapters::Mysql::Dumper.new(dbmanager_remote_env, '/dev/stdout')
18
- loader = Dbmanager::Adapters::Mysql::Loader.new(dbmanager_local_env, '/dev/stdin')
19
- dumper.mysqldump_version = dumper.extract_version capture('mysqldump --version')
23
+ dumper = Dbmanager::Adapters::Mysql::Dumper.new(dbmanager_remote_env, '/dev/stdout')
24
+ loader = Dbmanager::Adapters::Mysql::Loader.new(dbmanager_local_env, '/dev/stdin')
25
+ dumper.mysqldump_version = dumper.extract_version capture('mysqldump --version')
20
26
 
21
- Open3.popen3 loader.load_command do |input, output, error|
22
- begin
23
- run dumper.dump_command do |channel, stream, data|
24
- input << data if stream == :out
25
- raise data if stream == :err
27
+ Open3.popen3 loader.load_command do |input, output, error|
28
+ begin
29
+ run dumper.dump_command do |channel, stream, data|
30
+ input << data if stream == :out
31
+ raise data if stream == :err
32
+ end
33
+ input.close
34
+ ensure
35
+ output.read.tap { |s| puts "OUT: #{s}" unless s.empty? }
36
+ error.read.tap { |s| puts "ERR: #{s}" unless s.empty? }
26
37
  end
27
- input.close
28
- ensure
29
- output.read.tap { |s| puts "OUT: #{s}" unless s.empty? }
30
- error.read.tap { |s| puts "ERR: #{s}" unless s.empty? }
31
38
  end
32
39
  end
33
40
  end
34
- end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module Dbmanager
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrea longhi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails