rda 0.3.1 → 0.3.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.
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -3
- data/bin/rda +0 -6
- data/lib/rda/app.rb +1 -1
- data/lib/rda/nginx.rb +6 -6
- data/lib/rda/rails.rb +11 -3
- data/lib/rda/rvm.rb +1 -1
- data/lib/rda/version.rb +1 -1
- data/spec/lib/rda/nginx_spec.rb +8 -8
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rda (0.3.
|
4
|
+
rda (0.3.2)
|
5
5
|
activesupport (>= 3.1)
|
6
6
|
confstruct (~> 0.2)
|
7
7
|
thor (~> 0.15)
|
@@ -9,7 +9,7 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: http://ruby.taobao.org/
|
11
11
|
specs:
|
12
|
-
activesupport (3.2.
|
12
|
+
activesupport (3.2.8)
|
13
13
|
i18n (~> 0.6)
|
14
14
|
multi_json (~> 1.0)
|
15
15
|
coderay (1.0.7)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
guard (~> 1.1)
|
26
26
|
guard-rspec (1.1.0)
|
27
27
|
guard (>= 1.1)
|
28
|
-
i18n (0.6.
|
28
|
+
i18n (0.6.1)
|
29
29
|
listen (0.4.7)
|
30
30
|
rb-fchange (~> 0.0.5)
|
31
31
|
rb-fsevent (~> 0.9.1)
|
@@ -36,6 +36,7 @@ GEM
|
|
36
36
|
coderay (~> 1.0.5)
|
37
37
|
method_source (~> 0.7.1)
|
38
38
|
slop (>= 2.4.4, < 3)
|
39
|
+
rake (0.9.2.2)
|
39
40
|
rb-fchange (0.0.5)
|
40
41
|
ffi
|
41
42
|
rb-fsevent (0.9.1)
|
@@ -62,6 +63,7 @@ DEPENDENCIES
|
|
62
63
|
guard-bundler (~> 1.0)
|
63
64
|
guard-rspec (~> 1.1)
|
64
65
|
pry (~> 0.9.9)
|
66
|
+
rake
|
65
67
|
rda!
|
66
68
|
rspec (~> 2.10)
|
67
69
|
ruby_gntp (~> 0.3)
|
data/bin/rda
CHANGED
@@ -3,12 +3,6 @@
|
|
3
3
|
|
4
4
|
require 'rda'
|
5
5
|
|
6
|
-
begin
|
7
|
-
Rda::Rails.app_name
|
8
|
-
rescue LoadError
|
9
|
-
$stderr.puts "ERROR: You should run rda under rails applications"
|
10
|
-
end
|
11
|
-
|
12
6
|
class RdaCommand < Thor
|
13
7
|
desc 'rvm ACTION', 'Set up RVM. Available actions: setup, discard.'
|
14
8
|
def rvm(action)
|
data/lib/rda/app.rb
CHANGED
data/lib/rda/nginx.rb
CHANGED
@@ -41,7 +41,7 @@ module Rda
|
|
41
41
|
|
42
42
|
private
|
43
43
|
def installed?
|
44
|
-
|
44
|
+
File.directory?(conf_path) if conf_path
|
45
45
|
end
|
46
46
|
|
47
47
|
def conf_path
|
@@ -70,7 +70,7 @@ module Rda
|
|
70
70
|
|
71
71
|
def available_paths
|
72
72
|
search_paths = Rda.config.nginx_conf_paths || []
|
73
|
-
@paths ||= search_paths.select { |p|
|
73
|
+
@paths ||= search_paths.select { |p| File.directory? p if p } unless search_paths.empty?
|
74
74
|
end
|
75
75
|
|
76
76
|
def prompt_not_found
|
@@ -96,7 +96,7 @@ module Rda
|
|
96
96
|
def mkdir_for_sites
|
97
97
|
%W(available enabled).each do |n|
|
98
98
|
dir = conf_path + "/sites-#{n}"
|
99
|
-
empty_directory(dir) unless
|
99
|
+
empty_directory(dir) unless File.directory?(dir)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -104,14 +104,14 @@ module Rda
|
|
104
104
|
conf = conf_path + '/nginx.conf'
|
105
105
|
|
106
106
|
unless configured?(conf, 'passenger_default_user')
|
107
|
-
gsub_file conf, /http {/, <<-PASSENGER
|
107
|
+
gsub_file conf, /http \{/, <<-PASSENGER
|
108
108
|
http {
|
109
109
|
passenger_default_user root;
|
110
110
|
PASSENGER
|
111
111
|
end
|
112
112
|
|
113
113
|
unless configured?(conf, 'passenger_default_group')
|
114
|
-
gsub_file conf, /http {/, <<-PASSENGER
|
114
|
+
gsub_file conf, /http \{/, <<-PASSENGER
|
115
115
|
http {
|
116
116
|
passenger_default_group root;
|
117
117
|
PASSENGER
|
@@ -121,7 +121,7 @@ http {
|
|
121
121
|
def include_sites_enabled
|
122
122
|
conf = conf_path + '/nginx.conf'
|
123
123
|
unless configured?(conf, "include #{conf_path}/sites-enabled/*;")
|
124
|
-
gsub_file conf, /http {/, <<-INCLUDE_SITES_ENABLED
|
124
|
+
gsub_file conf, /http \{/, <<-INCLUDE_SITES_ENABLED
|
125
125
|
http {
|
126
126
|
include #{conf_path}/sites-enabled/*;
|
127
127
|
INCLUDE_SITES_ENABLED
|
data/lib/rda/rails.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
module Rda
|
2
2
|
module Rails
|
3
3
|
def self.app_name
|
4
|
-
@app_name ||=
|
5
|
-
|
6
|
-
|
4
|
+
@app_name ||= begin
|
5
|
+
IO.foreach(File.join(Dir.pwd, 'config.ru')) do |l|
|
6
|
+
if l =~ /run\s+(.*)::Application/
|
7
|
+
return $1.underscore.dasherize
|
8
|
+
end
|
7
9
|
end
|
10
|
+
rescue
|
8
11
|
end
|
12
|
+
|
13
|
+
unless @app_name
|
14
|
+
$stderr.puts "ERROR: You should run rda under rails applications"
|
15
|
+
exit
|
16
|
+
end
|
9
17
|
end
|
10
18
|
|
11
19
|
def self.root
|
data/lib/rda/rvm.rb
CHANGED
data/lib/rda/version.rb
CHANGED
data/spec/lib/rda/nginx_spec.rb
CHANGED
@@ -12,9 +12,9 @@ describe Rda::Nginx do
|
|
12
12
|
describe '#setup' do
|
13
13
|
context 'when nginx is not found' do
|
14
14
|
before do
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
File.should_receive(:directory?).with('/etc/nginx').and_return(false)
|
16
|
+
File.should_receive(:directory?).with('/usr/local/nginx/conf').and_return(false)
|
17
|
+
File.should_receive(:directory?).with('/opt/nginx/conf').and_return(false)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'prompts nginx is not found' do
|
@@ -33,9 +33,9 @@ ERROR: Config directory of Nginx is not found in the following paths:
|
|
33
33
|
|
34
34
|
context 'when found more than one config directory of nginx' do
|
35
35
|
before do
|
36
|
-
|
37
|
-
|
38
|
-
|
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
39
|
end
|
40
40
|
|
41
41
|
it 'asks to choose one path' do
|
@@ -59,14 +59,14 @@ Found more than one config directory of Nginx, please choose one to setup:
|
|
59
59
|
let(:dummy_path) { File.dirname(__FILE__) + "/../../tmp/nginx" }
|
60
60
|
|
61
61
|
before do
|
62
|
-
FileUtils.mkdir_p dummy_path unless
|
62
|
+
FileUtils.mkdir_p dummy_path unless File.directory?(dummy_path)
|
63
63
|
FileUtils.copy_file(File.dirname(__FILE__) + "/../../fixtures/nginx.conf", dummy_path + '/nginx.conf')
|
64
64
|
Rda.configure { nginx_conf_paths [File.dirname(__FILE__) + "/../../tmp/nginx"] }
|
65
65
|
end
|
66
66
|
|
67
67
|
after do
|
68
68
|
conf = Rda.config.nginx_conf_paths.first
|
69
|
-
FileUtils.rm_r conf if
|
69
|
+
FileUtils.rm_r conf if File.directory?(conf)
|
70
70
|
|
71
71
|
Rda.configure { nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf'] }
|
72
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash: -
|
226
|
+
hash: -4472563242875410737
|
227
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
228
|
none: false
|
229
229
|
requirements:
|
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
version: '0'
|
233
233
|
segments:
|
234
234
|
- 0
|
235
|
-
hash: -
|
235
|
+
hash: -4472563242875410737
|
236
236
|
requirements: []
|
237
237
|
rubyforge_project:
|
238
238
|
rubygems_version: 1.8.24
|