railshoster 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ # A dummy Gemfile
data/README.textile CHANGED
@@ -10,11 +10,13 @@ h2. Requirements
10
10
 
11
11
  This is what you need on your client to run the RailsHoster gem to deploy your app:
12
12
 
13
+ * Non-Windows OS (you might be able to use cygwin but this is untested so far)
13
14
  * Ruby
14
- * Ruby gems
15
+ * Ruby Gems
15
16
  * Shell (e.g. Bash)
16
17
  * SSH Shell
17
18
  * Git
19
+ * Currently the railshoster gem assumes bundler to be used. Let us know if this is a problem for you.
18
20
 
19
21
  h2. Installation
20
22
 
data/gemfiles/Gemfile.ci CHANGED
@@ -7,6 +7,7 @@ gem "gli", ">= 1.2.5"
7
7
  gem "json"
8
8
  gem "git"
9
9
  gem 'erubis'
10
+ gem 'sane'
10
11
 
11
12
  group :test do
12
13
  gem 'rspec'
data/lib/init.rb CHANGED
@@ -1,5 +1,6 @@
1
- require 'rubygems'
1
+ require "rubygems"
2
2
  gem "json"
3
3
  gem "git"
4
- gem 'erubis'
5
- gem "gli"
4
+ gem "erubis"
5
+ gem "gli"
6
+ gem "sane"
@@ -3,6 +3,7 @@ require 'json'
3
3
  require 'git'
4
4
  require 'fileutils'
5
5
  require 'net/sftp'
6
+ require 'sane'
6
7
 
7
8
  require File.expand_path(File.join(File.dirname(__FILE__), '/capistrano/h'))
8
9
 
@@ -11,10 +12,6 @@ module Railshoster
11
12
  # This action class helps to setup a new rails applicaton
12
13
  class InitCommand < Command
13
14
 
14
- def initialize(project_dir)
15
- super(project_dir)
16
- end
17
-
18
15
  def run_by_application_token(application_token)
19
16
  decoded_token = decode_token(application_token)
20
17
 
@@ -30,6 +27,8 @@ module Railshoster
30
27
  end
31
28
 
32
29
  def run_by_application_hash(application_hash_as_json_string)
30
+ check_system_requirements
31
+ check_project_requirements
33
32
  app_hash = parse_application_json_hash(application_hash_as_json_string)
34
33
 
35
34
  # Extract GIT URL from project and add it to the app_hash
@@ -49,6 +48,35 @@ module Railshoster
49
48
 
50
49
  protected
51
50
 
51
+ def check_system_requirements
52
+ check_os
53
+ end
54
+
55
+ def check_project_requirements
56
+ #TOOD implement
57
+ # check_git
58
+
59
+ check_gemfile
60
+ end
61
+
62
+ def check_gemfile
63
+ gem_file = File.join(@project_dir, "Gemfile")
64
+ unless File.exists?(gem_file) then
65
+ puts "\nWarning: Your project does not seem to have a Gemfile. Please ensure your are using bundler."
66
+ exit_now!("Initialization aborted. No Gemfile found.", -1)
67
+ end
68
+ end
69
+
70
+ def check_os
71
+ if OS.windows? then
72
+ puts "\nWarning: This software requires a Unix/Linux/BSD OS. Do you really want to proceed?"
73
+ decision = STDIN.gets.chomp
74
+ unless %w(y Y).include?(decision) then
75
+ exit_now!("Initialization aborted. Bad operating system.", -1)
76
+ end
77
+ end
78
+ end
79
+
52
80
  def create_remote_authorized_key_file_from_public_ssh_key(app_hash, key)
53
81
  remote_dot_ssh_path = ".ssh"
54
82
  remote_authorized_keys_path = remote_dot_ssh_path + "/authorized_keys"
@@ -1,3 +1,3 @@
1
1
  module Railshoster
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/railshoster.gemspec CHANGED
@@ -24,7 +24,8 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency "gli", ">= 1.2.5"
25
25
  s.add_dependency "json"
26
26
  s.add_dependency "git"
27
- s.add_dependency 'erubis'
27
+ s.add_dependency "erubis"
28
+ s.add_dependency "sane"
28
29
 
29
30
  s.add_development_dependency('rspec')
30
31
  s.add_development_dependency('fakefs')
data/spec/spec_helper.rb CHANGED
@@ -9,6 +9,7 @@ require 'fakefs/spec_helpers'
9
9
  # include FakeFS::SpecHelpers
10
10
  # end
11
11
 
12
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'init')
12
13
  require File.join(File.dirname(__FILE__), '..', 'lib', 'railshoster')
13
14
 
14
15
  RSpec.configure do |c|
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: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
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-12 00:00:00 Z
18
+ date: 2011-11-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -120,7 +120,7 @@ dependencies:
120
120
  type: :runtime
121
121
  version_requirements: *id007
122
122
  - !ruby/object:Gem::Dependency
123
- name: rspec
123
+ name: sane
124
124
  prerelease: false
125
125
  requirement: &id008 !ruby/object:Gem::Requirement
126
126
  none: false
@@ -131,10 +131,10 @@ dependencies:
131
131
  segments:
132
132
  - 0
133
133
  version: "0"
134
- type: :development
134
+ type: :runtime
135
135
  version_requirements: *id008
136
136
  - !ruby/object:Gem::Dependency
137
- name: fakefs
137
+ name: rspec
138
138
  prerelease: false
139
139
  requirement: &id009 !ruby/object:Gem::Requirement
140
140
  none: false
@@ -148,7 +148,7 @@ dependencies:
148
148
  type: :development
149
149
  version_requirements: *id009
150
150
  - !ruby/object:Gem::Dependency
151
- name: mocha
151
+ name: fakefs
152
152
  prerelease: false
153
153
  requirement: &id010 !ruby/object:Gem::Requirement
154
154
  none: false
@@ -161,6 +161,20 @@ dependencies:
161
161
  version: "0"
162
162
  type: :development
163
163
  version_requirements: *id010
164
+ - !ruby/object:Gem::Dependency
165
+ name: mocha
166
+ prerelease: false
167
+ requirement: &id011 !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 3
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ type: :development
177
+ version_requirements: *id011
164
178
  description: Easily deploy your Rails app to RailsHoster.com by using this gem.
165
179
  email:
166
180
  - fischer@enterprise-rails.de
@@ -175,6 +189,7 @@ files:
175
189
  - .travis.yml
176
190
  - CHANGELOG.textile
177
191
  - CONTRIB.txt
192
+ - Gemfile
178
193
  - LICENSE
179
194
  - README.textile
180
195
  - ROADMAP.textile