rda 0.3.3 → 0.4.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +14 -11
- data/README.md +43 -42
- data/bin/rda +1 -20
- data/lib/rda/app.rb +28 -2
- data/lib/rda/command.rb +38 -0
- data/lib/rda/helper.rb +15 -0
- data/lib/rda/nginx.rb +16 -107
- data/lib/rda/rvm.rb +19 -5
- data/lib/rda/templates/nginx +6 -2
- data/lib/rda/templates/rda.json +102 -0
- data/lib/rda/version.rb +1 -1
- data/lib/rda.rb +9 -6
- data/rda.gemspec +2 -1
- data/spec/dummy/.rda +100 -0
- data/spec/fixtures/nginx.conf +1 -0
- data/spec/lib/rda/app_spec.rb +47 -1
- data/spec/lib/rda/command_spec.rb +22 -0
- data/spec/lib/rda/helper_spec.rb +16 -0
- data/spec/lib/rda/nginx_spec.rb +8 -66
- data/spec/lib/rda/rvm_spec.rb +10 -2
- data/spec/lib/rda_spec.rb +14 -3
- metadata +34 -11
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
**0.4.0 (2012)**
|
2
|
+
|
3
|
+
* Provide support to configure options of rda
|
4
|
+
* Set up load paths of applications when setting up rvm
|
5
|
+
* Introduce a new command `rda app deploy` to deploy applications to
|
6
|
+
nginx
|
7
|
+
|
1
8
|
**0.3.3 (Fri, Nov 9, 2012)**
|
2
9
|
|
3
10
|
* Added a rake task for running specs
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rda (0.
|
4
|
+
rda (0.4.0.pre)
|
5
5
|
activesupport (>= 3.1)
|
6
6
|
confstruct (~> 0.2)
|
7
|
+
oj (~> 1.4.4)
|
7
8
|
thor (~> 0.15)
|
8
9
|
|
9
10
|
GEM
|
@@ -23,15 +24,17 @@ GEM
|
|
23
24
|
guard-bundler (1.0.0)
|
24
25
|
bundler (~> 1.0)
|
25
26
|
guard (~> 1.1)
|
26
|
-
guard-rspec (1.1
|
27
|
+
guard-rspec (2.1.1)
|
27
28
|
guard (>= 1.1)
|
29
|
+
rspec (~> 2.11)
|
28
30
|
i18n (0.6.1)
|
29
31
|
listen (0.4.7)
|
30
32
|
rb-fchange (~> 0.0.5)
|
31
33
|
rb-fsevent (~> 0.9.1)
|
32
34
|
rb-inotify (~> 0.8.8)
|
33
35
|
method_source (0.7.1)
|
34
|
-
multi_json (1.3.
|
36
|
+
multi_json (1.3.7)
|
37
|
+
oj (1.4.4)
|
35
38
|
pry (0.9.9.6)
|
36
39
|
coderay (~> 1.0.5)
|
37
40
|
method_source (~> 0.7.1)
|
@@ -42,14 +45,14 @@ GEM
|
|
42
45
|
rb-fsevent (0.9.1)
|
43
46
|
rb-inotify (0.8.8)
|
44
47
|
ffi (>= 0.5.0)
|
45
|
-
rspec (2.
|
46
|
-
rspec-core (~> 2.
|
47
|
-
rspec-expectations (~> 2.
|
48
|
-
rspec-mocks (~> 2.
|
49
|
-
rspec-core (2.
|
50
|
-
rspec-expectations (2.
|
48
|
+
rspec (2.11.0)
|
49
|
+
rspec-core (~> 2.11.0)
|
50
|
+
rspec-expectations (~> 2.11.0)
|
51
|
+
rspec-mocks (~> 2.11.0)
|
52
|
+
rspec-core (2.11.1)
|
53
|
+
rspec-expectations (2.11.3)
|
51
54
|
diff-lcs (~> 1.1.3)
|
52
|
-
rspec-mocks (2.
|
55
|
+
rspec-mocks (2.11.3)
|
53
56
|
ruby_gntp (0.3.4)
|
54
57
|
slop (2.4.4)
|
55
58
|
thor (0.15.4)
|
@@ -61,7 +64,7 @@ DEPENDENCIES
|
|
61
64
|
fivemat (~> 1.0)
|
62
65
|
guard (~> 1.2)
|
63
66
|
guard-bundler (~> 1.0)
|
64
|
-
guard-rspec (~>
|
67
|
+
guard-rspec (~> 2.1)
|
65
68
|
pry (~> 0.9.9)
|
66
69
|
rake
|
67
70
|
rda!
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## Rda
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/towerhe/rda.png?branch=develop)](http://travis-ci.org/towerhe/rda)
|
4
|
+
[![Dependency Status](https://gemnasium.com/towerhe/rda.png)](https://gemnasium.com/towerhe/rda)
|
5
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/towerhe/rda)
|
6
|
+
|
3
7
|
### Description
|
4
8
|
|
5
9
|
Rda(Rails Development Assist) is combined with lots of useful commands which can help you to setup your development enviroments and tools more quickly.
|
@@ -24,20 +28,14 @@ Or simply add rda to the Gemfile
|
|
24
28
|
gem 'rda'
|
25
29
|
```
|
26
30
|
|
27
|
-
|
31
|
+
And then, you should run `rda init` under the root of your application.
|
28
32
|
|
29
33
|
#### Configuration
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
if Rails.env == 'development'
|
36
|
-
Rda.configure do
|
37
|
-
nginx_conf_paths ['/etc/nginx', '/opt/nginx/conf', '/usr/local/nginx/conf']
|
38
|
-
end
|
39
|
-
end
|
40
|
-
```
|
35
|
+
After you run `rda init` successfully. You will see a generated file
|
36
|
+
named `.rda` under the root of your application and it contains options
|
37
|
+
like:
|
38
|
+
[rda.json](https://github.com/towerhe/rda/blob/develop/lib/rda/templates/rda.json)
|
41
39
|
|
42
40
|
#### Set up RVM
|
43
41
|
|
@@ -48,13 +46,33 @@ rda rvm setup
|
|
48
46
|
First of all, this command will check whether the RVM is installed. If RVM is installed, it will create a .rvmrc for the application with the content which looks like:
|
49
47
|
|
50
48
|
```bash
|
51
|
-
if [[ -s '/path/to/rvm/environments/ruby-1.9.3-
|
52
|
-
. '/path/to/rvm/environments/ruby-1.9.3-
|
49
|
+
if [[ -s '/path/to/rvm/environments/ruby-1.9.3-p286@app_name' ]]; then
|
50
|
+
. '/path/to/rvm/environments/ruby-1.9.3-p286@app_name'
|
53
51
|
else
|
54
|
-
rvm use ruby-1.9.3-
|
52
|
+
rvm use ruby-1.9.3-p286@app_name --create
|
55
53
|
fi
|
56
54
|
```
|
57
55
|
|
56
|
+
And then, it will create a config file to set up load paths of your
|
57
|
+
applications.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# config/setup_load_paths.rb
|
61
|
+
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
|
62
|
+
begin
|
63
|
+
require 'rvm'
|
64
|
+
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
|
65
|
+
rescue LoadError
|
66
|
+
raise "RVM gem is currently unavailable."
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# If you're not using Bundler at all, remove lines bellow
|
71
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile',
|
72
|
+
File.dirname(__FILE__))
|
73
|
+
require 'bundler/setup'
|
74
|
+
```
|
75
|
+
|
58
76
|
After setting up RVM, you need to trust the rvmrc by:
|
59
77
|
|
60
78
|
```bash
|
@@ -71,53 +89,36 @@ If RVM is not installed, this command will do nothing but exit.
|
|
71
89
|
rda rvm discard
|
72
90
|
```
|
73
91
|
|
74
|
-
This command removes the
|
92
|
+
This command removes the `.rvmrc` and `config/setup_load_paths.rb` from your rails application.
|
75
93
|
|
76
94
|
#### Setup Nginx
|
77
95
|
|
78
96
|
```bash
|
79
|
-
rda nginx setup
|
97
|
+
rda nginx setup
|
80
98
|
```
|
81
99
|
|
82
|
-
|
83
|
-
|
84
|
-
* /etc/nginx
|
85
|
-
* /usr/local/nginx/conf
|
86
|
-
* /opt/nginx/conf
|
87
|
-
|
88
|
-
You can change the default searching paths by:
|
89
|
-
|
90
|
-
```ruby
|
91
|
-
Rda.configure { nginx_conf_paths ['/path/to/nginx/conf'] }
|
92
|
-
```
|
93
|
-
|
94
|
-
Please make sure that you have the write permission of the directory you choosed, or you can run:
|
100
|
+
Please make sure that you have the write permission to config your nginx, or you can run:
|
95
101
|
|
96
102
|
```bash
|
97
|
-
rvmsudo rda nginx setup
|
103
|
+
rvmsudo rda nginx setup
|
98
104
|
```
|
99
105
|
|
100
|
-
|
106
|
+
It will try to create `sites-available` and `sites-enabled` to save the configs of rails applications.
|
101
107
|
|
102
108
|
* sites-available saves the configs of the rails applications.
|
103
109
|
* sites-enabled saves the link to the rails applications.
|
104
110
|
|
105
|
-
Next it will set Nginx to include the configs under sites-enabled
|
106
|
-
|
111
|
+
Next it will set Nginx to include the configs under `sites-enabled`. It means that only the applications configured under `sites-enabled` will be loaded.
|
107
112
|
|
108
|
-
|
113
|
+
#### Deploy application
|
109
114
|
|
110
|
-
|
115
|
+
Now you should deploy your applications with a new command of rda.
|
111
116
|
|
112
117
|
```bash
|
113
|
-
rda
|
114
|
-
|
115
|
-
sudo rda nginx discard --hostname www.example.com # Or
|
116
|
-
|
117
|
-
rvmsudo rda nginx discard --hostname www.example.com # Using RVM
|
118
|
+
rda app deploy
|
118
119
|
```
|
119
120
|
|
120
|
-
|
121
|
+
It will create a config file for your application under `sites-available` and create a link to the config file under `sites-enabled`. After all, it will create a local hostname for your application in `/etc/hosts`.
|
121
122
|
|
122
123
|
#### Restart application
|
123
124
|
|
@@ -125,7 +126,7 @@ This command will clean up all the things created or configured by `rda nginx se
|
|
125
126
|
rda app restart
|
126
127
|
```
|
127
128
|
|
128
|
-
This command touches tmp/restart.txt to restart your rails application, For detail, please visit [http://bit.ly/ztKA07](http://bit.ly/ztKA07)
|
129
|
+
This command touches `tmp/restart.txt` to restart your rails application, For detail, please visit [http://bit.ly/ztKA07](http://bit.ly/ztKA07)
|
129
130
|
|
130
131
|
#### Release your rails application
|
131
132
|
|
data/bin/rda
CHANGED
@@ -3,23 +3,4 @@
|
|
3
3
|
|
4
4
|
require 'rda'
|
5
5
|
|
6
|
-
|
7
|
-
desc 'rvm ACTION', 'Set up RVM. Available actions: setup, discard.'
|
8
|
-
def rvm(action)
|
9
|
-
Rda::Rvm.new.send(action.to_sym)
|
10
|
-
end
|
11
|
-
|
12
|
-
desc 'nginx ACTION', 'Manage settings of nginx. Available actions: setup, discard.'
|
13
|
-
method_option :environment, aliases: "-e", desc: "Set the environment of the application"
|
14
|
-
method_option :hostname, aliases: "-h", desc: "Set the hostname of the application"
|
15
|
-
def nginx(action)
|
16
|
-
Rda::Nginx.new.send(action.to_sym, options)
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'app ACTION', 'Manage the lifecycle of the application. Available actions: restart, release.'
|
20
|
-
def app(action)
|
21
|
-
Rda::App.new.send(action.to_sym)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
RdaCommand.start
|
6
|
+
Rda::Command.start
|
data/lib/rda/app.rb
CHANGED
@@ -1,11 +1,37 @@
|
|
1
1
|
module Rda
|
2
2
|
class App < Thor
|
3
|
-
|
3
|
+
include Thor::Actions
|
4
|
+
include Helper
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
File.dirname(__FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'deploy', 'Deploy the application to nginx'
|
11
|
+
def deploy
|
12
|
+
conf_dir = Rda.config.nginx.conf_dir
|
13
|
+
|
14
|
+
unless Rda::Nginx.setup?
|
15
|
+
$stderr.puts 'ERROR: Nginx is not set up properly. Please run `rda nginx setup` first.'
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
domain = Rda.config.domain
|
20
|
+
|
21
|
+
template("templates/nginx", "#{conf_dir}/sites-available/#{domain}")
|
22
|
+
link_file("#{conf_dir}/sites-available/#{domain}", "#{conf_dir}/sites-enabled/#{domain}")
|
23
|
+
|
24
|
+
unless configured?('/etc/hosts', "127.0.0.1 #{domain}")
|
25
|
+
append_file "/etc/hosts", "127.0.0.1 #{domain}\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'restart', 'Restart the application'
|
4
30
|
def restart
|
5
31
|
FileUtils.touch dir_of('tmp') + '/restart.txt'
|
6
32
|
end
|
7
33
|
|
8
|
-
desc '
|
34
|
+
desc 'release', 'Release the application'
|
9
35
|
def release
|
10
36
|
version_file = File.join(Rda::Rails.root, 'VERSION')
|
11
37
|
version = File.exist?(version_file) ? File.read(version_file).strip : ""
|
data/lib/rda/command.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
%w(rails rvm nginx app).each do |f|
|
2
|
+
require File.join(File.dirname(__FILE__), f)
|
3
|
+
end
|
4
|
+
|
5
|
+
module Rda
|
6
|
+
class Command < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
File.dirname(__FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'init', 'Create a default config for rda.'
|
14
|
+
def init
|
15
|
+
template('templates/rda.json', "#{Rda::Rails.root}/.rda")
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'rvm ACTION', 'Set up RVM. Available actions: setup, discard.'
|
19
|
+
def rvm(action)
|
20
|
+
Rda::Rvm.new.send(action.to_sym)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'nginx ACTION', 'Manage settings of nginx. Available actions: setup, discard.'
|
24
|
+
def nginx(action)
|
25
|
+
Rda::Nginx.new.send(action.to_sym, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'app ACTION', 'Manage the lifecycle of the application. Available actions: restart, release.'
|
29
|
+
def app(action)
|
30
|
+
Rda::App.new.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def app_name
|
35
|
+
Rails.app_name
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/rda/helper.rb
ADDED
data/lib/rda/nginx.rb
CHANGED
@@ -1,145 +1,54 @@
|
|
1
1
|
module Rda
|
2
2
|
class Nginx < Thor
|
3
3
|
include Thor::Actions
|
4
|
-
|
5
|
-
def self.source_root
|
6
|
-
File.dirname(__FILE__)
|
7
|
-
end
|
4
|
+
include Helper
|
8
5
|
|
9
6
|
desc "setup", "Set up your rails application"
|
10
7
|
def setup(options = {})
|
11
8
|
return unless installed?
|
12
9
|
|
13
|
-
@hostname, @environment = options["hostname"], options["environment"]
|
14
|
-
|
15
|
-
create_setup_load_paths
|
16
10
|
mkdir_for_sites
|
17
|
-
set_passenger_user_and_group
|
18
11
|
include_sites_enabled
|
19
|
-
|
20
|
-
template("templates/nginx", "#{conf_path}/sites-available/#{hostname}")
|
21
|
-
link_file("#{conf_path}/sites-available/#{hostname}", "#{conf_path}/sites-enabled/#{hostname}")
|
22
|
-
|
23
|
-
unless configured?('/etc/hosts', "127.0.0.1 #{hostname}")
|
24
|
-
append_file "/etc/hosts", "127.0.0.1 #{hostname}"
|
25
|
-
end
|
26
12
|
end
|
27
13
|
|
28
|
-
|
29
|
-
|
30
|
-
return unless installed?
|
31
|
-
|
32
|
-
@hostname = options["hostname"]
|
14
|
+
def self.setup?
|
15
|
+
conf_dir = Rda.config.nginx.conf_dir
|
33
16
|
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
gsub_file("/etc/hosts", "127.0.0.1 #{hostname}", '')
|
39
|
-
remove_file "#{Rda::Rails.root}/config/setup_load_paths.rb"
|
17
|
+
File.directory?(File.join(conf_dir, 'sites-available')) &&
|
18
|
+
File.directory?(File.join(conf_dir, 'sites-enabled'))
|
40
19
|
end
|
41
20
|
|
42
21
|
private
|
43
22
|
def installed?
|
44
|
-
File.
|
45
|
-
end
|
46
|
-
|
47
|
-
def conf_path
|
48
|
-
return @conf_path if @conf_path
|
49
|
-
|
50
|
-
if available_paths.empty?
|
51
|
-
prompt_not_found
|
52
|
-
|
53
|
-
return
|
54
|
-
end
|
55
|
-
|
56
|
-
@conf_path = available_paths.first
|
57
|
-
begin
|
58
|
-
@conf_path = ask_for_choosing_one if available_paths.size > 1
|
59
|
-
rescue SystemExit
|
60
|
-
$stderr.puts "ERROR: You need to choose a config directory of Nginx!"
|
61
|
-
return
|
62
|
-
end
|
63
|
-
|
64
|
-
@conf_path
|
65
|
-
end
|
66
|
-
|
67
|
-
def hostname
|
68
|
-
@hostname || "#{Rda::Rails.app_name}.local"
|
23
|
+
File.exists?(conf_path) if conf_path
|
69
24
|
end
|
70
25
|
|
71
|
-
def
|
72
|
-
|
73
|
-
@paths ||= search_paths.select { |p| File.directory? p if p } unless search_paths.empty?
|
26
|
+
def conf_dir
|
27
|
+
Rda.config.nginx.conf_dir
|
74
28
|
end
|
75
29
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
def ask_for_choosing_one
|
83
|
-
available_paths.each_with_index { |p, i| puts "#{i + 1}) #{p}" }
|
84
|
-
puts "\n"
|
85
|
-
chosen = ask "Found more than one config directory of Nginx, please choose one to setup:"
|
86
|
-
|
87
|
-
index = chosen.to_i - 1
|
88
|
-
|
89
|
-
index >= 0 && index < available_paths.size ? available_paths[index] : exit
|
90
|
-
end
|
30
|
+
def conf_path
|
31
|
+
if File.exists? File.join(conf_dir, 'nginx.conf')
|
32
|
+
return File.join(conf_dir, 'nginx.conf')
|
33
|
+
end
|
91
34
|
|
92
|
-
|
93
|
-
copy_file "templates/setup_load_paths.rb", "#{Rda::Rails.root}/config/setup_load_paths.rb"
|
35
|
+
$stderr.puts "ERROR: Missing `nginx.conf` in `#{conf_dir}`."
|
94
36
|
end
|
95
37
|
|
96
38
|
def mkdir_for_sites
|
97
39
|
%W(available enabled).each do |n|
|
98
|
-
dir =
|
40
|
+
dir = conf_dir + "/sites-#{n}"
|
99
41
|
empty_directory(dir) unless File.directory?(dir)
|
100
42
|
end
|
101
43
|
end
|
102
44
|
|
103
|
-
def set_passenger_user_and_group
|
104
|
-
conf = conf_path + '/nginx.conf'
|
105
|
-
|
106
|
-
unless configured?(conf, 'passenger_default_user')
|
107
|
-
gsub_file conf, /http \{/, <<-PASSENGER
|
108
|
-
http {
|
109
|
-
passenger_default_user root;
|
110
|
-
PASSENGER
|
111
|
-
end
|
112
|
-
|
113
|
-
unless configured?(conf, 'passenger_default_group')
|
114
|
-
gsub_file conf, /http \{/, <<-PASSENGER
|
115
|
-
http {
|
116
|
-
passenger_default_group root;
|
117
|
-
PASSENGER
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
45
|
def include_sites_enabled
|
122
|
-
|
123
|
-
unless configured?(conf, "include #{conf_path}/sites-enabled/*;")
|
46
|
+
unless configured?(conf_path, "include #{conf_dir}/sites-enabled/*;")
|
124
47
|
gsub_file conf, /http \{/, <<-INCLUDE_SITES_ENABLED
|
125
48
|
http {
|
126
|
-
include #{
|
49
|
+
include #{conf_dir}/sites-enabled/*;
|
127
50
|
INCLUDE_SITES_ENABLED
|
128
51
|
end
|
129
52
|
end
|
130
|
-
|
131
|
-
def configured?(fname, conf)
|
132
|
-
File.open(fname) do |f|
|
133
|
-
f.readlines.each do |l|
|
134
|
-
if l.strip.start_with?(conf)
|
135
|
-
$stderr.puts "INFO: #{conf} has already been set!"
|
136
|
-
|
137
|
-
return true
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
false
|
143
|
-
end
|
144
53
|
end
|
145
54
|
end
|
data/lib/rda/rvm.rb
CHANGED
@@ -10,6 +10,7 @@ module Rda
|
|
10
10
|
def setup
|
11
11
|
if installed?
|
12
12
|
template('templates/rvmrc', rvmrc_path)
|
13
|
+
create_setup_load_paths
|
13
14
|
else
|
14
15
|
$stderr.puts "ERROR: RVM is not found. Please make sure that RVM is installed."
|
15
16
|
end
|
@@ -17,11 +18,8 @@ module Rda
|
|
17
18
|
|
18
19
|
desc "discard", "Discard RVM settings for rails application"
|
19
20
|
def discard
|
20
|
-
|
21
|
-
|
22
|
-
else
|
23
|
-
$stderr.puts "ERROR: #{rvmrc_path} not found."
|
24
|
-
end
|
21
|
+
remove_file(rvmrc_path)
|
22
|
+
remove_file(setup_load_paths_path)
|
25
23
|
end
|
26
24
|
|
27
25
|
private
|
@@ -44,5 +42,21 @@ module Rda
|
|
44
42
|
def rvmrc_path
|
45
43
|
"#{Rda::Rails.root}/.rvmrc"
|
46
44
|
end
|
45
|
+
|
46
|
+
def setup_load_paths_path
|
47
|
+
"#{Rda::Rails.root}/config/setup_load_paths.rb"
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_setup_load_paths
|
51
|
+
copy_file "templates/setup_load_paths.rb", "#{Rda::Rails.root}/config/setup_load_paths.rb"
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove_file(file)
|
55
|
+
if File.exists?(file)
|
56
|
+
super(file)
|
57
|
+
else
|
58
|
+
$stderr.puts "ERROR: #{file} not found."
|
59
|
+
end
|
60
|
+
end
|
47
61
|
end
|
48
62
|
end
|
data/lib/rda/templates/nginx
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
server {
|
2
|
-
server_name <%=
|
2
|
+
server_name <%= Rda.config.domain %>;
|
3
3
|
root <%= "#{Rda::Rails.root}/public" %>;
|
4
|
+
rails_env <%= Rda.config.rails_env || "development" %>;
|
5
|
+
|
4
6
|
passenger_enabled on;
|
5
|
-
|
7
|
+
<% Rda.config.passenger.each do |k, v| %>
|
8
|
+
<%= "passenger_#{k} #{v};" %>
|
9
|
+
<% end %>
|
6
10
|
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
// The configuration of rda should be a valid JSON hash
|
2
|
+
{
|
3
|
+
/**
|
4
|
+
* This option allows you to specify the domain of the application
|
5
|
+
*
|
6
|
+
* @default YOUR_APP_NAME.local
|
7
|
+
* @required
|
8
|
+
*/
|
9
|
+
"domain": "<%= app_name %>.local",
|
10
|
+
|
11
|
+
/**
|
12
|
+
* This option allows you to specify the default RAILS_ENV value
|
13
|
+
*
|
14
|
+
* @default "development"
|
15
|
+
* @required
|
16
|
+
*/
|
17
|
+
"rails_env": "development",
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Configuring Nginx
|
21
|
+
*/
|
22
|
+
"nginx": {
|
23
|
+
/**
|
24
|
+
* This option allows you to specify the config directory of your nginx
|
25
|
+
* installation
|
26
|
+
*
|
27
|
+
* @default "/opt/nginx/conf"
|
28
|
+
* @required
|
29
|
+
*/
|
30
|
+
"conf_dir": "/opt/nginx/conf"
|
31
|
+
},
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Configuring Phusion Passenger
|
35
|
+
*
|
36
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_configuring_phusion_passenger
|
37
|
+
*/
|
38
|
+
"passenger": {
|
39
|
+
/**
|
40
|
+
* This option allows you to override that behavior and explicitly set
|
41
|
+
* a user to run the web application as, regardless of the ownership of
|
42
|
+
* environment.rb/config.ru.
|
43
|
+
*
|
44
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_user_lt_username_gt
|
45
|
+
*/
|
46
|
+
"user": "root",
|
47
|
+
|
48
|
+
/**
|
49
|
+
* This option allows you to override that behavior and explicitly set
|
50
|
+
* a group to run the web application as, regardless of the ownership of
|
51
|
+
* environment.rb/config.ru.
|
52
|
+
*
|
53
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_group_lt_group_name_gt
|
54
|
+
*/
|
55
|
+
"group": "root"
|
56
|
+
|
57
|
+
/**
|
58
|
+
* This option allows you to specify the Ruby interpreter to use.
|
59
|
+
*
|
60
|
+
* NOTE This option is supported by passenger 4.0 only.
|
61
|
+
*
|
62
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_ruby_lt_filename_gt
|
63
|
+
* @optional
|
64
|
+
*/
|
65
|
+
// "ruby": "path/to/ruby"
|
66
|
+
|
67
|
+
/** Resource control and optimization options **/
|
68
|
+
/**
|
69
|
+
* The maximum number of application processes that may
|
70
|
+
* simultanously exist. A larger number results in higher memory
|
71
|
+
* usage, but improved ability to handle concurrent HTTP clients.
|
72
|
+
*
|
73
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMaxPoolSize
|
74
|
+
* @optional
|
75
|
+
* @default 6
|
76
|
+
*/
|
77
|
+
// "max_pool_size": 15
|
78
|
+
|
79
|
+
/**
|
80
|
+
* This specifies the minimum number of application processes that
|
81
|
+
* should exist for a given application. You should set this option
|
82
|
+
* to a non-zero value if you want to avoid potentially long startup
|
83
|
+
* times after a website has been idle for an extended period.
|
84
|
+
*
|
85
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMinInstances
|
86
|
+
* @optional
|
87
|
+
* @default 1
|
88
|
+
*/
|
89
|
+
// "min_instances": 10
|
90
|
+
|
91
|
+
/**
|
92
|
+
* The maximum number of requests an application process will
|
93
|
+
* process. After serving that many requests, the application
|
94
|
+
* process will be shut down and Phusion Passenger will restart it.
|
95
|
+
*
|
96
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMaxRequests
|
97
|
+
* @optional
|
98
|
+
* @default 0
|
99
|
+
*/
|
100
|
+
// "max_requests": 10000
|
101
|
+
}
|
102
|
+
}
|
data/lib/rda/version.rb
CHANGED
data/lib/rda.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'oj'
|
2
3
|
require 'confstruct'
|
3
4
|
require 'confstruct/configuration'
|
4
5
|
require 'active_support/inflector'
|
5
6
|
|
6
|
-
require 'rda/
|
7
|
-
require 'rda/
|
8
|
-
require 'rda/nginx'
|
9
|
-
require 'rda/app'
|
7
|
+
require 'rda/helper'
|
8
|
+
require 'rda/command'
|
10
9
|
|
11
10
|
module Rda
|
12
11
|
class << self
|
13
12
|
def config
|
14
|
-
|
15
|
-
|
13
|
+
begin
|
14
|
+
@config ||= Confstruct::Configuration.new(
|
15
|
+
Oj.load(File.open(File.join(Rda::Rails.root, '.rda')))
|
16
|
+
)
|
17
|
+
rescue Errno::ENOENT
|
18
|
+
$stderr.puts 'ERROR: Rda is not initialized, please run `rda init` first.'
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
data/rda.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'rspec', '~> 2.10'
|
23
23
|
s.add_development_dependency 'guard', '~> 1.2'
|
24
24
|
s.add_development_dependency 'guard-bundler', '~> 1.0'
|
25
|
-
s.add_development_dependency 'guard-rspec', '~>
|
25
|
+
s.add_development_dependency 'guard-rspec', '~> 2.1'
|
26
26
|
s.add_development_dependency 'fivemat', '~> 1.0'
|
27
27
|
if RUBY_PLATFORM =~ /darwin/
|
28
28
|
s.add_development_dependency 'ruby_gntp', '~> 0.3'
|
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_dependency 'activesupport', '>= 3.1'
|
32
32
|
s.add_dependency 'thor', '~> 0.15'
|
33
33
|
s.add_dependency 'confstruct', '~> 0.2'
|
34
|
+
s.add_dependency 'oj', '~> 1.4.4'
|
34
35
|
end
|
data/spec/dummy/.rda
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
// The configuration of rda should be a valid JSON hash
|
2
|
+
{
|
3
|
+
/**
|
4
|
+
* This option allows you to specify the domain of the application
|
5
|
+
*
|
6
|
+
* @default YOUR_APP_NAME.local
|
7
|
+
* @required
|
8
|
+
*/
|
9
|
+
"domain": "dummy.local",
|
10
|
+
|
11
|
+
/**
|
12
|
+
* This option allows you to specify the default RAILS_ENV value
|
13
|
+
*
|
14
|
+
* @default "development"
|
15
|
+
* @required
|
16
|
+
*/
|
17
|
+
"rails_env": "development",
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Configuring Nginx
|
21
|
+
*/
|
22
|
+
"nginx": {
|
23
|
+
/**
|
24
|
+
* This option allows you to specify the config directory of your nginx
|
25
|
+
* installation
|
26
|
+
*
|
27
|
+
* @default "/opt/nginx/conf"
|
28
|
+
* @required
|
29
|
+
*/
|
30
|
+
"conf_dir": "/opt/nginx/conf"
|
31
|
+
},
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Configuring Phusion Passenger
|
35
|
+
*
|
36
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_configuring_phusion_passenger
|
37
|
+
*/
|
38
|
+
"passenger": {
|
39
|
+
/**
|
40
|
+
* This option allows you to override that behavior and explicitly set
|
41
|
+
* a user to run the web application as, regardless of the ownership of
|
42
|
+
* environment.rb/config.ru.
|
43
|
+
*
|
44
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_user_lt_username_gt
|
45
|
+
*/
|
46
|
+
"user": "root",
|
47
|
+
|
48
|
+
/**
|
49
|
+
* This option allows you to override that behavior and explicitly set
|
50
|
+
* a group to run the web application as, regardless of the ownership of
|
51
|
+
* environment.rb/config.ru.
|
52
|
+
*
|
53
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_group_lt_group_name_gt
|
54
|
+
*/
|
55
|
+
"group": "root"
|
56
|
+
|
57
|
+
/**
|
58
|
+
* This option allows you to specify the Ruby interpreter to use.
|
59
|
+
*
|
60
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#_passenger_ruby_lt_filename_gt
|
61
|
+
* @optional
|
62
|
+
*/
|
63
|
+
// "ruby": "path/to/ruby"
|
64
|
+
|
65
|
+
/** Resource control and optimization options **/
|
66
|
+
/**
|
67
|
+
* The maximum number of application processes that may
|
68
|
+
* simultanously exist. A larger number results in higher memory
|
69
|
+
* usage, but improved ability to handle concurrent HTTP clients.
|
70
|
+
*
|
71
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMaxPoolSize
|
72
|
+
* @optional
|
73
|
+
* @default 6
|
74
|
+
*/
|
75
|
+
// "max_pool_size": 15
|
76
|
+
|
77
|
+
/**
|
78
|
+
* This specifies the minimum number of application processes that
|
79
|
+
* should exist for a given application. You should set this option
|
80
|
+
* to a non-zero value if you want to avoid potentially long startup
|
81
|
+
* times after a website has been idle for an extended period.
|
82
|
+
*
|
83
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMinInstances
|
84
|
+
* @optional
|
85
|
+
* @default 1
|
86
|
+
*/
|
87
|
+
// "min_instances": 10
|
88
|
+
|
89
|
+
/**
|
90
|
+
* The maximum number of requests an application process will
|
91
|
+
* process. After serving that many requests, the application
|
92
|
+
* process will be shut down and Phusion Passenger will restart it.
|
93
|
+
*
|
94
|
+
* @see http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html#PassengerMaxRequests
|
95
|
+
* @optional
|
96
|
+
* @default 0
|
97
|
+
*/
|
98
|
+
// "max_requests": 10000
|
99
|
+
}
|
100
|
+
}
|
data/spec/fixtures/nginx.conf
CHANGED
data/spec/lib/rda/app_spec.rb
CHANGED
@@ -3,7 +3,53 @@ require 'spec_helper'
|
|
3
3
|
describe Rda::App do
|
4
4
|
subject { Rda::App.new }
|
5
5
|
|
6
|
-
|
6
|
+
let(:app_dir) { File.join(File.dirname(__FILE__), '../../dummy') }
|
7
|
+
let(:nginx_conf_dir) { File.join(File.dirname(__FILE__), '../../tmp') }
|
8
|
+
|
9
|
+
before { Rda::Rails.should_receive(:root).any_number_of_times.and_return(app_dir) }
|
10
|
+
|
11
|
+
describe '#deploy' do
|
12
|
+
before do
|
13
|
+
Rda.stub_chain(:config, :domain).and_return('dummy.local')
|
14
|
+
Rda.stub_chain(:config, :rails_env).and_return('development')
|
15
|
+
Rda.stub_chain(:config, :nginx, :conf_dir).and_return(nginx_conf_dir)
|
16
|
+
Rda.stub_chain(:config, :passenger).and_return(:user => 'root', :group => 'root')
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when nginx is not set up' do
|
20
|
+
it 'prompts that nginx is not set up' do
|
21
|
+
capture(:stderr) do
|
22
|
+
subject.deploy
|
23
|
+
end.should == <<-PROMPT
|
24
|
+
ERROR: Nginx is not set up properly. Please run `rda nginx setup` first.
|
25
|
+
PROMPT
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when nginx is set up properly' do
|
30
|
+
before do
|
31
|
+
`mkdir -p #{nginx_conf_dir}/sites-available`
|
32
|
+
`mkdir -p #{nginx_conf_dir}/sites-enabled`
|
33
|
+
|
34
|
+
subject.should_receive(:append_file).with('/etc/hosts', "127.0.0.1 dummy.local\n").any_number_of_times
|
35
|
+
|
36
|
+
subject.deploy
|
37
|
+
end
|
38
|
+
|
39
|
+
after do
|
40
|
+
`rm -fr #{nginx_conf_dir}/sites-available`
|
41
|
+
`rm -fr #{nginx_conf_dir}/sites-enabled`
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'creates a virtual host config file in nginx' do
|
45
|
+
File.should be_exists(File.join(nginx_conf_dir, 'sites-available/dummy.local'))
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'enables the created virtual host' do
|
49
|
+
File.should be_exists(File.join(nginx_conf_dir, 'sites-enabled/dummy.local'))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
7
53
|
|
8
54
|
describe '#restart' do
|
9
55
|
it 'touches restart.txt' do
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rda::Command do
|
4
|
+
subject { Rda::Command.new }
|
5
|
+
|
6
|
+
describe '#init' do
|
7
|
+
let(:tmp_path) { File.join(File.dirname(__FILE__), '../../tmp') }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Rda::Rails.should_receive(:app_name).any_number_of_times.and_return('dummy')
|
11
|
+
Rda::Rails.should_receive(:root).any_number_of_times.and_return(tmp_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
after { `rm -f #{Rda::Rails.root}/.rda` }
|
15
|
+
|
16
|
+
it 'creates a file named .rda' do
|
17
|
+
subject.init
|
18
|
+
|
19
|
+
File.should be_exists("#{Rda::Rails.root}/.rda")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rda::Helper do
|
4
|
+
class MyClass
|
5
|
+
include Rda::Helper
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:obj) { MyClass.new }
|
9
|
+
let(:file) { File.join(File.dirname(__FILE__), '../../fixtures/nginx.conf') }
|
10
|
+
|
11
|
+
describe '#configured?' do
|
12
|
+
it 'returns true if the specified option is configured' do
|
13
|
+
obj.should be_configured file, "passenger_default_user root;"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/lib/rda/nginx_spec.rb
CHANGED
@@ -3,82 +3,24 @@ require 'spec_helper'
|
|
3
3
|
describe Rda::Nginx do
|
4
4
|
subject { Rda::Nginx.new }
|
5
5
|
|
6
|
-
|
7
|
-
Rda.configure { nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf'] }
|
8
|
-
|
9
|
-
Dir.chdir(File.join(File.dirname(__FILE__), '../../dummy'))
|
10
|
-
end
|
6
|
+
let(:app_dir) { File.join(File.dirname(__FILE__), '../../dummy') }
|
11
7
|
|
12
8
|
describe '#setup' do
|
13
|
-
context 'when nginx is not found' do
|
9
|
+
context 'when the config file of nginx is not found' do
|
14
10
|
before do
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
Rda::Rails.should_receive(:app_name).any_number_of_times.and_return('dummy')
|
12
|
+
Rda::Rails.should_receive(:root).any_number_of_times.and_return(app_dir)
|
13
|
+
|
14
|
+
File.should_receive(:exists?).with('/opt/nginx/conf/nginx.conf').and_return(false)
|
18
15
|
end
|
19
16
|
|
20
|
-
it 'prompts nginx is not found' do
|
17
|
+
it 'prompts `nginx.conf` is not found' do
|
21
18
|
capture(:stderr) do
|
22
19
|
subject.setup
|
23
20
|
end.should == <<-PROMPT
|
24
|
-
ERROR:
|
25
|
-
|
26
|
-
* /etc/nginx
|
27
|
-
* /usr/local/nginx/conf
|
28
|
-
* /opt/nginx/conf
|
29
|
-
|
21
|
+
ERROR: Missing `nginx.conf` in `/opt/nginx/conf`.
|
30
22
|
PROMPT
|
31
23
|
end
|
32
24
|
end
|
33
|
-
|
34
|
-
context 'when found more than one config directory of nginx' do
|
35
|
-
before do
|
36
|
-
File.should_receive(:directory?).with('/etc/nginx').and_return(true)
|
37
|
-
File.should_receive(:directory?).with('/usr/local/nginx/conf').and_return(true)
|
38
|
-
File.should_receive(:directory?).with('/opt/nginx/conf').and_return(false)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'asks to choose one path' do
|
42
|
-
choice = <<-CHOICE
|
43
|
-
1) /etc/nginx
|
44
|
-
2) /usr/local/nginx/conf
|
45
|
-
|
46
|
-
Found more than one config directory of Nginx, please choose one to setup:
|
47
|
-
CHOICE
|
48
|
-
|
49
|
-
$stdin.should_receive(:gets).and_return('\n')
|
50
|
-
|
51
|
-
capture(:stdout) do
|
52
|
-
subject.setup
|
53
|
-
end.strip.should == choice.strip
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#discard' do
|
59
|
-
let(:dummy_path) { File.dirname(__FILE__) + "/../../tmp/nginx" }
|
60
|
-
|
61
|
-
before do
|
62
|
-
FileUtils.mkdir_p dummy_path unless File.directory?(dummy_path)
|
63
|
-
FileUtils.copy_file(File.dirname(__FILE__) + "/../../fixtures/nginx.conf", dummy_path + '/nginx.conf')
|
64
|
-
Rda.configure { nginx_conf_paths [File.dirname(__FILE__) + "/../../tmp/nginx"] }
|
65
|
-
end
|
66
|
-
|
67
|
-
after do
|
68
|
-
conf = Rda.config.nginx_conf_paths.first
|
69
|
-
FileUtils.rm_r conf if File.directory?(conf)
|
70
|
-
|
71
|
-
Rda.configure { nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf'] }
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'discards the settings' do
|
75
|
-
subject.should_receive(:gsub_file).with("/etc/hosts", "127.0.0.1 dummy.local", '')
|
76
|
-
%W(enabled available).each do |n|
|
77
|
-
subject.should_receive(:remove_file).with("#{dummy_path}/sites-#{n}/dummy.local")
|
78
|
-
end
|
79
|
-
subject.should_receive(:remove_file).with("#{Rda::Rails.root}/config/setup_load_paths.rb")
|
80
|
-
|
81
|
-
subject.discard
|
82
|
-
end
|
83
25
|
end
|
84
26
|
end
|
data/spec/lib/rda/rvm_spec.rb
CHANGED
@@ -17,6 +17,7 @@ describe Rda::Rvm do
|
|
17
17
|
|
18
18
|
after(:all) do
|
19
19
|
`rm -f #{Rda::Rails.root}/.rvmrc`
|
20
|
+
`rm -f #{Rda::Rails.root}/config/setup_load_paths.rb`
|
20
21
|
|
21
22
|
ENV['rvm_path'] = @rvm_path
|
22
23
|
end
|
@@ -25,6 +26,10 @@ describe Rda::Rvm do
|
|
25
26
|
File.should be_exists("#{Rda::Rails.root}/.rvmrc")
|
26
27
|
end
|
27
28
|
|
29
|
+
it 'sets up loading paths' do
|
30
|
+
File.should be_exists("#{Rda::Rails.root}/config/setup_load_paths.rb")
|
31
|
+
end
|
32
|
+
|
28
33
|
describe 'checking the contents of .rvmrc' do
|
29
34
|
before { @contents = File.read("#{Rda::Rails.root}/.rvmrc") }
|
30
35
|
|
@@ -41,7 +46,7 @@ fi
|
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
44
|
-
|
49
|
+
|
45
50
|
context 'when RVM is not installed' do
|
46
51
|
before do
|
47
52
|
subject.should_receive(:installed?).and_return(false)
|
@@ -52,7 +57,10 @@ fi
|
|
52
57
|
it 'does not create .rvmrc' do
|
53
58
|
File.should_not be_exists("#{Rda::Rails.root}/.rvmrc")
|
54
59
|
end
|
55
|
-
end
|
56
60
|
|
61
|
+
it 'does not create `setup_load_paths`' do
|
62
|
+
File.should_not be_exists("#{Rda::Rails.root}/config/setup_load_paths.rb")
|
63
|
+
end
|
64
|
+
end
|
57
65
|
end
|
58
66
|
end
|
data/spec/lib/rda_spec.rb
CHANGED
@@ -2,19 +2,30 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Rda do
|
4
4
|
describe '.config' do
|
5
|
+
let(:dummy_path) { File.join(File.dirname(__FILE__), '../dummy') }
|
6
|
+
|
7
|
+
before do
|
8
|
+
Rda::Rails.should_receive(:root).any_number_of_times.and_return(dummy_path)
|
9
|
+
end
|
10
|
+
|
5
11
|
subject { Rda.config }
|
6
12
|
|
7
13
|
it { should be_a(Confstruct::Configuration) }
|
14
|
+
|
15
|
+
its(:domain) { should == 'dummy.local' }
|
16
|
+
its(:rails_env) { should == 'development' }
|
17
|
+
specify { subject.nginx.conf_dir.should == '/opt/nginx/conf' }
|
18
|
+
specify { subject.passenger.user.should == 'root' }
|
19
|
+
specify { subject.passenger.group.should == 'root' }
|
8
20
|
end
|
9
21
|
|
10
22
|
describe '.configure' do
|
11
23
|
it 'sets the config paths of nginx' do
|
12
24
|
Rda.configure do
|
13
|
-
|
25
|
+
rails_env 'production'
|
14
26
|
end
|
15
27
|
|
16
|
-
Rda.config.
|
17
|
-
Rda.config.nginx_conf_paths.should include('/tmp/rda/nginx/conf')
|
28
|
+
Rda.config.rails_env.should == 'production'
|
18
29
|
end
|
19
30
|
end
|
20
31
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0.pre
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tower He
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
85
|
+
version: '2.1'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
93
|
+
version: '2.1'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: fivemat
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,22 @@ dependencies:
|
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0.2'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: oj
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ~>
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 1.4.4
|
182
|
+
type: :runtime
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ~>
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 1.4.4
|
174
190
|
description: Rda(Rails Development Assist) is combined with lots of useful commands
|
175
191
|
which can help you to setup your development enviroments and tools more quickly.
|
176
192
|
email:
|
@@ -182,6 +198,7 @@ extra_rdoc_files: []
|
|
182
198
|
files:
|
183
199
|
- .gitignore
|
184
200
|
- .rspec
|
201
|
+
- .travis.yml
|
185
202
|
- CHANGELOG.md
|
186
203
|
- Gemfile
|
187
204
|
- Gemfile.lock
|
@@ -192,18 +209,24 @@ files:
|
|
192
209
|
- bin/rda
|
193
210
|
- lib/rda.rb
|
194
211
|
- lib/rda/app.rb
|
212
|
+
- lib/rda/command.rb
|
213
|
+
- lib/rda/helper.rb
|
195
214
|
- lib/rda/nginx.rb
|
196
215
|
- lib/rda/rails.rb
|
197
216
|
- lib/rda/rvm.rb
|
198
217
|
- lib/rda/templates/nginx
|
218
|
+
- lib/rda/templates/rda.json
|
199
219
|
- lib/rda/templates/rvmrc
|
200
220
|
- lib/rda/templates/setup_load_paths.rb
|
201
221
|
- lib/rda/version.rb
|
202
222
|
- rda.gemspec
|
203
223
|
- rvmrc.example
|
224
|
+
- spec/dummy/.rda
|
204
225
|
- spec/dummy/config.ru
|
205
226
|
- spec/fixtures/nginx.conf
|
206
227
|
- spec/lib/rda/app_spec.rb
|
228
|
+
- spec/lib/rda/command_spec.rb
|
229
|
+
- spec/lib/rda/helper_spec.rb
|
207
230
|
- spec/lib/rda/nginx_spec.rb
|
208
231
|
- spec/lib/rda/rails_spec.rb
|
209
232
|
- spec/lib/rda/rvm_spec.rb
|
@@ -223,16 +246,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
246
|
version: '0'
|
224
247
|
segments:
|
225
248
|
- 0
|
226
|
-
hash: -
|
249
|
+
hash: -4551379883523660910
|
227
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
251
|
none: false
|
229
252
|
requirements:
|
230
|
-
- - ! '
|
253
|
+
- - ! '>'
|
231
254
|
- !ruby/object:Gem::Version
|
232
|
-
version:
|
233
|
-
segments:
|
234
|
-
- 0
|
235
|
-
hash: -3989471672367132046
|
255
|
+
version: 1.3.1
|
236
256
|
requirements: []
|
237
257
|
rubyforge_project:
|
238
258
|
rubygems_version: 1.8.24
|
@@ -240,9 +260,12 @@ signing_key:
|
|
240
260
|
specification_version: 3
|
241
261
|
summary: Rails Development Assist
|
242
262
|
test_files:
|
263
|
+
- spec/dummy/.rda
|
243
264
|
- spec/dummy/config.ru
|
244
265
|
- spec/fixtures/nginx.conf
|
245
266
|
- spec/lib/rda/app_spec.rb
|
267
|
+
- spec/lib/rda/command_spec.rb
|
268
|
+
- spec/lib/rda/helper_spec.rb
|
246
269
|
- spec/lib/rda/nginx_spec.rb
|
247
270
|
- spec/lib/rda/rails_spec.rb
|
248
271
|
- spec/lib/rda/rvm_spec.rb
|