gitpusshuten 0.0.6 → 0.0.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2010 Michael van Rooijen - Final Creation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/lib/gitpusshuten.rb CHANGED
@@ -11,7 +11,15 @@ require 'highline/import'
11
11
  require 'rainbow'
12
12
  require 'json'
13
13
 
14
- Dir[File.expand_path(File.join(File.dirname(__FILE__), 'gitpusshuten/**/*'))].each do |file|
14
+ if Config::CONFIG['host_os'] =~ /mswin|mingw/
15
+ begin
16
+ require 'win32console'
17
+ rescue LoadError
18
+ puts "You must install 'win32console' gem or use ANSICON 1.31 or later (http://adoxa.110mb.com/ansicon/) to use color on Windows"
19
+ end unless ENV['ANSICON']
20
+ end
21
+
22
+ Dir[File.expand_path(File.join(File.dirname(__FILE__), 'gitpusshuten/**/*'))].sort.each do |file|
15
23
  if not File.directory?(file) and not file =~ /\/modules\/.+\/hooks\.rb/
16
24
  require file
17
25
  end
@@ -29,7 +29,7 @@ module GitPusshuTen
29
29
 
30
30
  ##
31
31
  # Allows for more arguments to be passed in after the regular expression.
32
- # These arguments will be converted to an array and apended to the "@arguments" array
32
+ # These arguments will be converted to an array and appended to the "@arguments" array
33
33
  if $5.is_a?(String)
34
34
  @arguments += $5.split(' ')
35
35
  end
@@ -48,9 +48,9 @@ module GitPusshuTen
48
48
  end
49
49
 
50
50
  if confirm_perform
51
- local.execute("mkdir -p '#{working_directory}/.gitpusshuten'")
51
+ FileUtils.mkdir_p("#{working_directory}/.gitpusshuten")
52
52
  Dir[File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'templates', '*.rb'))].each do |template|
53
- local.execute("cp '#{template}' '#{working_directory}/.gitpusshuten/#{template.split('/').last}'")
53
+ FileUtils.cp(template, "#{working_directory}/.gitpusshuten/#{template.split('/').last}")
54
54
  end
55
55
  message "Git Pusshu Ten (プッシュ天) initialized in: #{y(working_directory)}!"
56
56
  end
@@ -14,12 +14,18 @@ module GitPusshuTen
14
14
  def initialize(*objects)
15
15
  super
16
16
  perform_hooks!
17
-
17
+
18
18
  @command = cli.arguments.shift
19
19
  @type = cli.arguments.shift
20
-
21
- help if type.nil? or e.name.nil?
22
-
20
+
21
+ if %(production staging).include?(command) and not type
22
+ c.environment = command
23
+ @type = (command == 'production') ? 'master' : 'develop'
24
+ @command = 'branch'
25
+ end
26
+
27
+ help unless type and e.name
28
+
23
29
  set_remote!
24
30
  end
25
31
 
@@ -51,23 +57,6 @@ module GitPusshuTen
51
57
  git.add_remote(e.name, "ssh://#{c.user}@#{c.ip}:#{c.port}/#{e.app_dir}")
52
58
  end
53
59
 
54
- ##
55
- # Conventional command actions
56
-
57
- ##
58
- # Pushes the master branch to the production environment.
59
- def perform_production!
60
- message "Pushing branch master to the production environment."
61
- git.push(:branch, "master").to("production")
62
- end
63
-
64
- ##
65
- # Pushes the master branch to the production environment.
66
- def perform_stage!
67
- message "Pushing branch develop to the stage environment."
68
- git.push(:branch, "develop").to("staging")
69
- end
70
-
71
60
  end
72
61
  end
73
62
  end
@@ -13,12 +13,12 @@ module GitPusshuTen
13
13
 
14
14
  def initialize(*objects)
15
15
  super
16
-
16
+
17
17
  @command = cli.arguments.shift
18
-
18
+
19
19
  help if command.nil? or e.name.nil?
20
20
  end
21
-
21
+
22
22
  ##
23
23
  # Sets up a new UNIX user and configures it based on the .gitpusshuten/config.rb
24
24
  def perform_add!
@@ -43,25 +43,25 @@ module GitPusshuTen
43
43
  standard "\n\s\s#{(y("heavenly user reconfigure for #{e.name}"))}"
44
44
  exit
45
45
  end
46
-
46
+
47
47
  ##
48
48
  # Install Git if it isn't installed yet
49
49
  Spinner.return :message => "Ensuring #{y('Git')} is installed.." do
50
50
  ensure_git_installed!
51
51
  g('Done!')
52
52
  end
53
-
53
+
54
54
  ##
55
55
  # Install common application dependencies like xmllib and imagemagick
56
- Spinner.return :message => "Ensuring #{y('common applictation dependencies')} are installed.." do
56
+ Spinner.return :message => "Ensuring #{y('common application dependencies')} are installed.." do
57
57
  ensure_common_dependencies_are_installed!
58
58
  g('Done!')
59
59
  end
60
-
60
+
61
61
  ##
62
62
  # Configures the user
63
63
  configure_user!
64
-
64
+
65
65
  ##
66
66
  # Finished adding user!
67
67
  message "Finished adding and configuring #{y(c.user)}!"
@@ -112,7 +112,7 @@ module GitPusshuTen
112
112
  error "Cannot login, #{y(c.user)} does not exist."
113
113
  exit
114
114
  end
115
-
115
+
116
116
  puts "ssh #{c.user}@#{c.ip} -p #{c.port}"
117
117
  end
118
118
 
@@ -130,7 +130,7 @@ module GitPusshuTen
130
130
  error "To create one, run: #{y('ssh-keygen -t rsa')}"
131
131
  exit
132
132
  end
133
-
133
+
134
134
  unless e.ssh_key_installed? # prompts root
135
135
  Spinner.return :message => "Installing #{"SSH Key".color(:yellow)}.." do
136
136
  e.install_ssh_key!
@@ -149,7 +149,7 @@ module GitPusshuTen
149
149
  error "To create one, run: #{y('ssh-keygen -t rsa')}"
150
150
  exit
151
151
  end
152
-
152
+
153
153
  unless e.root_ssh_key_installed? # prompts root
154
154
  Spinner.return :message => "Installing #{"SSH Key".color(:yellow)}.." do
155
155
  e.install_root_ssh_key!
@@ -177,21 +177,21 @@ module GitPusshuTen
177
177
  # Configures the user. Overwrites all current configurations (if any exist)
178
178
  def configure_user!
179
179
  message "Configuring #{y(c.user)}."
180
-
180
+
181
181
  ##
182
182
  # If the user has an SSH key and it hasn't been installed
183
183
  # on the server under the current user then it'll go ahead and install it
184
184
  if e.has_ssh_key? and not e.ssh_key_installed?
185
185
  perform_install_ssh_key!
186
186
  end
187
-
187
+
188
188
  ##
189
189
  # Configure .bashrc
190
190
  Spinner.return :message => "Configuring #{y('.bashrc')}.." do
191
191
  e.execute_as_root("echo -e \"export RAILS_ENV=production\nsource /etc/profile\" > '#{File.join(c.path, '.bashrc')}'")
192
192
  g('Done!')
193
193
  end
194
-
194
+
195
195
  ##
196
196
  # Creating .gemrc
197
197
  Spinner.return :message => "Configuring #{y('.gemrc')}.." do
@@ -200,7 +200,7 @@ module GitPusshuTen
200
200
  e.clean_up_packages!(e.home_dir)
201
201
  g('Done!')
202
202
  end
203
-
203
+
204
204
  ##
205
205
  # Add user to sudoers file if not already in sudo'ers
206
206
  if not e.user_in_sudoers?
@@ -209,7 +209,7 @@ module GitPusshuTen
209
209
  g('Done!')
210
210
  end
211
211
  end
212
-
212
+
213
213
  ##
214
214
  # Checks to see if the RVM group exists.
215
215
  # If it does exist, perform RVM specific tasks.
@@ -227,7 +227,7 @@ module GitPusshuTen
227
227
  g('Done!')
228
228
  end
229
229
  end
230
-
230
+
231
231
  ##
232
232
  # Installs the .gitconfig and minimum configuration
233
233
  # if the configuration file does not exist.
@@ -236,14 +236,14 @@ module GitPusshuTen
236
236
  e.install_pushand!
237
237
  g('Done!')
238
238
  end
239
-
239
+
240
240
  ##
241
241
  # Ensure home directory ownership is set to the user
242
242
  Spinner.return :message => "Setting permissions.." do
243
243
  e.execute_as_root("chown -R #{c.user}:#{c.user} '#{e.home_dir}'")
244
244
  g('Done!')
245
245
  end
246
-
246
+
247
247
  message "Finished configuring #{y(c.user)}."
248
248
  end
249
249
 
@@ -17,9 +17,9 @@ module GitPusshuTen
17
17
  alias :found? :found
18
18
 
19
19
  ##
20
- # Contains the user, password, passphrase, ip and port for connecting
21
- # and authorizing the user to the remote server
22
- attr_accessor :user, :password, :passphrase, :ip, :port
20
+ # Contains the user, password, passphrase, ssh key, ip and port
21
+ # for connecting and authorizing the user to the remote server
22
+ attr_accessor :user, :password, :passphrase, :ssh_key, :ip, :port
23
23
 
24
24
  ##
25
25
  # Contains the path to where the application should be pushed
@@ -59,14 +59,14 @@ module GitPusshuTen
59
59
  # Helper method used to configure the configuration file
60
60
  def pusshuten(application, *environment, &block)
61
61
  environment.flatten!
62
-
62
+
63
63
  environment.each do |env|
64
64
  unless env.is_a?(Symbol)
65
65
  GitPusshuTen::Log.error 'Please use symbols as environment name.'
66
66
  exit
67
67
  end
68
68
  end
69
-
69
+
70
70
  if environment.include?(@environment) or force_parse
71
71
  @application = application
72
72
  @found = true
@@ -81,7 +81,7 @@ module GitPusshuTen
81
81
  @environment = environment
82
82
  @found = false
83
83
  @force_parse = false
84
-
84
+
85
85
  @additional_modules = []
86
86
  end
87
87
 
@@ -90,7 +90,7 @@ module GitPusshuTen
90
90
  # configuration values into the GitPusshuTen::Configuration instance
91
91
  def parse!(configuration_file)
92
92
  instance_eval(File.read(configuration_file))
93
-
93
+
94
94
  ##
95
95
  # If no configuration is found by environment then
96
96
  # it will re-parse it in a forced manner, meaning it won't
@@ -105,16 +105,16 @@ module GitPusshuTen
105
105
  instance_eval(File.read(configuration_file))
106
106
  @additional_modules.uniq!
107
107
  end
108
-
108
+
109
109
  if not found? and not environment.nil?
110
110
  GitPusshuTen::Log.error "Could not find any configuration for #{environment.to_s.color(:yellow)}."
111
111
  exit
112
112
  end
113
-
113
+
114
114
  ##
115
115
  # Default to port 22 if no port is specified
116
116
  @port ||= '22'
117
-
117
+
118
118
  self
119
119
  end
120
120
 
@@ -6,7 +6,7 @@ module GitPusshuTen
6
6
  attr_accessor :gem
7
7
 
8
8
  ##
9
- # Instantiages a new gem
9
+ # Instantiates a new gem
10
10
  def initialize(name)
11
11
  @gem = JSON.parse(open(File.join(base_url, "#{name}.json")).read)
12
12
  end
@@ -35,7 +35,7 @@ module GitPusshuTen
35
35
  ##
36
36
  # Returns the default (local) SSH key path
37
37
  def ssh_key_path
38
- File.join(ENV['HOME'], '.ssh', 'id_rsa.pub')
38
+ File.join(ENV['HOME'], '.ssh', c.ssh_key || 'id_rsa.pub')
39
39
  end
40
40
 
41
41
  ##
@@ -22,13 +22,13 @@ module GitPusshuTen
22
22
  ##
23
23
  # Create tmp_dir
24
24
  def create_tmp_dir!
25
- %x[mkdir -p '#{tmp_dir}']
25
+ FileUtils.mkdir_p(tmp_dir)
26
26
  end
27
27
 
28
28
  ##
29
29
  # Removes everything inside the tmp_dir
30
30
  def remove_tmp_dir!
31
- %x[rm -rf '#{tmp_dir}']
31
+ FileUtils.rm_rf(tmp_dir)
32
32
  end
33
33
 
34
34
  end
@@ -51,7 +51,7 @@ module GitPusshuTen
51
51
  ##
52
52
  # Create the log directory if it doesn't exist
53
53
  if not File.directory?(log_dir)
54
- %x[mkdir -p '#{log_dir}']
54
+ FileUtils.mkdir_p(log_dir)
55
55
  end
56
56
 
57
57
  ##
@@ -91,7 +91,7 @@ module GitPusshuTen
91
91
  end
92
92
 
93
93
  local_apache_dir = File.join(local.gitpusshuten_dir, 'apache')
94
- local.execute("mkdir -p '#{local_apache_dir}'")
94
+ FileUtils.mkdir_p(local_apache_dir)
95
95
  Spinner.return :message => "Downloading Apache2 configuration file to #{y(local_apache_dir)}.." do
96
96
  e.scp_as_root(:download, "/etc/apache2/apache2.conf", local_apache_dir)
97
97
  g('Done!')
@@ -137,7 +137,7 @@ module GitPusshuTen
137
137
  exit
138
138
  end
139
139
 
140
- local.execute("mkdir -p #{File.join(local.gitpusshuten_dir, 'apache')}")
140
+ FileUtils.mkdir_p(File.join(local.gitpusshuten_dir, 'apache'))
141
141
  local_vhost = File.join(local.gitpusshuten_dir, 'apache', "#{e.name}.vhost")
142
142
  if File.exist?(local_vhost)
143
143
  warning "#{y(local_vhost)} already exists. Do you want to overwrite it?"
@@ -336,7 +336,7 @@ module GitPusshuTen
336
336
  ##
337
337
  # Creates a vhost template file if it doesn't already exist.
338
338
  def create_vhost_template_file!
339
- local.execute("mkdir -p '#{File.join(local.gitpusshuten_dir, 'apache')}'")
339
+ FileUtils.mkdir_p(File.join(local.gitpusshuten_dir, 'apache'))
340
340
  vhost_file = File.join(local.gitpusshuten_dir, 'apache', "#{e.name}.vhost")
341
341
 
342
342
  create_file = true
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  # Post Deploy Hook for installing gems
3
- # Checks if the bundle command is available before attemping
3
+ # Checks if the bundle command is available before attempting
4
4
  # and installs the Bundler gem if it is not available before proceeding
5
5
  post "Install dependencies (Bundler)" do
6
6
  run "if [[ $(which bundle) == '' ]]; then gem install bundler; fi"
@@ -6,7 +6,7 @@ module GitPusshuTen
6
6
  example "heavenly mysql install on staging # Installs MySQL to the staging environment."
7
7
  example "heavenly mysql uninstall from staging # Uninstalls MySQL from the staging environment."
8
8
  example "heavenly mysql add-user to staging # Adds the user to MySQL on the production environment."
9
- example "heavenly mysql remove-user from staging # Remvoes the user from MySQL on the production environment."
9
+ example "heavenly mysql remove-user from staging # Removes the user from MySQL on the production environment."
10
10
  example "heavenly mysql change-root-password on staging # Changes the root password of MySQL on the staging environment."
11
11
 
12
12
  def initialize(*objects)
@@ -4,7 +4,7 @@ module GitPusshuTen
4
4
  description "[Module] NginX commands."
5
5
  usage "nginx <command> <for|from|to> <environment> (environment)"
6
6
  example "heavenly nginx install to staging # Installs the Nginx web server"
7
- example "heavenly nginx setup staging environment # Sets up a managable vhost environment."
7
+ example "heavenly nginx setup staging environment # Sets up a manageable vhost environment."
8
8
  example "heavenly nginx update-configuration for staging # Only for Passenger users, when updating Ruby/Passenger versions."
9
9
  example "heavenly nginx download-configuration from staging # Downloads the Nginx configuration file from the specified environment."
10
10
  example " download-config # Alias."
@@ -133,7 +133,7 @@ module GitPusshuTen
133
133
  end
134
134
 
135
135
  local_nginx_dir = File.join(local.gitpusshuten_dir, 'nginx')
136
- local.execute("mkdir -p '#{local_nginx_dir}'")
136
+ FileUtils.mkdir_p(local_nginx_dir)
137
137
  Spinner.return :message => "Downloading NginX configuration file to #{y(local_nginx_dir)}.." do
138
138
  e.scp_as_root(:download, @nginx_conf, local_nginx_dir)
139
139
  g('Done!')
@@ -385,7 +385,7 @@ module GitPusshuTen
385
385
  exit unless yes?
386
386
  end
387
387
 
388
- local.execute("mkdir -p #{File.join(local.gitpusshuten_dir, 'nginx')}")
388
+ FileUtils.mkdir_p(File.join(local.gitpusshuten_dir, 'nginx'))
389
389
  Spinner.return :message => "Downloading vhost.." do
390
390
  e.scp_as_root(:download, remote_vhost, local_vhost)
391
391
  g("Finished downloading!")
@@ -407,7 +407,7 @@ module GitPusshuTen
407
407
  ##
408
408
  # Creates a vhost template file if it doesn't already exist.
409
409
  def create_vhost_template_file!
410
- local.execute("mkdir -p '#{File.join(local.gitpusshuten_dir, 'nginx')}'")
410
+ FileUtils.mkdir_p(File.join(local.gitpusshuten_dir, 'nginx'))
411
411
  vhost_file = File.join(local.gitpusshuten_dir, 'nginx', "#{e.name}.vhost")
412
412
 
413
413
  create_file = true
@@ -3,7 +3,7 @@ module GitPusshuTen
3
3
  module Commands
4
4
  class Redis < GitPusshuTen::Commands::Base
5
5
  description "[Module] Redis commands."
6
- usage "redis <command> for <enviroment>"
6
+ usage "redis <command> for <environment>"
7
7
  example "heavenly redis install to staging # Installs Redis (system wide) and downloads config template."
8
8
  example "heavenly redis upload-configuration to staging # Uploads the Redis configuration template to the server, will install Redis if not already present."
9
9
  example " upload-config to staging # Alias."
@@ -16,9 +16,9 @@ module GitPusshuTen
16
16
 
17
17
  def initialize(*objects)
18
18
  super
19
-
19
+
20
20
  @command = cli.arguments.shift
21
-
21
+
22
22
  help if command.nil? or e.name.nil?
23
23
  end
24
24
 
@@ -26,32 +26,32 @@ module GitPusshuTen
26
26
  # Installs RVM (Ruby Version Manager)
27
27
  def perform_install!
28
28
  prompt_for_root_password!
29
-
29
+
30
30
  message "Which Ruby would you like to install and use as your default Ruby Interpreter?"
31
31
  ruby_version = choose_ruby_version!
32
32
  message "Going to install #{y(ruby_version)} after the #{y('RVM')} installation finishes."
33
-
33
+
34
34
  ##
35
35
  # Update aptitude package list and install git/curl/wget
36
36
  Spinner.return :message => "Updating package list and installing #{y('RVM')} requirements.." do
37
37
  e.install!("git-core curl wget;")
38
38
  g("Done!")
39
39
  end
40
-
40
+
41
41
  ##
42
42
  # Download Packages
43
43
  Spinner.return :message => "Downloading Git Pusshu Ten #{y('packages')}.." do
44
44
  e.download_packages!("$HOME", :root)
45
45
  g("Done!")
46
46
  end
47
-
47
+
48
48
  ##
49
49
  # Install RVM (system wide)
50
50
  Spinner.return :message => "Installing #{y('RVM')}.." do
51
51
  e.execute_as_root("cd $HOME; wget -O rvm-install-system-wide --no-check-certificate http://bit.ly/rvm-install-system-wide; bash rvm-install-system-wide; rm rvm-install-system-wide;")
52
52
  g("Done!")
53
53
  end
54
-
54
+
55
55
  ##
56
56
  # Download Git Packages and add the rvm load snippet into /etc/profile.
57
57
  if not e.execute_as_root("cat /etc/profile").include?('source "/usr/local/rvm/scripts/rvm"')
@@ -60,7 +60,7 @@ module GitPusshuTen
60
60
  g("Done!")
61
61
  end
62
62
  end
63
-
63
+
64
64
  ##
65
65
  # Add the gemrc into the root's home directory
66
66
  if not e.file?('/root/.gemrc')
@@ -69,7 +69,7 @@ module GitPusshuTen
69
69
  g("Done!")
70
70
  end
71
71
  end
72
-
72
+
73
73
  ##
74
74
  # Create a .bashrc in $HOME to load /etc/profile for non-interactive sessions
75
75
  if not e.execute_as_root("cat $HOME/.bashrc").include?('source /etc/profile')
@@ -78,43 +78,43 @@ module GitPusshuTen
78
78
  g("Done!")
79
79
  end
80
80
  end
81
-
81
+
82
82
  ##
83
83
  # Install required packages for installing Ruby
84
84
  Spinner.return :message => "Installing the Ruby Interpreter #{y('dependency packages')}.." do
85
- e.install!("build-essential bison openssl libreadline5 libreadline5-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev")
85
+ e.install!("build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf")
86
86
  g("Done!")
87
87
  end
88
-
88
+
89
89
  ##
90
90
  # Install a Ruby version
91
91
  Spinner.return :message => "Installing #{y(ruby_version)} with #{y('rvm')}. This may take a while.." do
92
92
  e.execute_as_root("rvm install #{ruby_version}")
93
93
  g("Done!")
94
94
  end
95
-
95
+
96
96
  ##
97
97
  # Set the Ruby version as the default Ruby
98
98
  Spinner.return :message => "Making #{y(ruby_version)} the default Ruby.." do
99
99
  e.execute_as_root("rvm use #{ruby_version} --default")
100
100
  g("Done!")
101
101
  end
102
-
102
+
103
103
  ##
104
104
  # Clean up Packages
105
105
  Spinner.return :message => "Cleaning up Git Pusshu Ten #{y('packages')}.." do
106
106
  e.clean_up_packages!("$HOME", :root)
107
107
  g("Done!")
108
108
  end
109
-
109
+
110
110
  message "Finished!"
111
111
  end
112
-
112
+
113
113
  ##
114
114
  # Performs an update for RVM
115
115
  def perform_update!
116
116
  prompt_for_root_password!
117
-
117
+
118
118
  message "Updating RVM."
119
119
  message "Would you like to get the latest stable, or bleeding edge version?"
120
120
  option = rvm_version?
@@ -123,52 +123,52 @@ module GitPusshuTen
123
123
  g("Done!")
124
124
  end
125
125
  end
126
-
126
+
127
127
  ##
128
128
  # Displays a list of installed gems
129
129
  def perform_list!
130
130
  prompt_for_root_password!
131
-
131
+
132
132
  Spinner.return :message => "Getting a list of installed Rubies.", :put => true do
133
133
  e.execute_as_root("rvm list")
134
134
  end
135
135
  message "The ( #{y("=>")} ) arrow indicates which Ruby version is currently being used."
136
136
  end
137
-
137
+
138
138
  ##
139
139
  # Installs a Ruby version with RVM
140
140
  def perform_install_ruby!
141
141
  perform_list! # prompts root
142
-
142
+
143
143
  message "Which Ruby version would you like to install?"
144
144
  ruby_version = choose_ruby_version!
145
-
145
+
146
146
  message "Would you like to make #{y(ruby_version)} your default Ruby?"
147
147
  yes? ? make_default = true : make_default = false
148
-
148
+
149
149
  Spinner.return :message => "Installing #{y(ruby_version)}, this may take a while.." do
150
150
  e.execute_as_root("rvm install #{ruby_version}")
151
151
  g("Done!")
152
152
  end
153
-
153
+
154
154
  if make_default
155
155
  Spinner.return :message => "Setting #{y(ruby_version)} as the system wide default Ruby." do
156
156
  e.execute_as_root("rvm use #{ruby_version} --default")
157
157
  g("Done!")
158
158
  end
159
-
159
+
160
160
  ask_to_use_default_ruby_with_passenger!(ruby_version)
161
161
  end
162
162
  end
163
-
163
+
164
164
  ##
165
165
  # Uninstalls a Ruby version
166
166
  def perform_uninstall_ruby!
167
167
  perform_list! # prompts root
168
-
168
+
169
169
  message "Which Ruby version would you like to uninstall?"
170
170
  ruby_version = choose_ruby_version!
171
-
171
+
172
172
  Spinner.return :message => "Uninstalling #{y(ruby_version)}.." do
173
173
  if not e.execute_as_root("rvm uninstall #{ruby_version}") =~ /has already been removed/
174
174
  g("Ruby version #{ruby_version} has been uninstalled.")
@@ -177,15 +177,15 @@ module GitPusshuTen
177
177
  end
178
178
  end
179
179
  end
180
-
180
+
181
181
  ##
182
182
  # Remove a Ruby version
183
183
  def perform_remove_ruby!
184
184
  perform_list! # prompts root
185
-
185
+
186
186
  message "Which Ruby version would you like to remove?"
187
187
  ruby_version = choose_ruby_version!
188
-
188
+
189
189
  Spinner.return :message => "Removing #{y(ruby_version)}.." do
190
190
  if not e.execute_as_root("rvm remove #{ruby_version}") =~ /is already non existent/
191
191
  g("Ruby version #{ruby_version} has been removed.")
@@ -194,15 +194,15 @@ module GitPusshuTen
194
194
  end
195
195
  end
196
196
  end
197
-
197
+
198
198
  ##
199
199
  # Change the default Ruby on the server
200
200
  def perform_set_default_ruby!
201
201
  perform_list! # prompts root
202
-
202
+
203
203
  message "Which Ruby version would you like to make the system wide default?"
204
204
  ruby_version = choose_ruby_version!
205
-
205
+
206
206
  Spinner.return :message => "Changing system wide default Ruby to #{y(ruby_version)}" do
207
207
  if not e.execute_as_root("rvm use #{ruby_version} --default") =~ /not installed/
208
208
  @succeeded = true
@@ -211,28 +211,28 @@ module GitPusshuTen
211
211
  r("Could not set #{ruby_version} as default")
212
212
  end
213
213
  end
214
-
214
+
215
215
  if @succeeded
216
216
  ask_to_use_default_ruby_with_passenger!(ruby_version)
217
217
  end
218
218
  end
219
-
219
+
220
220
  ##
221
221
  # Prompts the user to choose a Ruby to install
222
222
  def choose_ruby_version!
223
223
  choose do |menu|
224
224
  menu.prompt = ''
225
-
225
+
226
226
  %w[ruby-1.8.6 ruby-1.8.7 ruby-1.9.1 ruby-1.9.2].each do |mri|
227
227
  menu.choice(mri)
228
228
  end
229
-
229
+
230
230
  %w[ree-1.8.6 ree-1.8.7].each do |ree|
231
231
  menu.choice(ree)
232
232
  end
233
233
  end
234
234
  end
235
-
235
+
236
236
  ##
237
237
  # Prompts the user to choose a RVM version to install
238
238
  def rvm_version?
@@ -242,7 +242,7 @@ module GitPusshuTen
242
242
  menu.choice('bleeding edge') { '--head' }
243
243
  end
244
244
  end
245
-
245
+
246
246
  ##
247
247
  # Prompts the user to select a webserver
248
248
  def webserver?
@@ -252,7 +252,7 @@ module GitPusshuTen
252
252
  menu.choice('Apache')
253
253
  end
254
254
  end
255
-
255
+
256
256
  ##
257
257
  # Asks the user if he intends to make the newly set default ruby version
258
258
  # as the ruby version for the passenger driven ruby applications
@@ -260,16 +260,16 @@ module GitPusshuTen
260
260
  message("If you want to use #{y(ruby_version)} for your Ruby applications with Phusion Passenger")
261
261
  message("you must update your #{y("webserver's")} configuration file.\n\n")
262
262
  message("Would you like to do this now?\n\n")
263
-
263
+
264
264
  if yes?
265
265
  message "Which webserver are you using?"
266
266
  webserver = webserver?
267
-
267
+
268
268
  message "Invoking #{y("heavenly #{webserver.downcase} update-configuration for #{e.name}")} for you..\n\n\n"
269
269
  GitPusshuTen::Initializer.new(webserver.downcase, 'update-configuration', 'for', "#{e.name}")
270
270
  end
271
271
  end
272
-
272
+
273
273
  end
274
274
  end
275
275
  end
@@ -1,3 +1,3 @@
1
1
  module GitPusshuTen
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael van Rooijen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-29 00:00:00 +01:00
17
+ date: 2010-12-14 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -125,6 +125,7 @@ files:
125
125
  - .rspec
126
126
  - Gemfile
127
127
  - Gemfile.lock
128
+ - LICENSE
128
129
  - README.md
129
130
  - bin/gitpusshuten
130
131
  - bin/heavenly