dbmgr 0.1.1 → 0.1.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d1dd1b1c4498d17630846da00f5b97f6c82d349
4
- data.tar.gz: 2cbd2c5c15f7f98bbb0746bca2bb57221a3b0e1c
3
+ metadata.gz: 9c1d63aa7bc4f6795171479e42483e54e207c7cb
4
+ data.tar.gz: 7921f72d031bafcc7935b943a141cd79c68391e3
5
5
  SHA512:
6
- metadata.gz: 615fcbaccb80e6a6ad9275002b3b55817c8d66f96243f61e9fa9e4b218aae5ffa1125afeb33cc9e10a91b571ad399247c95493f211a96e88dba9ee8c272a96b6
7
- data.tar.gz: bf9b35ad59cf5bf4117699e6d51cd2a05e6b1fe2e842996c46d12b1ed698cda904cb30592e6a6935e114f388516c3e9cfb97db6ddc3c2c5c4ef1f178aaee84e2
6
+ metadata.gz: b4e81173f851f17c5561353da4dba82bfbb5804cdf38504ff67617d7fb521f673f0179161377a498fb31e5ea61b30d4dad8b004dcae54c0fdedcfa2b55965a60
7
+ data.tar.gz: 7870b8b83dc3d899a139b61e34d19b29cae250a6b4cc389c84c8b680fefd59aa61c469f261bf71fcf7dc786a2885ebfebf96caa6562af065b5a41cd5aa933971
data/bin/dbmgr CHANGED
@@ -1,5 +1,9 @@
1
- #!/usr/bin/env ruby -WU
1
+ #!/usr/bin/env ruby
2
+
3
+ DBMGR_HOME = File.expand_path('../..', __FILE__)
4
+
5
+ $LOAD_PATH.unshift(File.join(DBMGR_HOME, 'lib'))
2
6
 
3
7
  require 'dbmgr'
4
8
 
5
- Dbmgr::DbMgr.start( ARGV )
9
+ Dbmgr::DbMgr.start(ARGV)
data/bin/dbmgr-dev ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby -WU
2
+
3
+ require 'dbmgr'
4
+
5
+ Dbmgr::DbMgr.start( ARGV )
data/dbmgr.gemspec CHANGED
@@ -9,6 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Cody"]
10
10
  spec.email = ["callahanrts@gmail.com"]
11
11
 
12
+ spec.required_ruby_version = '< 2.4'
13
+
12
14
  spec.summary = %q{Create database backups and restore from previously created backups}
13
15
  spec.description = %q{Create database backups to share with others across your dev team. Other developers can restore from backups you've created.}
14
16
  spec.homepage = "https://github.com/callahanrts/dbmgr"
@@ -18,7 +20,7 @@ Gem::Specification.new do |spec|
18
20
  f.match(%r{^(test|spec|features)/})
19
21
  end
20
22
  spec.bindir = "bin"
21
- spec.executables = spec.files.grep(%r{^bin/dbmgr}) { |f| File.basename(f) }
23
+ spec.executables = spec.files.grep(%r{^bin/dbmgr$}) { |f| File.basename(f) }
22
24
  spec.require_paths = ["lib"]
23
25
 
24
26
  spec.add_dependency 'thor'
@@ -26,4 +28,5 @@ Gem::Specification.new do |spec|
26
28
  spec.add_development_dependency "bundler", "~> 1.13"
27
29
  spec.add_development_dependency "rake", "~> 10.0"
28
30
  spec.add_development_dependency "minitest", "~> 5.0"
31
+ spec.add_development_dependency "mysql2", "~> 0.4.5"
29
32
  end
data/dbmgr.rb ADDED
@@ -0,0 +1,20 @@
1
+
2
+ class Dbmgr < Formula
3
+
4
+ desc "Backup and restore development databases"
5
+ homepage "https://github.com/callahanrts/dbmgr"
6
+ url "https://github.com/callahanrts/dbmgr/archive/v0.1.2.tar.gz"
7
+
8
+ head "https://github.com/callahanrts/dbmgr.git"
9
+ bottle :unneeded
10
+
11
+ def install
12
+ lib.install Dir["lib/*"]
13
+ bin.install "bin/dbmgr"
14
+ end
15
+
16
+ test do
17
+ system "#{bin}/dbmgr", "help"
18
+ end
19
+
20
+ end
@@ -7,11 +7,39 @@ module Dbmgr::CLI
7
7
  # Backup
8
8
  #
9
9
  desc "backup [database_name]", "Create a backup"
10
- method_option :filename, aliases: ["f"], type: :string, banner: "my_backup.sql", desc: "Name of the backup created"
11
- method_option :path, aliases: ["p"], type: :string, default: "#{ENV["HOME"]}/.db_backups", banner: "#{ENV["HOME"]}/.db_backups", desc: "Directory of database backups"
12
- method_option :dbport, aliases: ["P"], type: :numeric, default: 3306, banner: "3306", desc: "MySQL database port"
13
- method_option :dbhost, aliases: ["h"], type: :string, default: "localhost", banner: "localhost", desc: "MySQL database host"
14
- method_option :dbuser, aliases: ["u"], type: :string, default: "root", banner: "root", desc: "MySQL database user"
10
+ method_option :filename,
11
+ aliases: ["f"],
12
+ type: :string,
13
+ banner: "my_backup.sql",
14
+ desc: "Name of the backup created"
15
+
16
+ method_option :path,
17
+ aliases: ["p"],
18
+ type: :string,
19
+ default: "#{ENV["HOME"]}/.db_backups",
20
+ banner: "#{ENV["HOME"]}/.db_backups",
21
+ desc: "Directory of database backups"
22
+
23
+ method_option :dbport,
24
+ aliases: ["P"],
25
+ type: :numeric,
26
+ default: 3306,
27
+ banner: "3306",
28
+ desc: "MySQL database port"
29
+
30
+ method_option :dbhost,
31
+ aliases: ["h"],
32
+ type: :string,
33
+ default: "localhost",
34
+ banner: "localhost",
35
+ desc: "MySQL database host"
36
+
37
+ method_option :dbuser,
38
+ aliases: ["u"],
39
+ type: :string,
40
+ default: "root",
41
+ banner: "root",
42
+ desc: "MySQL database user"
15
43
 
16
44
  def backup db_name
17
45
  puts "Backing up '#{db_name}' to '#{options[:path]}'..."
@@ -29,11 +57,39 @@ module Dbmgr::CLI
29
57
  # Restore
30
58
  #
31
59
  desc "restore", "Restore from a backup"
32
- method_option :backup, aliases: ["b"], type: :string, banner: "#{ENV["HOME"]}/.db_backups/backup.sql", desc: "Path to backup to restore from"
33
- method_option :path, aliases: ["p"], type: :string, default: "#{ENV["HOME"]}/.db_backups", banner: "#{ENV["HOME"]}/.db_backups", desc: "Directory of database backups"
34
- method_option :dbport, aliases: ["P"], type: :numeric, default: 3306, banner: "3306", desc: "MySQL database port"
35
- method_option :dbhost, aliases: ["h"], type: :string, default: "localhost", banner: "localhost", desc: "MySQL database host"
36
- method_option :dbuser, aliases: ["u"], type: :string, default: "root", banner: "root", desc: "MySQL database user"
60
+ method_option :backup,
61
+ aliases: ["b"],
62
+ type: :string,
63
+ banner: "#{ENV["HOME"]}/.db_backups/backup.sql",
64
+ desc: "Path to backup to restore from"
65
+
66
+ method_option :path,
67
+ aliases: ["p"],
68
+ type: :string,
69
+ default: "#{ENV["HOME"]}/.db_backups",
70
+ banner: "#{ENV["HOME"]}/.db_backups",
71
+ desc: "Directory of database backups"
72
+
73
+ method_option :dbport,
74
+ aliases: ["P"],
75
+ type: :numeric,
76
+ default: 3306,
77
+ banner: "3306",
78
+ desc: "MySQL database port"
79
+
80
+ method_option :dbhost,
81
+ aliases: ["h"],
82
+ type: :string,
83
+ default: "localhost",
84
+ banner: "localhost",
85
+ desc: "MySQL database host"
86
+
87
+ method_option :dbuser,
88
+ aliases: ["u"],
89
+ type: :string,
90
+ default: "root",
91
+ banner: "root",
92
+ desc: "MySQL database user"
37
93
 
38
94
  def restore db_name
39
95
  puts "Create database if it doesn't exist..."
@@ -61,5 +117,3 @@ module Dbmgr::CLI
61
117
 
62
118
  end
63
119
  end
64
-
65
-
data/lib/dbmgr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dbmgr
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbmgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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-22 00:00:00.000000000 Z
11
+ date: 2016-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mysql2
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.4.5
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.4.5
69
83
  description: Create database backups to share with others across your dev team. Other
70
84
  developers can restore from backups you've created.
71
85
  email:
@@ -84,8 +98,10 @@ files:
84
98
  - Rakefile
85
99
  - bin/console
86
100
  - bin/dbmgr
101
+ - bin/dbmgr-dev
87
102
  - bin/setup
88
103
  - dbmgr.gemspec
104
+ - dbmgr.rb
89
105
  - examples/.dbmgr
90
106
  - lib/dbmgr.rb
91
107
  - lib/dbmgr/cli.rb
@@ -101,9 +117,9 @@ require_paths:
101
117
  - lib
102
118
  required_ruby_version: !ruby/object:Gem::Requirement
103
119
  requirements:
104
- - - '>='
120
+ - - <
105
121
  - !ruby/object:Gem::Version
106
- version: '0'
122
+ version: '2.4'
107
123
  required_rubygems_version: !ruby/object:Gem::Requirement
108
124
  requirements:
109
125
  - - '>='