dbmgr 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -24
- data/dbmgr.gemspec +1 -1
- data/examples/.dbmgr +8 -0
- data/lib/dbmgr/cli/mysql.rb +13 -1
- data/lib/dbmgr/version.rb +1 -1
- metadata +16 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1dd1b1c4498d17630846da00f5b97f6c82d349
|
4
|
+
data.tar.gz: 2cbd2c5c15f7f98bbb0746bca2bb57221a3b0e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 615fcbaccb80e6a6ad9275002b3b55817c8d66f96243f61e9fa9e4b218aae5ffa1125afeb33cc9e10a91b571ad399247c95493f211a96e88dba9ee8c272a96b6
|
7
|
+
data.tar.gz: bf9b35ad59cf5bf4117699e6d51cd2a05e6b1fe2e842996c46d12b1ed698cda904cb30592e6a6935e114f388516c3e9cfb97db6ddc3c2c5c4ef1f178aaee84e2
|
data/README.md
CHANGED
@@ -16,6 +16,10 @@ $ gem install dbmgr
|
|
16
16
|
## Usage
|
17
17
|
|
18
18
|
#### Backup
|
19
|
+
##### Help
|
20
|
+
```
|
21
|
+
dbmgr mysql help backup
|
22
|
+
```
|
19
23
|
```
|
20
24
|
dbmgr mysql backup --options
|
21
25
|
```
|
@@ -24,27 +28,3 @@ dbmgr mysql backup --options
|
|
24
28
|
```
|
25
29
|
dbmgr mysql restore --options
|
26
30
|
```
|
27
|
-
|
28
|
-
|
29
|
-
## Development
|
30
|
-
|
31
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test`
|
32
|
-
to run the tests. You can also run `bin/console` for an interactive prompt that will allow you
|
33
|
-
to experiment.
|
34
|
-
|
35
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new
|
36
|
-
version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
|
37
|
-
will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
38
|
-
[rubygems.org](https://rubygems.org).
|
39
|
-
|
40
|
-
## Contributing
|
41
|
-
|
42
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/callahanrts/dbmgr.
|
43
|
-
This project is intended to be a safe, welcoming space for collaboration, and contributors are
|
44
|
-
expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
45
|
-
|
46
|
-
|
47
|
-
## License
|
48
|
-
|
49
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
50
|
-
|
data/dbmgr.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
f.match(%r{^(test|spec|features)/})
|
19
19
|
end
|
20
20
|
spec.bindir = "bin"
|
21
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/dbmgr}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency 'thor'
|
data/examples/.dbmgr
ADDED
data/lib/dbmgr/cli/mysql.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module Dbmgr::CLI
|
2
4
|
class Mysql < Thor
|
3
5
|
|
@@ -12,7 +14,7 @@ module Dbmgr::CLI
|
|
12
14
|
method_option :dbuser, aliases: ["u"], type: :string, default: "root", banner: "root", desc: "MySQL database user"
|
13
15
|
|
14
16
|
def backup db_name
|
15
|
-
puts "Backing up #{db_name}..."
|
17
|
+
puts "Backing up '#{db_name}' to '#{options[:path]}'..."
|
16
18
|
file = options[:filename] || "#{db_name}_#{Time.now.to_i}.sql"
|
17
19
|
|
18
20
|
# Create the backups directory if it doesn't exist already
|
@@ -47,6 +49,16 @@ module Dbmgr::CLI
|
|
47
49
|
system("mysql -u#{options[:dbuser]} #{db_name} -h #{options[:dbhost]} -P #{options[:dbport]} < #{backup}")
|
48
50
|
end
|
49
51
|
|
52
|
+
private
|
53
|
+
|
54
|
+
def options
|
55
|
+
original = super
|
56
|
+
return original unless File.file?("#{ENV["HOME"]}/.dbmgr")
|
57
|
+
config = YAML::load_file("#{ENV["HOME"]}/.dbmgr") || {}
|
58
|
+
config[:dbmgr][:path].gsub!("~/", "#{ENV["HOME"]}/") # Expand ~/ manually
|
59
|
+
Thor::CoreExt::HashWithIndifferentAccess.new([original, config[:dbmgr], config[:mysql]].reduce &:merge)
|
60
|
+
end
|
61
|
+
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
data/lib/dbmgr/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbmgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.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: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '5.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.0'
|
69
69
|
description: Create database backups to share with others across your dev team. Other
|
@@ -71,14 +71,12 @@ description: Create database backups to share with others across your dev team.
|
|
71
71
|
email:
|
72
72
|
- callahanrts@gmail.com
|
73
73
|
executables:
|
74
|
-
- console
|
75
74
|
- dbmgr
|
76
|
-
- setup
|
77
75
|
extensions: []
|
78
76
|
extra_rdoc_files: []
|
79
77
|
files:
|
80
|
-
-
|
81
|
-
-
|
78
|
+
- .gitignore
|
79
|
+
- .travis.yml
|
82
80
|
- CODE_OF_CONDUCT.md
|
83
81
|
- Gemfile
|
84
82
|
- LICENSE.txt
|
@@ -88,6 +86,7 @@ files:
|
|
88
86
|
- bin/dbmgr
|
89
87
|
- bin/setup
|
90
88
|
- dbmgr.gemspec
|
89
|
+
- examples/.dbmgr
|
91
90
|
- lib/dbmgr.rb
|
92
91
|
- lib/dbmgr/cli.rb
|
93
92
|
- lib/dbmgr/cli/mysql.rb
|
@@ -102,17 +101,17 @@ require_paths:
|
|
102
101
|
- lib
|
103
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
103
|
requirements:
|
105
|
-
- -
|
104
|
+
- - '>='
|
106
105
|
- !ruby/object:Gem::Version
|
107
106
|
version: '0'
|
108
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
108
|
requirements:
|
110
|
-
- -
|
109
|
+
- - '>='
|
111
110
|
- !ruby/object:Gem::Version
|
112
111
|
version: '0'
|
113
112
|
requirements: []
|
114
113
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.4.7
|
116
115
|
signing_key:
|
117
116
|
specification_version: 4
|
118
117
|
summary: Create database backups and restore from previously created backups
|