peppyheppy-cpanel-passenger 0.0.1 → 0.0.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.
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ Manifest.txt
2
+ README.rdoc
3
+ Rakefile
4
+ bin/cpanel_passenger
5
+ lib/cpanel_passenger.rb
6
+ lib/cpanel_passenger/cli.rb
data/README.rdoc ADDED
@@ -0,0 +1,49 @@
1
+ = cpanel_passenger
2
+
3
+ * http://github.com/peppyheppy/cpanel-passenger
4
+
5
+ == DESCRIPTION:
6
+
7
+ This gem consists of a single script that enables a cpanel account to run a Ruby on Rails App. Many more improvements could/should be made to handle more cases.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * It currently configures a Passenger enabled Apache web server for the provided rails app
12
+ * It doesn't do anything else at the moment.
13
+
14
+ == SYNOPSIS:
15
+
16
+ cpanel-passenger --username=peppyheppy --path=/home/peppyheppy/rails_app
17
+
18
+ == REQUIREMENTS:
19
+
20
+ Must be run as root since it will modify the Apache httpd.conf files.
21
+
22
+ == INSTALL:
23
+
24
+ sudo gem install peppyheppy-cpanel-passenger
25
+
26
+ == LICENSE:
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2009 Paul Hepworth
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/cpanel_passenger'
4
+
5
+ # Generate all the Rake tasks
6
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
7
+ $hoe = Hoe.new('cpanel-passenger', CpanelPassenger::VERSION) do |p|
8
+ p.developer('Paul Hepworth', 'paul@peppyheppy.com')
9
+ # p.extra_deps = [
10
+ # ['activesupport','>= 2.0.2'],
11
+ # ]
12
+ p.extra_dev_deps = [
13
+ ['newgem', ">= #{::Newgem::VERSION}"]
14
+ ]
15
+
16
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
17
+ end
18
+
19
+ require 'newgem/tasks' # load /tasks/*.rake
20
+ Dir['tasks/**/*.rake'].each { |t| load t }
21
+
22
+ # TODO - want other tests/tasks run by default? Add them to the list
23
+ # task :default => [:spec, :features]
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2009-5-11.
4
+ # Copyright (c) 2009. All rights reserved.
5
+
6
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/cpanel_passenger")
7
+
8
+ require "cpanel_passenger/cli"
9
+
10
+ CpanelPassenger::CLI.execute(STDOUT, ARGV)
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module CpanelPassenger
5
+ VERSION = '0.0.2'
6
+ end
@@ -0,0 +1,59 @@
1
+ require 'optparse'
2
+ require 'ftools'
3
+
4
+ module CpanelPassenger
5
+ class CLI
6
+ def self.execute(stdout, arguments=[])
7
+
8
+ options = {
9
+ :username => nil,
10
+ :path => nil
11
+ }
12
+ mandatory_options = %w( username path )
13
+
14
+ parser = OptionParser.new do |opts|
15
+ opts.banner = <<-BANNER.gsub(/^ /,'')
16
+ This application is wonderful because...
17
+
18
+ Usage: #{File.basename($0)} [options]
19
+
20
+ Options are:
21
+ BANNER
22
+ opts.separator ""
23
+ opts.on("-p", "--path=PATH", String,
24
+ "The absolute path to your rails application root (ex: /home/username/blog)",
25
+ "Default: ~") { |arg| options[:path] = arg }
26
+ opts.on("-u", "--username=USERNAME", String,
27
+ "Your cpanel account username (ex: peppyheppy)") { |arg| options[:username] = arg.strip }
28
+ opts.on("-h", "--help",
29
+ "Show this help message.") { stdout.puts opts; exit }
30
+ opts.parse!(arguments)
31
+
32
+ if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
33
+ stdout.puts opts; exit
34
+ end
35
+ end
36
+
37
+ username = options[:username]
38
+ rails_app_path = options[:path]
39
+
40
+ stdout.puts "* Setting up Rails app in Apache config for user"
41
+ raise "Path is required!" unless File.directory?(rails_app_path) or File.directory?("#{rails_app_path}/public")
42
+ raise "Script needed for overriding or appending vhost includes is not found, do you have cpanel installed?" unless File.exists?("/scripts/ensure_vhost_includes")
43
+
44
+ stdout.puts "* Fetching info from httpd.conf"
45
+ path_to_config = File.new("/usr/local/apache/conf/httpd.conf").readlines.grep(/userdata\/.*\/#{username}/).first.strip[/\/usr\/.*[*]/].chop + "rails.conf"
46
+
47
+ stdout.puts "* Creating configs for #{username}"
48
+ file = File.open(path_to_config, "w+")
49
+ file.write "# line added by cpanel passenger script\n"
50
+ file.write "DocumentRoot #{rails_app_path}/public"
51
+ file.close
52
+
53
+ stdout.puts "* Enabling the configs for #{username}"
54
+ `/scripts/ensure_vhost_includes --user=#{username}`
55
+
56
+ stdout.puts "* Done. You can view the config changes in #{path_to_config}"
57
+ end
58
+ end
59
+ end
metadata CHANGED
@@ -1,36 +1,62 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peppyheppy-cpanel-passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Hepworth
8
- autorequire: cpanel-passenger
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-13 00:00:00 -07:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: Simple bin used for automating the configuration of an account for Rails.
17
- email: paul@peppyheppy.com
18
- executables: []
19
-
12
+ date: 2009-05-14 00:00:00 -07:00
13
+ default_executable: cpanel_passenger
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.4.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ version:
35
+ description: This gem consists of a single script that enables a cpanel account to run a Ruby on Rails App. Many more improvements could/should be made to handle more cases.
36
+ email:
37
+ - paul@peppyheppy.com
38
+ executables:
39
+ - cpanel_passenger
20
40
  extensions: []
21
41
 
22
- extra_rdoc_files: []
23
-
24
- files: []
25
-
26
- has_rdoc: true
27
- homepage: http://peppyheppy.com
42
+ extra_rdoc_files:
43
+ - Manifest.txt
44
+ - README.rdoc
45
+ files:
46
+ - Manifest.txt
47
+ - README.rdoc
48
+ - Rakefile
49
+ - bin/cpanel_passenger
50
+ - lib/cpanel_passenger.rb
51
+ - lib/cpanel_passenger/cli.rb
52
+ has_rdoc: false
53
+ homepage: http://github.com/peppyheppy/cpanel-passenger
28
54
  post_install_message:
29
55
  rdoc_options:
30
- - --title
31
- - Come ON!
56
+ - --main
57
+ - README.rdoc
32
58
  require_paths:
33
- - - lib
59
+ - lib
34
60
  required_ruby_version: !ruby/object:Gem::Requirement
35
61
  requirements:
36
62
  - - ">="
@@ -45,10 +71,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
71
  version:
46
72
  requirements: []
47
73
 
48
- rubyforge_project:
74
+ rubyforge_project: cpanel-passenger
49
75
  rubygems_version: 1.2.0
50
76
  signing_key:
51
- specification_version: 2
52
- summary: Cpanel Passenger
77
+ specification_version: 3
78
+ summary: This gem consists of a single script that enables a cpanel account to run a Ruby on Rails App
53
79
  test_files: []
54
80