rda 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -15,17 +15,3 @@ gem 'jquery-rails'
15
15
 
16
16
  # To use debugger
17
17
  # gem 'ruby-debug19', :require => 'ruby-debug'
18
-
19
- group :test do
20
- gem 'pry'
21
- gem 'rspec'
22
- gem 'guard'
23
- gem 'guard-bundler'
24
- gem 'guard-rspec'
25
- gem 'fivemat'
26
- if RUBY_PLATFORM =~ /darwin/
27
- gem 'ruby_gntp'
28
- elsif RUBY_PLATFORM =~ /linux/
29
- gem 'libnotify'
30
- end
31
- end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rda (0.0.6)
4
+ rda (0.1.0)
5
5
  confstruct
6
6
  rails (>= 3.1)
7
7
  thor
@@ -59,8 +59,6 @@ GEM
59
59
  railties (>= 3.2.0, < 5.0)
60
60
  thor (~> 0.14)
61
61
  json (1.7.3)
62
- libnotify (0.7.4)
63
- ffi (~> 1.0.11)
64
62
  listen (0.4.7)
65
63
  rb-fchange (~> 0.0.5)
66
64
  rb-fsevent (~> 0.9.1)
@@ -115,6 +113,7 @@ GEM
115
113
  rspec-expectations (2.10.0)
116
114
  diff-lcs (~> 1.1.3)
117
115
  rspec-mocks (2.10.1)
116
+ ruby_gntp (0.3.4)
118
117
  slop (2.4.4)
119
118
  sprockets (2.1.3)
120
119
  hike (~> 1.2)
@@ -131,12 +130,12 @@ PLATFORMS
131
130
  ruby
132
131
 
133
132
  DEPENDENCIES
134
- fivemat
135
- guard
136
- guard-bundler
137
- guard-rspec
133
+ fivemat (~> 1.0)
134
+ guard (~> 1.2)
135
+ guard-bundler (~> 1.0)
136
+ guard-rspec (~> 1.1)
138
137
  jquery-rails
139
- libnotify
140
- pry
138
+ pry (~> 0.9.9)
141
139
  rda!
142
- rspec
140
+ rspec (~> 2.10)
141
+ ruby_gntp (~> 0.3)
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  ### Description
4
4
 
5
- Rda(Rails Development Assist) is combined with lots of useful rake tasks which can help you to setup your development enviroments and tools more quickly.
5
+ Rda(Rails Development Assist) is combined with lots of useful rake tasks which can help you to setup your development enviroments and tools more quickly. It is also provide a CLI to set up the enviroments.
6
6
 
7
7
  ### Features
8
8
 
9
- * Setup RVM for your rails application
9
+ * Set up RVM for your rails application
10
10
  * Deploy your rails application to Nginx (rails_env is set to development by default)
11
- * Release your rails application
11
+ * Release your rails application (not yet)
12
12
 
13
13
  ### Usage
14
14
 
@@ -37,9 +37,12 @@ if Rails.env == 'development'
37
37
  end
38
38
  ```
39
39
 
40
- #### Setup RVM
40
+ #### Set up RVM
41
41
 
42
42
  ```bash
43
+ rda rvm setup
44
+
45
+ # Or
43
46
  rake rda:rvm:setup
44
47
  ```
45
48
 
@@ -53,7 +56,7 @@ else
53
56
  fi
54
57
  ```
55
58
 
56
- After RVM setup, you need to trust the rvmrc by:
59
+ After setting up RVM, you need to trust the rvmrc by:
57
60
 
58
61
  ```bash
59
62
  rvm rvmrc trust
@@ -61,11 +64,14 @@ rvm rvmrc trust
61
64
 
62
65
  Or you can set `rvm_trust_rvmrcs_flag=1` in ~/.rvmrc or /etc/rvmrc.
63
66
 
64
- If RVM is not installed this task will do nothing but exit.
67
+ If RVM is not installed, this task will do nothing but exit.
65
68
 
66
69
  #### Discard RVM settings
67
70
 
68
71
  ```bash
72
+ rda rvm:discard
73
+
74
+ # Or
69
75
  rake rda:rvm:discard
70
76
  ```
71
77
 
@@ -74,10 +80,13 @@ This task removes the .rvmrc from your rails application.
74
80
  #### Setup Nginx
75
81
 
76
82
  ```bash
83
+ rda nginx setup
84
+
85
+ # Or
77
86
  rake rda:nginx:setup
78
87
  ```
79
88
 
80
- First this task will try to find the config files of Nginx which you have installed from the following paths:
89
+ First this task will try to find the config files of Nginx, which you have installed, from the following paths:
81
90
 
82
91
  * /etc/nginx
83
92
  * /usr/local/nginx/conf
@@ -92,6 +101,9 @@ Rda.configure { nginx_conf_paths ['/path/to/nginx/conf'] }
92
101
  Please make sure that you have the write permission of the directory you choosed, or you can run:
93
102
 
94
103
  ```bash
104
+ rvmsudo rda nginx setup
105
+
106
+ # Or
95
107
  rvmsudo rake rda:nginx:setup
96
108
  ```
97
109
 
@@ -108,10 +120,16 @@ Finally, You need to start Nginx `/path/to/nginx/sbin/nginx` and then visit http
108
120
  #### Discard Nginx settings
109
121
 
110
122
  ```bash
123
+ rda nginx discard # Or
124
+
111
125
  rake rda:nginx:discard # Or
112
126
 
127
+ sudo rda nginx discard # Or
128
+
113
129
  sudo rake rda:nginx:discard # Or
114
130
 
131
+ rvmsudo rda nginx discard # Using RVM
132
+
115
133
  rvmsudo rake rda:nginx:discard # Using RVM
116
134
  ```
117
135
 
@@ -120,14 +138,20 @@ This task will clean up all the things created or configured by rda:nginx:setup.
120
138
  #### Restart application
121
139
 
122
140
  ```bash
141
+ rda app restart
142
+
143
+ # Or
123
144
  rake rda:app:restart
124
145
  ```
125
146
 
126
- This task touches tmp/restart.txt to restart your rails application, For detail, please visit "http://bit.ly/ztKA07":http://bit.ly/ztKA07
147
+ This task touches tmp/restart.txt to restart your rails application, For detail, please visit [http://bit.ly/ztKA07](http://bit.ly/ztKA07)
127
148
 
128
149
  #### Release your rails application(not yet)
129
150
 
130
151
  ```bash
152
+ rda app release
153
+
154
+ # Or
131
155
  rake rda:app:release
132
156
  ```
133
157
 
data/bin/rda ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'rda'
5
+
6
+ begin
7
+ require File.expand_path("#{Dir.pwd}/config/application", __FILE__)
8
+ rescue LoadError
9
+ $stderr.puts "ERROR: You should run rda under rails applications"
10
+ end
11
+
12
+ class RdaCommand < Thor
13
+ desc 'rvm ACTION', 'Set up RVM. Available actions: setup, discard.'
14
+ def rvm(action)
15
+ Rda::Rvm.new.send(action.to_sym)
16
+ end
17
+
18
+ desc 'nginx ACTION', 'Manage settings of nginx. Available actions: setup, discard.'
19
+ def nginx(action)
20
+ Rda::Nginx.new.send(action.to_sym)
21
+ end
22
+
23
+ desc 'app ACTION', 'Manage the lifecycle of the application. Available actions: restart.'
24
+ def app(action)
25
+ Rda::App.new.send(action.to_sym)
26
+ end
27
+ end
28
+
29
+ RdaCommand.start
data/lib/rda/nginx.rb CHANGED
@@ -2,13 +2,11 @@ module Rda
2
2
  class Nginx < Thor
3
3
  include Thor::Actions
4
4
 
5
- DEFAULT_CONF_PATHS = ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf']
6
-
7
5
  def self.source_root
8
6
  File.dirname(__FILE__)
9
7
  end
10
8
 
11
- desc "Setup", "Deploy rails application to Nginx"
9
+ desc "setup", "Set up your rails application"
12
10
  def setup
13
11
  return unless installed?
14
12
 
@@ -25,7 +23,7 @@ module Rda
25
23
  end
26
24
  end
27
25
 
28
- desc "Discard", "Remove the Nginx setting of rails application"
26
+ desc "discard", "Remove the settings of your rails application from nginx"
29
27
  def discard
30
28
  return unless installed?
31
29
 
@@ -68,7 +66,6 @@ module Rda
68
66
 
69
67
  def available_paths
70
68
  search_paths = Rda.config.nginx_conf_paths || []
71
- search_paths = DEFAULT_CONF_PATHS if search_paths.empty?
72
69
  @paths ||= search_paths.select { |p| Dir.exists? p if p } unless search_paths.empty?
73
70
  end
74
71
 
data/lib/rda/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rda
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/rda.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rails'
2
2
  require 'thor'
3
3
  require 'confstruct'
4
+ require 'confstruct/configuration'
4
5
 
5
6
  require 'rda/railtie'
6
7
  require 'rda/rails'
@@ -2,12 +2,12 @@ namespace :rda do
2
2
  namespace :rvm do
3
3
  rvm = Rda::Rvm.new
4
4
 
5
- desc "Setup RVM for rails application"
5
+ desc "Set up RVM for your rails application"
6
6
  task :setup do
7
7
  rvm.setup
8
8
  end
9
9
 
10
- desc "Discard RVM settings of rails application"
10
+ desc "Discard RVM settings of your rails application"
11
11
  task :discard do
12
12
  rvm.discard
13
13
  end
@@ -16,12 +16,12 @@ namespace :rda do
16
16
  namespace :nginx do
17
17
  nginx = Rda::Nginx.new
18
18
 
19
- desc "Setup Nginx for rails application"
19
+ desc "Set up Nginx for your rails application"
20
20
  task :setup => :environment do
21
21
  nginx.setup
22
22
  end
23
23
 
24
- desc "Discard Nginx settings of rails application"
24
+ desc "Discard Nginx settings of your rails application"
25
25
  task :discard => :environment do
26
26
  nginx.discard
27
27
  end
@@ -30,7 +30,7 @@ namespace :rda do
30
30
  namespace :app do
31
31
  app = Rda::App.new
32
32
 
33
- desc "Restart rails application"
33
+ desc "Restart your rails application"
34
34
  task :restart do
35
35
  app.restart
36
36
  end
data/rda.gemspec CHANGED
@@ -13,9 +13,20 @@ Gem::Specification.new do |s|
13
13
  s.summary = 'Rails Development Assist'
14
14
  s.description = 'Rda(Rails Development Assist) is combined with lots of useful rake tasks which can help you to setup your development enviroments and tools more quickly.'
15
15
 
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
18
- s.require_paths = ['lib']
19
+ s.require_paths = ['lib']
20
+
21
+ s.add_development_dependency 'pry', '~> 0.9.9'
22
+ s.add_development_dependency 'rspec', '~> 2.10'
23
+ s.add_development_dependency 'guard', '~> 1.2'
24
+ s.add_development_dependency 'guard-bundler', '~> 1.0'
25
+ s.add_development_dependency 'guard-rspec', '~> 1.1'
26
+ s.add_development_dependency 'fivemat', '~> 1.0'
27
+ if RUBY_PLATFORM =~ /darwin/
28
+ s.add_development_dependency 'ruby_gntp', '~> 0.3'
29
+ end
19
30
 
20
31
  s.add_dependency 'rails', '>= 3.1'
21
32
  s.add_dependency 'thor'
@@ -4,7 +4,7 @@ describe Rda::Nginx do
4
4
  subject { Rda::Nginx.new }
5
5
 
6
6
  before do
7
- Rda.configure { nginx_conf_paths Rda::Nginx::DEFAULT_CONF_PATHS }
7
+ Rda.configure { nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf'] }
8
8
  end
9
9
 
10
10
  describe '#setup' do
@@ -66,7 +66,7 @@ Found more than one config directory of Nginx, please choose one to setup:
66
66
  conf = Rda.config.nginx_conf_paths.first
67
67
  FileUtils.rm_r conf if Dir.exists?(conf)
68
68
 
69
- Rda.configure { nginx_conf_paths [Rda::Nginx::DEFAULT_CONF_PATHS] }
69
+ Rda.configure { nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf'] }
70
70
  end
71
71
 
72
72
  it 'discards the settings' do
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.6
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,120 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-02 00:00:00.000000000 Z
12
+ date: 2012-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pry
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.9
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.9
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2.10'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.10'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.2'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard-rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '1.1'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '1.1'
94
+ - !ruby/object:Gem::Dependency
95
+ name: fivemat
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '1.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: ruby_gntp
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '0.3'
14
126
  - !ruby/object:Gem::Dependency
15
127
  name: rails
16
128
  requirement: !ruby/object:Gem::Requirement
@@ -63,7 +175,8 @@ description: Rda(Rails Development Assist) is combined with lots of useful rake
63
175
  which can help you to setup your development enviroments and tools more quickly.
64
176
  email:
65
177
  - towerhe@gmail.com
66
- executables: []
178
+ executables:
179
+ - rda
67
180
  extensions: []
68
181
  extra_rdoc_files: []
69
182
  files:
@@ -76,6 +189,7 @@ files:
76
189
  - MIT-LICENSE
77
190
  - README.md
78
191
  - Rakefile
192
+ - bin/rda
79
193
  - lib/rda.rb
80
194
  - lib/rda/app.rb
81
195
  - lib/rda/nginx.rb
@@ -141,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
255
  version: '0'
142
256
  segments:
143
257
  - 0
144
- hash: 93405623145392106
258
+ hash: 1257555642380015887
145
259
  required_rubygems_version: !ruby/object:Gem::Requirement
146
260
  none: false
147
261
  requirements:
@@ -150,11 +264,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
264
  version: '0'
151
265
  segments:
152
266
  - 0
153
- hash: 93405623145392106
267
+ hash: 1257555642380015887
154
268
  requirements: []
155
269
  rubyforge_project:
156
270
  rubygems_version: 1.8.24
157
271
  signing_key:
158
272
  specification_version: 3
159
273
  summary: Rails Development Assist
160
- test_files: []
274
+ test_files:
275
+ - spec/dummy/Rakefile
276
+ - spec/dummy/app/assets/javascripts/application.js
277
+ - spec/dummy/app/assets/stylesheets/application.css
278
+ - spec/dummy/app/controllers/application_controller.rb
279
+ - spec/dummy/app/helpers/application_helper.rb
280
+ - spec/dummy/app/mailers/.gitkeep
281
+ - spec/dummy/app/models/.gitkeep
282
+ - spec/dummy/app/views/layouts/application.html.erb
283
+ - spec/dummy/config.ru
284
+ - spec/dummy/config/application.rb
285
+ - spec/dummy/config/boot.rb
286
+ - spec/dummy/config/environment.rb
287
+ - spec/dummy/config/environments/development.rb
288
+ - spec/dummy/config/environments/production.rb
289
+ - spec/dummy/config/environments/test.rb
290
+ - spec/dummy/config/initializers/backtrace_silencers.rb
291
+ - spec/dummy/config/initializers/inflections.rb
292
+ - spec/dummy/config/initializers/mime_types.rb
293
+ - spec/dummy/config/initializers/rda.rb
294
+ - spec/dummy/config/initializers/secret_token.rb
295
+ - spec/dummy/config/initializers/session_store.rb
296
+ - spec/dummy/config/initializers/wrap_parameters.rb
297
+ - spec/dummy/config/locales/en.yml
298
+ - spec/dummy/config/routes.rb
299
+ - spec/dummy/lib/assets/.gitkeep
300
+ - spec/dummy/log/.gitkeep
301
+ - spec/dummy/public/404.html
302
+ - spec/dummy/public/422.html
303
+ - spec/dummy/public/500.html
304
+ - spec/dummy/public/favicon.ico
305
+ - spec/dummy/script/rails
306
+ - spec/fixtures/nginx.conf
307
+ - spec/lib/rda/app_spec.rb
308
+ - spec/lib/rda/nginx_spec.rb
309
+ - spec/lib/rda/rails_spec.rb
310
+ - spec/lib/rda/rvm_spec.rb
311
+ - spec/lib/rda_spec.rb
312
+ - spec/spec_helper.rb