primehosting 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.
@@ -0,0 +1,10 @@
1
+ == 0.0.2 2008-05-25
2
+
3
+ * 1 major enhancement:
4
+ * Added database configuration tasks
5
+
6
+ == 0.0.1 2008-05-24
7
+
8
+ * 1 major enhancement:
9
+ * Initial release
10
+ * Got thumb out
data/LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Geoff Garside
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 ADDED
@@ -0,0 +1,49 @@
1
+ PrimeHosting Capistrano Recipes
2
+ ===============================
3
+ A gem of recipes to facilitate easy deployment of Rails applications to [PrimeHosting][primehosting] using [Capistrano][cap].
4
+
5
+ Usage
6
+ -----
7
+ Here is an example capistrano deploy.rb file which will deploy the application `cheese` for the user `prime`. The application will be using port `11000`
8
+
9
+ require 'primehosting'
10
+
11
+ set :user, "prime"
12
+ set :application, "cheese"
13
+ set :repository, "git://github.com/geoffgarside/ph-cheese.git"
14
+
15
+ set :deploy_via, :remote_cache
16
+
17
+ set :scm, :git
18
+ set :ssh_options, { :forward_agent => true }
19
+
20
+ set :app_port, "11000"
21
+
22
+ after "deploy:update_code", "database:copy_config"
23
+
24
+ once you've setup your config/deploy.rb file run `cap deploy:setup` and your deployment directories will be setup for you.
25
+
26
+ Note that by default it will deploy to
27
+
28
+ /usr/home/:user/apps/:application
29
+
30
+ so in the above example it would be
31
+
32
+ /usr/home/prime/apps/cheese
33
+
34
+ that the application would be deployed to. If you've setup your rails application to run from a different directory then you will need to set it by adding something like
35
+
36
+ set :deploy_to, "/usr/home/#{user}/rails_apps/#{application}"
37
+
38
+ if you've put your applications in `rails_apps` instead of apps.
39
+
40
+ Acknowledgements
41
+ ----------------
42
+ The primehosting capistrano recipe gem has been developed by
43
+
44
+ * Geoff Garside <geoff.garside@openhosting.co.uk>
45
+ * Anthony Underwood <add email here>
46
+
47
+
48
+ [primehosting]: http://www.primehosting.co.uk/ "Prime Hosting"
49
+ [cap]: http://www.capify.org/ "Capistrano"
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'highline/import'
5
+
6
+ require 'primehosting/mongrel'
7
+ require 'primehosting/database'
8
+
9
+ Capistrano::Configuration.instance(true).load do
10
+ # Setup default values
11
+ set :rails_env, "production"
12
+ set :use_sudo, false
13
+ set :app_port, nil
14
+
15
+ set(:deploy_to) { "/usr/home/#{user}/apps/#{application}" }
16
+ end
@@ -0,0 +1,34 @@
1
+ Capistrano::Configuration.instance(true).load do
2
+ set :database_name, nil
3
+ set :database_user, proc { ask("What is your database username? ") { |q| q.default = user } }
4
+ set :database_pass, proc { ask("What is your database password? ") { |q| q.echo = "*" } }
5
+
6
+ namespace :database do
7
+ task :configure do
8
+ db_config =<<EOF
9
+ production:
10
+ adapter: mysql
11
+ database: #{database_name}
12
+ username: #{database_user}
13
+ password: #{database_pass}
14
+ host: 127.0.0.1
15
+ EOF
16
+ run "if test ! -d #{shared_path}/config/; then mkdir -p #{shared_path}/config/; fi"
17
+ put db_config, "#{shared_path}/config/database.yml"
18
+
19
+ puts "You should now add the following to your deploy.rb file"
20
+ puts "after 'deploy:update_code', 'database:copy_config'"
21
+ end
22
+
23
+ task :copy_config do
24
+ on_rollback {
25
+ puts "*** File shared/config/database.yml is missing. ***"
26
+ puts "*** Run cap database:configure to generate and upload. ***"
27
+ }
28
+
29
+ run "cp #{shared_path}/config/database.yml #{release_path}/config/"
30
+ end
31
+ end
32
+
33
+ after "deploy:setup", "database:configure"
34
+ end
@@ -0,0 +1,42 @@
1
+ Capistrano::Configuration.instance(true).load do
2
+ namespace :mongrel do
3
+ task :start, :roles => :app, :except => { :no_release => true } do
4
+ send(run_method, "mongrel_rails start #{mongrel_start_args.join(" ")}")
5
+ end
6
+
7
+ task :stop, :roles => :app, :except => { :no_release => true } do
8
+ send(run_method, "mongrel_rails stop #{mongrel_args.join(" ")}")
9
+ end
10
+
11
+ task :restart, :roles => :app, :except => { :no_release => true } do
12
+ send(run_method, "mongrel_rails restart #{mongrel_args.join(" ")}")
13
+ end
14
+ end
15
+
16
+ def mongrel_args
17
+ [["-c", release_path],
18
+ ["-P", release_path + "log/mongrel.pid"]]
19
+ end
20
+
21
+ def mongrel_start_args
22
+ [["-d"],
23
+ ["-e", rails_env],
24
+ ["-p", app_port],
25
+ ["-a", "127.0.0.1"],
26
+ ["-l", release_path + "log/mongrel.log"]] + default_mongrel_args
27
+ end
28
+
29
+ namespace :deploy do
30
+ task :start do
31
+ mongrel.start
32
+ end
33
+
34
+ task :stop do
35
+ mongrel.stop
36
+ end
37
+
38
+ task :restart do
39
+ mongrel.restart
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ module Primehosting
2
+ module VERSION
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TEENY = 2
6
+
7
+ STRING = [MAJOR, MINOR, TEENY].join(".")
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "primehosting" do
4
+ it "should do nothing" do
5
+ true.should == true
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ $TESTING=true
2
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: primehosting
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Geoff Garside
8
+ - Anthony Underwood
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-06-14 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: capistrano
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: highline
27
+ version_requirement:
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.4.0
33
+ version:
34
+ description:
35
+ email: primehosting@geoffgarside.co.uk
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - README
42
+ - History.txt
43
+ - LICENCE
44
+ files:
45
+ - lib/primehosting/database.rb
46
+ - lib/primehosting/mongrel.rb
47
+ - lib/primehosting/version.rb
48
+ - lib/primehosting.rb
49
+ - script/destroy
50
+ - script/generate
51
+ - spec/primehosting_spec.rb
52
+ - spec/spec_helper.rb
53
+ - README
54
+ - LICENCE
55
+ - History.txt
56
+ has_rdoc: true
57
+ homepage: http://primehosting.co.uk/
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project: primehosting
78
+ rubygems_version: 1.1.1
79
+ signing_key:
80
+ specification_version: 2
81
+ summary: Capistrano recipes for deployment to Primehosting accounts
82
+ test_files: []
83
+