capistrano-mysql_admin 0.0.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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +61 -0
- data/Rakefile +2 -0
- data/capistrano-mysql_admin.gemspec +23 -0
- data/lib/capistrano/mysql_admin.rb +2 -0
- data/lib/capistrano/mysql_admin/version.rb +5 -0
- data/lib/capistrano/tasks/mysql_admin.cap +59 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d31491f7bb61ead3be3ff727d4bd3fd061216678
|
4
|
+
data.tar.gz: 33291f3ca3a7f7ad62d317ee8df866ef60dc38f8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5396fd282fc294b302356de97a64330b83686a561c3d1a2a4a55581262da22c9da1e01cabfe8c7bcb5d91096480ab20fd8bf081fb65810c661319b775aae975b
|
7
|
+
data.tar.gz: 387cd18efd45301caaa630f65883ce2145a45821324a2694c9bae4fa47e53e8832b5e770bcf2ff1326619c0ef4ee3b1368df1f3aeef69ab527a84058a23fb2e8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Pim Snel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Capistrano::MysqlAdmin
|
2
|
+
|
3
|
+
This Capistrano 3 gem add's basic mysql admin tasks. Use this only on
|
4
|
+
devboxes like your Mac or your Vagrant box. Capistrano::MysqlAdmin is not developed with
|
5
|
+
security in mind.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
```bash
|
10
|
+
cap mysql_admin:create_db # create mysql database
|
11
|
+
cap mysql_admin:create_user # create mysql user
|
12
|
+
cap mysql_admin:drop_db # drop mysql database
|
13
|
+
cap mysql_admin:drop_user # drop mysql user
|
14
|
+
```
|
15
|
+
|
16
|
+
## Configuration Variables
|
17
|
+
|
18
|
+
Below all variables with their defaults:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
set :mysql_exec_dir, '/usr/bin'
|
22
|
+
|
23
|
+
set :mysql_admin_user, 'root'
|
24
|
+
set :mysql_admin_password, ''
|
25
|
+
set :mysql_admin_host, 'localhost'
|
26
|
+
|
27
|
+
set :mysql_db_name, ''
|
28
|
+
set :mysql_db_user, ''
|
29
|
+
set :mysql_db_password, ''
|
30
|
+
set :mysql_db_host, 'localhost'
|
31
|
+
```
|
32
|
+
|
33
|
+
## Installation
|
34
|
+
|
35
|
+
Add this line to your Capistrano Gemfile:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'capistrano-mysql_admin'
|
39
|
+
```
|
40
|
+
|
41
|
+
Add this line to your Capfile:
|
42
|
+
```ruby
|
43
|
+
require 'capistrano/mysql_admin'
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
And then execute:
|
48
|
+
|
49
|
+
$ bundle
|
50
|
+
|
51
|
+
Or install it yourself as:
|
52
|
+
|
53
|
+
$ gem install capistrano-mysql_admin
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
1. Fork it ( https://github.com/[my-github-username]/capistrano-mysql_admin/fork )
|
58
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
61
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/mysql_admin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-mysql_admin"
|
8
|
+
spec.version = Capistrano::MysqlAdmin::VERSION
|
9
|
+
spec.authors = ["Pim Snel"]
|
10
|
+
spec.email = ["pim@lingewoud.nl"]
|
11
|
+
spec.summary = %q{Capistrano 3 Task to create a mysql database}
|
12
|
+
spec.description = %q{Capistrano 3 Task to create a mysql database. Useful for dev boxes}
|
13
|
+
spec.homepage = "https://github.com/mipmip/capistrano-mysql_admin"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
set :mysql_exec_dir, '/usr/bin'
|
4
|
+
|
5
|
+
set :mysql_admin_user, 'root'
|
6
|
+
set :mysql_admin_password, ''
|
7
|
+
set :mysql_admin_host, 'localhost'
|
8
|
+
|
9
|
+
set :mysql_db_name, ''
|
10
|
+
set :mysql_db_user, ''
|
11
|
+
set :mysql_db_password, ''
|
12
|
+
set :mysql_db_host, 'localhost'
|
13
|
+
|
14
|
+
namespace :mysql_admin do
|
15
|
+
|
16
|
+
desc "create mysql user"
|
17
|
+
task :create_user do
|
18
|
+
mysql_pass_string = "-p'#{fetch(:mysql_admin_password)}'" unless fetch(:mysql_admin_password).chomp ==''
|
19
|
+
on roles(:all) do
|
20
|
+
execute "echo \"" \
|
21
|
+
"CREATE USER #{fetch(:mysql_db_user)}@localhost IDENTIFIED BY '#{fetch(:mysql_db_password)}';" \
|
22
|
+
"\" | #{fetch(:mysql_exec_dir)}/mysql #{fetch(mysql_pass_string)} -u#{fetch(:mysql_admin_user)} -h#{fetch(:mysql_admin_host)}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "drop mysql user"
|
27
|
+
task :drop_user do
|
28
|
+
mysql_pass_string = "-p'#{fetch(:mysql_admin_password)}'" unless fetch(:mysql_admin_password).chomp ==''
|
29
|
+
on roles(:all) do
|
30
|
+
execute "echo \"" \
|
31
|
+
"DROP USER #{fetch(:mysql_db_user)}@localhost;" \
|
32
|
+
"\" | #{fetch(:mysql_exec_dir)}/mysql #{fetch(mysql_pass_string)} -u#{fetch(:mysql_admin_user)} -h#{fetch(:mysql_admin_host)}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "create mysql database"
|
37
|
+
task :create_db do
|
38
|
+
|
39
|
+
mysql_pass_string = "-p'#{fetch(:mysql_admin_password)}'" unless fetch(:mysql_admin_password).chomp ==''
|
40
|
+
|
41
|
+
on roles(:all) do
|
42
|
+
execute "echo \"" \
|
43
|
+
"CREATE DATABASE #{fetch(:mysql_db_name)};" \
|
44
|
+
"GRANT ALL PRIVILEGES ON #{fetch(:mysql_db_name)}.* TO #{fetch(:mysql_db_user)};" \
|
45
|
+
"\" | #{fetch(:mysql_exec_dir)}/mysql #{fetch(mysql_pass_string)} -u#{fetch(:mysql_admin_user)} -h#{fetch(:mysql_admin_host)}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "drop mysql database"
|
50
|
+
task :drop_db do
|
51
|
+
mysql_pass_string = "-p'#{fetch(:mysql_admin_password)}'" unless fetch(:mysql_admin_password).chomp ==''
|
52
|
+
on roles(:all) do
|
53
|
+
execute "echo \"" \
|
54
|
+
"DROP DATABASE #{fetch(:mysql_db_name)};" \
|
55
|
+
"\" | #{fetch(:mysql_exec_dir)}/mysql #{fetch(mysql_pass_string)} -u#{fetch(:mysql_admin_user)} -h#{fetch(:mysql_admin_host)}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-mysql_admin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pim Snel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Capistrano 3 Task to create a mysql database. Useful for dev boxes
|
42
|
+
email:
|
43
|
+
- pim@lingewoud.nl
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- capistrano-mysql_admin.gemspec
|
54
|
+
- lib/capistrano/mysql_admin.rb
|
55
|
+
- lib/capistrano/mysql_admin/version.rb
|
56
|
+
- lib/capistrano/tasks/mysql_admin.cap
|
57
|
+
homepage: https://github.com/mipmip/capistrano-mysql_admin
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.4.3
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Capistrano 3 Task to create a mysql database
|
81
|
+
test_files: []
|