railshoster 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.textile ADDED
@@ -0,0 +1,29 @@
1
+ h2. 0.0.1
2
+
3
+ * Implementation of init command started.
4
+ * Current status:
5
+ ** Decode and parse credentials - done
6
+ ** Gather Git Repository URL using git gem - done
7
+ ** Write deploy.rb
8
+ ** Capify project
9
+
10
+ h2. 0.0.2
11
+
12
+ * deploy.rb now creates a symlink to database.yml with -f (force) and overwrites an eventually existing database.yml from the customer's repository.
13
+
14
+ h3. 0.0.3
15
+
16
+ * Added travis testing meta data.
17
+ * Added RSpec tests for basic functionality.
18
+ * Fixed a Ruby 1.9.x issue.
19
+ * Enhanced error messages for invalid application tokens.
20
+ * Initial README.
21
+
22
+ h3. 0.1.0
23
+
24
+ * Added Railshoster Bundler settings to generate binstubs. Hence you don't have to use "bundle exec" all the time. See http://gembundler.com/deploying.html for more details.
25
+ * Bugfix reagarding to keyboard input when no directory is given.
26
+ * Added capistrano task "railshoster:appurl" to show the default railshoster app url.
27
+ * "railshoster deploy" now can only be invoked if there's a Capfile and a deploy.rb.
28
+ * Added "railshoster appurl" show the default railshoster app url. This command can only be invoked if there's a Capfile and a deploy.rb.
29
+ * It now shows the appurl after invoking "railshoster deploy".
@@ -4,7 +4,7 @@ The RailsHoster Deployment gem helps you to easily get your Rails app runing at
4
4
 
5
5
  h2. Travis Status of the current dev branch
6
6
 
7
- [![Build Status](https://secure.travis-ci.org/[railshoster]/[railshoster].png)](http://travis-ci.org/[railshoster]/[railshoster])
7
+ "!https://secure.travis-ci.org/railshoster/railshoster.png!":http://travis-ci.org/railshoster/railshoster
8
8
 
9
9
  h2. Requirements
10
10
 
@@ -18,19 +18,19 @@ This is what you need on your client to run the RailsHoster gem to deploy your a
18
18
 
19
19
  h2. Installation
20
20
 
21
- gem install railshoster
21
+ bc. gem install railshoster
22
22
 
23
23
  h2. Usage
24
24
 
25
25
  Simply go to your project's git folder and invoke the following command to initialize your app and *make it deployment ready*.
26
26
 
27
- railshoster init -a 'your application token' .
27
+ bc. railshoster init -a 'your application token' .
28
28
 
29
- Regarding to your *application token* please refer to your account information you have received after signing up at [RailsHoster.com](http://www.railshoster.com/).
29
+ Regarding to your *application token* please refer to your account information you have received after signing up at "!RailsHoster.com":http://www.railshoster.com/.
30
30
 
31
31
  You can then either use *capistrano* to deploy or invoke
32
32
 
33
- railshoster deploy
33
+ bc. railshoster deploy
34
34
 
35
35
  It's as easy as this. Refer to the RailsHoster.com Support if any problems raise. We are happy to help you.
36
36
 
@@ -38,4 +38,4 @@ h2. Debug
38
38
 
39
39
  In order to receive full stack traces when exceptions occure just pass a environment variable like this
40
40
 
41
- RAILSHOSTER_DEV=1 railshoster
41
+ bc. RAILSHOSTER_DEV=1 railshoster
File without changes
data/bin/railshoster CHANGED
@@ -35,7 +35,7 @@ command [:init] do |c|
35
35
  project_git_dir_name = args[0] || cwd
36
36
 
37
37
  init_command = Railshoster::InitCommand.new(project_git_dir_name)
38
- init_command.run_by_application_token(options[:a])
38
+ init_command.run_by_application_token(options[:a])
39
39
  end
40
40
  end
41
41
 
@@ -46,6 +46,19 @@ command [:deploy] do |c|
46
46
  c.action do |global_options,options,args|
47
47
  project_git_dir_name = args[0] || FileUtils.pwd
48
48
  Railshoster::DeployCommand.new(project_git_dir_name).deploy
49
+
50
+ puts "\nNow, where you have deployed your app you might want to have a look at it. You can find it here:"
51
+
52
+ Railshoster::AppUrlCommand.new(project_git_dir_name).show
53
+ end
54
+ end
55
+
56
+ desc "Show the default RailsHoster.com URL for your app."
57
+ long_desc "Whenever you ask what the initial RailsHoster.com URL of your app was just invoke this command. It will tell you."
58
+ command [:appurl] do |c|
59
+ c.action do |global_options,options,args|
60
+ project_git_dir_name = args[0] || FileUtils.pwd
61
+ Railshoster::AppUrlCommand.new(project_git_dir_name).show
49
62
  end
50
63
  end
51
64
 
@@ -92,8 +105,8 @@ def ask_for_project_dir(current_working_dir)
92
105
  puts "You have not specified your local project folder to be deployed.\n" +
93
106
  "I assume you want to use your current working directory: #{current_working_dir}.\n"
94
107
  print "Correct? (y/n) [n]: "
95
- decision = STDIN.getc
96
- if decision !~ /y/i then
108
+ decision = STDIN.gets.chomp
109
+ unless %w(y Y).include?(decision) then
97
110
  exit_now!("Initialization aborted.", -1)
98
111
  end
99
112
  end
@@ -0,0 +1,12 @@
1
+ module Railshoster
2
+
3
+ # This action class shows the default railshoster.com url of a project.
4
+ class AppUrlCommand < Command
5
+
6
+ def show
7
+ if_project_already_initialized do
8
+ system("cap railshoster:appurl")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -22,5 +22,26 @@ module Railshoster
22
22
  def capfile_path
23
23
  File.join(@project_dir, "Capfile")
24
24
  end
25
+
26
+ def deployrb_exists?
27
+ File.exists?(deployrb_path)
28
+ end
29
+
30
+ def deployrb_path
31
+ File.join(@project_dir, "config", "deploy.rb")
32
+ end
33
+
34
+ def if_project_already_initialized(&block)
35
+ if project_already_initialized? then
36
+ yield
37
+ else
38
+ puts "\nCommand execution aborted!\nYou haven't initialized your application, yet."
39
+ puts "Please use the 'railshoster init' command and try again.\n\n"
40
+ end
41
+ end
42
+
43
+ def project_already_initialized?
44
+ (capfile_exists? and deployrb_exists?)
45
+ end
25
46
  end
26
47
  end
@@ -1,6 +1,6 @@
1
1
  module Railshoster
2
2
 
3
- # This action class helps to setup a new rails applicaton
3
+ # This action class helps to deploy a rails applicaton
4
4
  class DeployCommand < Command
5
5
 
6
6
  def initialize(project_dir)
@@ -8,11 +8,8 @@ module Railshoster
8
8
  end
9
9
 
10
10
  def deploy
11
- if capfile_exists? then
11
+ if_project_already_initialized do
12
12
  system("cap deploy")
13
- else
14
- puts "\nDeployment abortet!\nYou haven't initialized your application, yet."
15
- puts "Please use the 'railshoster init' command as described in your account information mail you have received from RailsHoster.com and try again.\n\n"
16
13
  end
17
14
  end
18
15
  end
@@ -1,3 +1,3 @@
1
1
  module Railshoster
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/railshoster.rb CHANGED
@@ -9,6 +9,7 @@ require File.join(File.dirname(__FILE__), 'railshoster/bad_application_json_hash
9
9
  require File.join(File.dirname(__FILE__), 'railshoster/bad_appliction_token_error')
10
10
  require File.join(File.dirname(__FILE__), 'railshoster/init_command')
11
11
  require File.join(File.dirname(__FILE__), 'railshoster/deploy_command')
12
+ require File.join(File.dirname(__FILE__), 'railshoster/app_url_command')
12
13
 
13
14
  module Railshoster
14
15
  end
@@ -44,19 +44,20 @@ default_run_options[:pty] = true
44
44
  set :use_sudo, false
45
45
 
46
46
  # set the location where to deploy the new project
47
- set :deploy_to, "/home/#{user}/#{application}"
47
+ set :deploy_to, "/home/#{user}/#{application}/shared/bundle"
48
48
 
49
49
  # live
50
50
  role :app, "<%= app["h"]%>"
51
51
  role :web, "<%= app["h"]%>"
52
52
  role :db, "<%= app["h"]%>", :primary => true
53
53
 
54
+ # railshoster bundler settings
55
+ set :bundle_flags, "--deployment --binstubs"
54
56
 
55
57
  ############################################
56
58
  # Default Tasks by RailsHoster.de
57
59
  ############################################
58
60
  namespace :deploy do
59
-
60
61
  desc "Restarting mod_rails with restart.txt"
61
62
  task :restart, :roles => :app, :except => { :no_release => true } do
62
63
  run "touch #{current_path}/tmp/restart.txt"
@@ -66,6 +67,15 @@ namespace :deploy do
66
67
  task :additional_symlink, :roles => :app do
67
68
  run "ln -sf #{shared_path}/config/database.yml #{current_path}/config/database.yml"
68
69
  end
70
+ end
69
71
 
72
+ namespace :railshoster do
73
+ desc "Show the url of your app."
74
+ task :appurl do
75
+ puts "\nThe default RailsHoster.com URL of your app is:"
76
+ puts "\nhttp://#{user}-<%= app["aid"] %>.<%= app["h"]%>"
77
+ puts "\n"
78
+ end
70
79
  end
80
+
71
81
  after "deploy:symlink","deploy:additional_symlink","deploy:migrate"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railshoster
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julian Fischer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-05 00:00:00 Z
18
+ date: 2011-11-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: capistrano
@@ -143,15 +143,16 @@ extra_rdoc_files: []
143
143
  files:
144
144
  - .gitignore
145
145
  - .travis.yml
146
- - CHANGELOG.markdown
146
+ - CHANGELOG.textile
147
147
  - CONTRIB.txt
148
148
  - LICENSE
149
- - README.markdown
150
- - ROADMAP.markdown
149
+ - README.textile
150
+ - ROADMAP.textile
151
151
  - Rakefile
152
152
  - bin/railshoster
153
153
  - gemfiles/Gemfile.ci
154
154
  - lib/railshoster.rb
155
+ - lib/railshoster/app_url_command.rb
155
156
  - lib/railshoster/bad_application_json_hash_error.rb
156
157
  - lib/railshoster/bad_appliction_token_error.rb
157
158
  - lib/railshoster/capify_project_failed_error.rb
data/CHANGELOG.markdown DELETED
@@ -1,20 +0,0 @@
1
- h2. 0.0.1
2
-
3
- * Implementation of init command started.
4
- * Current status:
5
- ** Decode and parse credentials - done
6
- ** Gather Git Repository URL using git gem - done
7
- ** Write deploy.rb
8
- ** Capify project
9
-
10
- h2. 0.0.2
11
-
12
- * deploy.rb now creates a symlink to database.yml with -f (force) and overwrites an eventually existing database.yml from the customer's repository.
13
-
14
- h3. 0.0.3
15
-
16
- * Added travis testing meta data.
17
- * Added RSpec tests for basic functionality.
18
- * Fixed a Ruby 1.9.x issue.
19
- * Enhanced error messages for invalid application tokens.
20
- * Initial README.