rda 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Gemfile.lock +1 -1
- data/README.textile +4 -2
- data/lib/rda/nginx.rb +18 -2
- data/lib/rda/templates/rvmrc +2 -2
- data/lib/rda/templates/setup_load_paths.rb +28 -0
- data/lib/rda/version.rb +1 -1
- data/spec/lib/rda/nginx_spec.rb +13 -1
- data/spec/lib/rda/rvm_spec.rb +2 -2
- metadata +24 -22
data/CHANGELOG
ADDED
data/Gemfile.lock
CHANGED
data/README.textile
CHANGED
@@ -22,7 +22,7 @@ Or simply add rda to the Gemfile
|
|
22
22
|
|
23
23
|
h3. Configuration
|
24
24
|
|
25
|
-
For configuring rda, you
|
25
|
+
For configuring rda, you need to create an initializer for rda:
|
26
26
|
|
27
27
|
<pre>
|
28
28
|
<code>
|
@@ -88,6 +88,7 @@ Next it will set Nginx to include the configs under sites-enabled. It means that
|
|
88
88
|
|
89
89
|
h3. Discard Nginx settings
|
90
90
|
|
91
|
+
<pre>
|
91
92
|
<code>
|
92
93
|
rake rda:nginx:discard # Or
|
93
94
|
|
@@ -95,6 +96,7 @@ sudo rake rda:nginx:discard # Or
|
|
95
96
|
|
96
97
|
rvmsudo rake rda:nginx:discard # Using RVM
|
97
98
|
</code>
|
99
|
+
</pre>
|
98
100
|
|
99
101
|
This task will clean up all the things created or configured by rda:nginx:setup.
|
100
102
|
|
@@ -102,7 +104,7 @@ h3. Restart application
|
|
102
104
|
|
103
105
|
<code> rake rda:app:restart</code>
|
104
106
|
|
105
|
-
This task touches tmp/restart.txt to restart your rails application, For detail, please visit http://
|
107
|
+
This task touches tmp/restart.txt to restart your rails application, For detail, please visit "http://bit.ly/ztKA07":http://bit.ly/ztKA07
|
106
108
|
|
107
109
|
h3. Release your rails application(not yet)
|
108
110
|
|
data/lib/rda/nginx.rb
CHANGED
@@ -12,7 +12,9 @@ module Rda
|
|
12
12
|
def setup
|
13
13
|
return unless installed?
|
14
14
|
|
15
|
+
create_setup_load_paths
|
15
16
|
mkdir_for_sites
|
17
|
+
set_passenger_user_and_group
|
16
18
|
include_sites_enabled
|
17
19
|
|
18
20
|
template("templates/nginx", "#{conf_path}/sites-available/#{hostname}")
|
@@ -26,10 +28,11 @@ module Rda
|
|
26
28
|
return unless installed?
|
27
29
|
|
28
30
|
%W(enabled available).each do |n|
|
29
|
-
remove_file
|
31
|
+
remove_file "#{conf_path}/sites-#{n}/#{hostname}"
|
30
32
|
end
|
31
33
|
|
32
34
|
gsub_file("/etc/hosts", "#{hostname} 127.0.0.1", '')
|
35
|
+
remove_file "#{::Rails.root}/config/setup_load_paths.rb"
|
33
36
|
end
|
34
37
|
|
35
38
|
private
|
@@ -83,6 +86,10 @@ module Rda
|
|
83
86
|
index >= 0 && index < available_paths.size ? available_paths[index] : exit
|
84
87
|
end
|
85
88
|
|
89
|
+
def create_setup_load_paths
|
90
|
+
copy_file "templates/setup_load_paths.rb", "#{::Rails.root}/config/setup_load_paths.rb"
|
91
|
+
end
|
92
|
+
|
86
93
|
def mkdir_for_sites
|
87
94
|
%W(available enabled).each do |n|
|
88
95
|
dir = conf_path + "/sites-#{n}"
|
@@ -90,11 +97,20 @@ module Rda
|
|
90
97
|
end
|
91
98
|
end
|
92
99
|
|
100
|
+
def set_passenger_user_and_group
|
101
|
+
conf = conf_path + '/nginx.conf'
|
102
|
+
gsub_file conf, /http {/, <<-PASSENGER
|
103
|
+
http {
|
104
|
+
passenger_default_user root;
|
105
|
+
passenger_default_group root;
|
106
|
+
PASSENGER
|
107
|
+
end
|
108
|
+
|
93
109
|
def include_sites_enabled
|
94
110
|
conf = conf_path + '/nginx.conf'
|
95
111
|
gsub_file conf, /http {/, <<-INCLUDE_SITES_ENABLED
|
96
112
|
http {
|
97
|
-
|
113
|
+
include #{conf_path}/sites-enabled/*;
|
98
114
|
INCLUDE_SITES_ENABLED
|
99
115
|
end
|
100
116
|
end
|
data/lib/rda/templates/rvmrc
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
|
2
|
+
begin
|
3
|
+
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
|
4
|
+
rvm_lib_path = File.join(rvm_path, 'lib')
|
5
|
+
$LOAD_PATH.unshift rvm_lib_path
|
6
|
+
require 'rvm'
|
7
|
+
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
|
8
|
+
rescue LoadError
|
9
|
+
# RVM is unavailable at this point.
|
10
|
+
raise "RVM ruby lib is currently unavailable."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Pick the lines for your version of Bundler
|
15
|
+
# If you're not using Bundler at all, remove all of them
|
16
|
+
|
17
|
+
# Require Bundler 1.0
|
18
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
|
19
|
+
require 'bundler/setup'
|
20
|
+
|
21
|
+
# Require Bundler 0/9
|
22
|
+
# if File.exist?(".bundle/environment.rb")
|
23
|
+
# require '.bundle/environment'
|
24
|
+
# else
|
25
|
+
# require 'rubygems'
|
26
|
+
# require 'bundler'
|
27
|
+
# Bundler.setup
|
28
|
+
# end
|
data/lib/rda/version.rb
CHANGED
data/spec/lib/rda/nginx_spec.rb
CHANGED
@@ -67,16 +67,27 @@ Found more than one config directory of Nginx, please choose one to setup:
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'sets Nginx properly' do
|
70
|
+
# loads RVM
|
71
|
+
subject.should_receive(:copy_file).with("templates/setup_load_paths.rb", "#{::Rails.root}/config/setup_load_paths.rb")
|
72
|
+
|
70
73
|
# creates sites-available and sites-enabled
|
71
74
|
%W(available enabled).each do |n|
|
72
75
|
path = "#{dummy_path}/sites-#{n}"
|
73
76
|
subject.should_receive(:empty_directory).with(path)
|
74
77
|
end
|
75
78
|
|
79
|
+
# sets default passenger user and group
|
80
|
+
subject.should_receive(:gsub_file).with("#{dummy_path}/nginx.conf", /http {/, <<-PASSENGER
|
81
|
+
http {
|
82
|
+
passenger_default_user root;
|
83
|
+
passenger_default_group root;
|
84
|
+
PASSENGER
|
85
|
+
)
|
86
|
+
|
76
87
|
# sets Nginx to include sites-enabled
|
77
88
|
subject.should_receive(:gsub_file).with("#{dummy_path}/nginx.conf", /http {/, <<-INCLUSION
|
78
89
|
http {
|
79
|
-
|
90
|
+
include #{dummy_path}/sites-enabled/*;
|
80
91
|
INCLUSION
|
81
92
|
)
|
82
93
|
|
@@ -117,6 +128,7 @@ http {
|
|
117
128
|
%W(enabled available).each do |n|
|
118
129
|
subject.should_receive(:remove_file).with("#{dummy_path}/sites-#{n}/dummy.local")
|
119
130
|
end
|
131
|
+
subject.should_receive(:remove_file).with("#{::Rails.root}/config/setup_load_paths.rb")
|
120
132
|
|
121
133
|
subject.discard
|
122
134
|
end
|
data/spec/lib/rda/rvm_spec.rb
CHANGED
@@ -28,9 +28,9 @@ describe Rda::Rvm do
|
|
28
28
|
it "configs RVM properly" do
|
29
29
|
contents = <<-RVMRC
|
30
30
|
if [[ -s "#{ENV['rvm_path']}/environments/ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@dummy" ]]; then
|
31
|
-
. "#{ENV['rvm_path']}/environments/ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@dummy
|
31
|
+
. "#{ENV['rvm_path']}/environments/ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@dummy"
|
32
32
|
else
|
33
|
-
rvm use ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@dummy
|
33
|
+
rvm --create use "ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@dummy"
|
34
34
|
fi
|
35
35
|
RVMRC
|
36
36
|
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70189996170600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70189996170600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70189996169780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70189996169780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: confstruct
|
38
|
-
requirement: &
|
38
|
+
requirement: &70189996169060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70189996169060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: pry
|
49
|
-
requirement: &
|
49
|
+
requirement: &70189996168260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70189996168260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70189996167300 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70189996167300
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard
|
71
|
-
requirement: &
|
71
|
+
requirement: &70189996166320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70189996166320
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-bundler
|
82
|
-
requirement: &
|
82
|
+
requirement: &70189996165520 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70189996165520
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: guard-rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &70189996127620 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70189996127620
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: ruby_gntp
|
104
|
-
requirement: &
|
104
|
+
requirement: &70189996126560 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70189996126560
|
113
113
|
description: Rda(Rails Development Assist) is combined with lots of useful rake tasks
|
114
114
|
which can help you to setup your development enviroments and tools more quickly.
|
115
115
|
email:
|
@@ -120,6 +120,7 @@ extra_rdoc_files: []
|
|
120
120
|
files:
|
121
121
|
- .gitignore
|
122
122
|
- .rspec
|
123
|
+
- CHANGELOG
|
123
124
|
- Gemfile
|
124
125
|
- Gemfile.lock
|
125
126
|
- Guardfile
|
@@ -134,6 +135,7 @@ files:
|
|
134
135
|
- lib/rda/rvm.rb
|
135
136
|
- lib/rda/templates/nginx
|
136
137
|
- lib/rda/templates/rvmrc
|
138
|
+
- lib/rda/templates/setup_load_paths.rb
|
137
139
|
- lib/rda/version.rb
|
138
140
|
- lib/tasks/rda_tasks.rake
|
139
141
|
- rda.gemspec
|
@@ -190,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
192
|
version: '0'
|
191
193
|
segments:
|
192
194
|
- 0
|
193
|
-
hash: -
|
195
|
+
hash: -2455843952260711673
|
194
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
197
|
none: false
|
196
198
|
requirements:
|
@@ -199,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
201
|
version: '0'
|
200
202
|
segments:
|
201
203
|
- 0
|
202
|
-
hash: -
|
204
|
+
hash: -2455843952260711673
|
203
205
|
requirements: []
|
204
206
|
rubyforge_project:
|
205
207
|
rubygems_version: 1.8.10
|