psychic-nemesis-ninja 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/Rakefile +3 -0
- data/lib/commands/restart-apache.rb +14 -0
- data/lib/commands/restart-memcached.rb +14 -0
- data/lib/commands/restart-mysql.rb +14 -0
- data/lib/psychic-nemesis-ninja.rb +18 -0
- data/lib/psychic-nemesis-ninja/version.rb +7 -0
- data/psychic-nemesis-ninja.gemspec +19 -0
- metadata +73 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Christopher Valles
|
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,25 @@
|
|
1
|
+
# Psychic::Nemesis::Ninja
|
2
|
+
|
3
|
+
A plugin to manage services like apache, mysql and memcached on vagrant machines
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install it yourself as:
|
8
|
+
|
9
|
+
$ vagrant plugin install psychic-nemesis-ninja
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
The plugin provides a few commands in order to manage services and they are self-explanatory. Below you can see the list of commands.
|
14
|
+
|
15
|
+
1. restart-apache
|
16
|
+
2. restart-mysql
|
17
|
+
3. restart-memcached
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class RestartApache < Vagrant.plugin(2, :command)
|
2
|
+
def execute
|
3
|
+
with_target_vms([], :single_target => true) do |vm|
|
4
|
+
@logger.debug("Restarting apache on remote machine")
|
5
|
+
env = vm.action(:ssh_run, :ssh_run_command => "sudo service apache2 restart")
|
6
|
+
|
7
|
+
# Exit with the exit status of the command or a 0 if we didn't
|
8
|
+
# get one.
|
9
|
+
exit_status = env[:ssh_run_exit_status] || 0
|
10
|
+
return exit_status
|
11
|
+
end
|
12
|
+
0
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RestartMemcached < Vagrant.plugin(2, :command)
|
2
|
+
def execute
|
3
|
+
with_target_vms([], :single_target => true) do |vm|
|
4
|
+
@logger.debug("Restarting memcached on remote machine")
|
5
|
+
env = vm.action(:ssh_run, :ssh_run_command => "sudo service memcached restart")
|
6
|
+
|
7
|
+
# Exit with the exit status of the command or a 0 if we didn't
|
8
|
+
# get one.
|
9
|
+
exit_status = env[:ssh_run_exit_status] || 0
|
10
|
+
return exit_status
|
11
|
+
end
|
12
|
+
0
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RestartMysql < Vagrant.plugin(2, :command)
|
2
|
+
def execute
|
3
|
+
with_target_vms([], :single_target => true) do |vm|
|
4
|
+
@logger.debug("Restarting mysql on remote machine")
|
5
|
+
env = vm.action(:ssh_run, :ssh_run_command => "sudo service mysql restart")
|
6
|
+
|
7
|
+
# Exit with the exit status of the command or a 0 if we didn't
|
8
|
+
# get one.
|
9
|
+
exit_status = env[:ssh_run_exit_status] || 0
|
10
|
+
return exit_status
|
11
|
+
end
|
12
|
+
0
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class PsychicMemesisNinja < Vagrant.plugin("2")
|
2
|
+
name "Psychic Memesis Ninja"
|
3
|
+
|
4
|
+
command "restart-apache" do
|
5
|
+
require_relative "commands/restart-apache"
|
6
|
+
RestartApache
|
7
|
+
end
|
8
|
+
|
9
|
+
command "restart-mysql" do
|
10
|
+
require_relative "commands/restart-mysql"
|
11
|
+
RestartMysql
|
12
|
+
end
|
13
|
+
|
14
|
+
command "restart-memcached" do
|
15
|
+
require_relative "commands/restart-memcached"
|
16
|
+
RestartMemcached
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'psychic-nemesis-ninja/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "psychic-nemesis-ninja"
|
8
|
+
gem.version = Psychic::Nemesis::Ninja::VERSION
|
9
|
+
gem.authors = ["Christopher Valles"]
|
10
|
+
gem.email = ["christopher.valles@gree.net"]
|
11
|
+
gem.description = "A plugin to manage services like apache, mysq and memcached on vagrant machines"
|
12
|
+
gem.summary = "Plugin to manage stuff instide vagrant"
|
13
|
+
gem.homepage = "https://github.com/christophervalles/psychic-nemesis-ninja"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: psychic-nemesis-ninja
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Christopher Valles
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2013-05-08 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: A plugin to manage services like apache, mysq and memcached on vagrant machines
|
22
|
+
email:
|
23
|
+
- christopher.valles@gree.net
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
33
|
+
- LICENSE.txt
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- lib/commands/restart-apache.rb
|
37
|
+
- lib/commands/restart-memcached.rb
|
38
|
+
- lib/commands/restart-mysql.rb
|
39
|
+
- lib/psychic-nemesis-ninja.rb
|
40
|
+
- lib/psychic-nemesis-ninja/version.rb
|
41
|
+
- psychic-nemesis-ninja.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: https://github.com/christophervalles/psychic-nemesis-ninja
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.3.6
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Plugin to manage stuff instide vagrant
|
72
|
+
test_files: []
|
73
|
+
|