rpanel 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bin/rpanel +7 -0
- data/lib/rpanel/cli.rb +81 -0
- data/lib/rpanel.rb +2 -0
- data/test/helper.rb +9 -0
- data/test/test_rpanel.rb +7 -0
- metadata +65 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 jayronc
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= rpanel
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 jayronc. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "rpanel"
|
8
|
+
gem.summary = %Q{Ruby tool for cpanel}
|
9
|
+
gem.description = %Q{Ruby tools for cpanel related admin tasks}
|
10
|
+
gem.email = "jerrodblavos@mac.com"
|
11
|
+
gem.homepage = "http://github.com/jerrod/rpanel"
|
12
|
+
gem.authors = ["jayronc"]
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test' << 'lib/rpanel'
|
23
|
+
test.pattern = 'test/**/test_*.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |test|
|
30
|
+
test.libs << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
task :rcov do
|
36
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task :test => :check_dependencies
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rake/rdoctask'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "rpanel #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/bin/rpanel
ADDED
data/lib/rpanel/cli.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'ftools'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Rpanel
|
6
|
+
class CLI
|
7
|
+
IGNORE_DIRECTORIES = ['.cpan', '.cpcpan', 'cpeasyapache', 'cprubybuild', 'cprubygemsbuild', 'domlogs', 'liquidweb', 'lost+found', 'fantasti', 'MySQL-install', 'virtfs']
|
8
|
+
def self.execute(stdout, arguments=[])
|
9
|
+
|
10
|
+
options = {
|
11
|
+
:fix_sc => nil,
|
12
|
+
:fix_owner => nil,
|
13
|
+
:fix_files => nil,
|
14
|
+
:fix_directories => nil,
|
15
|
+
:username => nil,
|
16
|
+
:all_accounts => nil
|
17
|
+
}
|
18
|
+
mandatory_options = %w( )
|
19
|
+
|
20
|
+
parser = OptionParser.new do |opts|
|
21
|
+
opts.banner = <<-BANNER.gsub(/^ /,'')
|
22
|
+
This application is wonderful because...
|
23
|
+
|
24
|
+
Usage: #{File.basename($0)} [options]
|
25
|
+
|
26
|
+
Options are:
|
27
|
+
BANNER
|
28
|
+
opts.separator ""
|
29
|
+
opts.on("-l", "--list", "List all accounts"){ |arg| options[:list] = true }
|
30
|
+
opts.on("-s", "--fix-source-control",
|
31
|
+
"Ensure .svn or .git directories are not group or world-readable") { |arg| options[:fix_sc] = true }
|
32
|
+
opts.on("-o", "--fix-owner",
|
33
|
+
"Ensure all files in public_html are owned by the account username") { |arg| options[:fix_owner] = true }
|
34
|
+
opts.on("-f", "--fix-files",
|
35
|
+
"Ensure all normal files are set no higher than 0644") { |arg| options[:fix_files] = true }
|
36
|
+
opts.on("-d", "--fix-directories",
|
37
|
+
"Ensure all normal files are set no higher than 0755") { |arg| options[:fix_directories] = true }
|
38
|
+
opts.on("-u", "--apply-user=USER", String,
|
39
|
+
"Your cpanel account username (ex: peppyhep)") { |arg| options[:username] = arg.strip }
|
40
|
+
|
41
|
+
opts.on("-a", "--apply-all-accounts",
|
42
|
+
"Value for PassengerPoolIdleTime which sets the idle time",
|
43
|
+
"for an application instance before it shuts down") { |arg| options[:apply_all_accounts] = true }
|
44
|
+
|
45
|
+
opts.on("-e", "--all",
|
46
|
+
"Value for PassengerPoolIdleTime which sets the idle time",
|
47
|
+
"for an application instance before it shuts down") {|args| options[:all] = true }
|
48
|
+
opts.on("-h", "--help",
|
49
|
+
"Show this help message.") { stdout.puts opts; exit }
|
50
|
+
opts.parse!(arguments)
|
51
|
+
|
52
|
+
if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
|
53
|
+
stdout.puts opts; exit
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if options[:list]
|
58
|
+
dirs = Dir.entries('/home') - IGNORE_DIRECTORIES
|
59
|
+
puts dirs
|
60
|
+
end
|
61
|
+
|
62
|
+
username = options[:username]
|
63
|
+
if options[:all]
|
64
|
+
options[:fix_sc] = true
|
65
|
+
options[:fix_owner] = true
|
66
|
+
options[:fix_files] = true
|
67
|
+
options[:fix_directories] = true
|
68
|
+
end
|
69
|
+
puts "-s" if options[:fix_sc]
|
70
|
+
puts "-o" if options[:fix_owner]
|
71
|
+
puts "-f" if options[:fix_files]
|
72
|
+
puts "-d" if options[:fix_directories]
|
73
|
+
puts "-u" if options[:username]
|
74
|
+
puts "-a" if options[:apply_all_accounts]
|
75
|
+
stdout.puts "* Checking permissions for #{username}"
|
76
|
+
|
77
|
+
# raise "Path is required!" unless File.directory?(rails_app_path) or File.directory?("#{rails_app_path}/public")
|
78
|
+
# FileUtils::mkdir_p(config_path)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/rpanel.rb
ADDED
data/test/helper.rb
ADDED
data/test/test_rpanel.rb
ADDED
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rpanel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jayronc
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-11 00:00:00 -05:00
|
13
|
+
default_executable: rpanel
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Ruby tools for cpanel related admin tasks
|
17
|
+
email: jerrodblavos@mac.com
|
18
|
+
executables:
|
19
|
+
- rpanel
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
30
|
+
- bin/rpanel
|
31
|
+
- lib/rpanel.rb
|
32
|
+
- lib/rpanel/cli.rb
|
33
|
+
- test/helper.rb
|
34
|
+
- test/test_rpanel.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/jerrod/rpanel
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --charset=UTF-8
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.3.5
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Ruby tool for cpanel
|
63
|
+
test_files:
|
64
|
+
- test/helper.rb
|
65
|
+
- test/test_rpanel.rb
|