rda 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.gitignore +9 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +17 -0
  4. data/Gemfile.lock +137 -0
  5. data/Guardfile +12 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.textile +113 -0
  8. data/Rakefile +26 -0
  9. data/lib/rda/app.rb +11 -0
  10. data/lib/rda/nginx.rb +101 -0
  11. data/lib/rda/rails.rb +7 -0
  12. data/lib/rda/railtie.rb +9 -0
  13. data/lib/rda/rvm.rb +48 -0
  14. data/lib/rda/templates/nginx +6 -0
  15. data/lib/rda/templates/rvmrc +5 -0
  16. data/lib/rda/version.rb +3 -0
  17. data/lib/rda.rb +23 -0
  18. data/lib/tasks/rda_tasks.rake +38 -0
  19. data/rda.gemspec +34 -0
  20. data/rvmrc.example +1 -0
  21. data/spec/dummy/Rakefile +7 -0
  22. data/spec/dummy/app/assets/javascripts/application.js +7 -0
  23. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  24. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/mailers/.gitkeep +0 -0
  27. data/spec/dummy/app/models/.gitkeep +0 -0
  28. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/spec/dummy/config/application.rb +51 -0
  30. data/spec/dummy/config/boot.rb +10 -0
  31. data/spec/dummy/config/environment.rb +5 -0
  32. data/spec/dummy/config/environments/development.rb +30 -0
  33. data/spec/dummy/config/environments/production.rb +60 -0
  34. data/spec/dummy/config/environments/test.rb +39 -0
  35. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/spec/dummy/config/initializers/inflections.rb +10 -0
  37. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  38. data/spec/dummy/config/initializers/rda.rb +3 -0
  39. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  40. data/spec/dummy/config/initializers/session_store.rb +8 -0
  41. data/spec/dummy/config/initializers/wrap_parameters.rb +10 -0
  42. data/spec/dummy/config/locales/en.yml +5 -0
  43. data/spec/dummy/config/routes.rb +58 -0
  44. data/spec/dummy/config.ru +4 -0
  45. data/spec/dummy/lib/assets/.gitkeep +0 -0
  46. data/spec/dummy/log/.gitkeep +0 -0
  47. data/spec/dummy/public/404.html +26 -0
  48. data/spec/dummy/public/422.html +26 -0
  49. data/spec/dummy/public/500.html +26 -0
  50. data/spec/dummy/public/favicon.ico +0 -0
  51. data/spec/dummy/script/rails +6 -0
  52. data/spec/fixtures/nginx.conf +2 -0
  53. data/spec/lib/rda/app_spec.rb +13 -0
  54. data/spec/lib/rda/nginx_spec.rb +124 -0
  55. data/spec/lib/rda/rails_spec.rb +7 -0
  56. data/spec/lib/rda/rvm_spec.rb +55 -0
  57. data/spec/lib/rda_spec.rb +20 -0
  58. data/spec/spec_helper.rb +30 -0
  59. metadata +247 -0
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .bundle/
2
+ .rvmrc
3
+ .DS_Store
4
+ log/*.log
5
+ pkg/
6
+ spec/dummy/db/*.sqlite3
7
+ spec/dummy/log/*.log
8
+ spec/dummy/tmp/
9
+ spec/tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in rda.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'ruby-debug19', :require => 'ruby-debug'
data/Gemfile.lock ADDED
@@ -0,0 +1,137 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rda (0.0.1)
5
+ confstruct
6
+ rails (~> 3.1.3)
7
+ thor
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.1.3)
13
+ actionpack (= 3.1.3)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.3)
16
+ activemodel (= 3.1.3)
17
+ activesupport (= 3.1.3)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.5)
22
+ rack-cache (~> 1.1)
23
+ rack-mount (~> 0.8.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.0.3)
26
+ activemodel (3.1.3)
27
+ activesupport (= 3.1.3)
28
+ builder (~> 3.0.0)
29
+ i18n (~> 0.6)
30
+ activerecord (3.1.3)
31
+ activemodel (= 3.1.3)
32
+ activesupport (= 3.1.3)
33
+ arel (~> 2.2.1)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.1.3)
36
+ activemodel (= 3.1.3)
37
+ activesupport (= 3.1.3)
38
+ activesupport (3.1.3)
39
+ multi_json (~> 1.0)
40
+ arel (2.2.1)
41
+ builder (3.0.0)
42
+ coderay (0.9.8)
43
+ confstruct (0.2.0)
44
+ diff-lcs (1.1.3)
45
+ erubis (2.7.0)
46
+ ffi (1.0.11)
47
+ guard (0.10.0)
48
+ ffi (>= 0.5.0)
49
+ thor (~> 0.14.6)
50
+ guard-bundler (0.1.3)
51
+ bundler (>= 1.0.0)
52
+ guard (>= 0.2.2)
53
+ guard-rspec (0.6.0)
54
+ guard (>= 0.10.0)
55
+ hike (1.2.1)
56
+ i18n (0.6.0)
57
+ jquery-rails (1.0.19)
58
+ railties (~> 3.0)
59
+ thor (~> 0.14)
60
+ json (1.6.5)
61
+ mail (2.3.0)
62
+ i18n (>= 0.4.0)
63
+ mime-types (~> 1.16)
64
+ treetop (~> 1.4.8)
65
+ method_source (0.6.7)
66
+ ruby_parser (>= 2.3.1)
67
+ mime-types (1.17.2)
68
+ multi_json (1.0.4)
69
+ polyglot (0.3.3)
70
+ pry (0.9.7.4)
71
+ coderay (~> 0.9.8)
72
+ method_source (~> 0.6.7)
73
+ ruby_parser (>= 2.3.1)
74
+ slop (~> 2.1.0)
75
+ rack (1.3.6)
76
+ rack-cache (1.1)
77
+ rack (>= 0.4)
78
+ rack-mount (0.8.3)
79
+ rack (>= 1.0.0)
80
+ rack-ssl (1.3.2)
81
+ rack
82
+ rack-test (0.6.1)
83
+ rack (>= 1.0)
84
+ rails (3.1.3)
85
+ actionmailer (= 3.1.3)
86
+ actionpack (= 3.1.3)
87
+ activerecord (= 3.1.3)
88
+ activeresource (= 3.1.3)
89
+ activesupport (= 3.1.3)
90
+ bundler (~> 1.0)
91
+ railties (= 3.1.3)
92
+ railties (3.1.3)
93
+ actionpack (= 3.1.3)
94
+ activesupport (= 3.1.3)
95
+ rack-ssl (~> 1.3.2)
96
+ rake (>= 0.8.7)
97
+ rdoc (~> 3.4)
98
+ thor (~> 0.14.6)
99
+ rake (0.9.2.2)
100
+ rdoc (3.12)
101
+ json (~> 1.4)
102
+ rspec (2.8.0)
103
+ rspec-core (~> 2.8.0)
104
+ rspec-expectations (~> 2.8.0)
105
+ rspec-mocks (~> 2.8.0)
106
+ rspec-core (2.8.0)
107
+ rspec-expectations (2.8.0)
108
+ diff-lcs (~> 1.1.2)
109
+ rspec-mocks (2.8.0)
110
+ ruby_gntp (0.3.4)
111
+ ruby_parser (2.3.1)
112
+ sexp_processor (~> 3.0)
113
+ sexp_processor (3.0.10)
114
+ slop (2.1.0)
115
+ sprockets (2.0.3)
116
+ hike (~> 1.2)
117
+ rack (~> 1.0)
118
+ tilt (~> 1.1, != 1.3.0)
119
+ thor (0.14.6)
120
+ tilt (1.3.3)
121
+ treetop (1.4.10)
122
+ polyglot
123
+ polyglot (>= 0.3.1)
124
+ tzinfo (0.3.31)
125
+
126
+ PLATFORMS
127
+ ruby
128
+
129
+ DEPENDENCIES
130
+ guard
131
+ guard-bundler
132
+ guard-rspec
133
+ jquery-rails
134
+ pry
135
+ rda!
136
+ rspec
137
+ ruby_gntp
data/Guardfile ADDED
@@ -0,0 +1,12 @@
1
+ group "backend" do
2
+ guard :bundler do
3
+ watch('Gemfile')
4
+ end
5
+
6
+ guard :rspec, version: 2, cli: '--color --format doc' do
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^spec/.+\.rb$}) { `say hello` }
9
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
10
+ watch('spec/spec_helper.rb') { "spec" }
11
+ end
12
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,113 @@
1
+ h1. Rda
2
+
3
+ h2. Description
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.
6
+
7
+ h2. Features
8
+
9
+ * Setup RVM for your rails application
10
+ * Deploy your rails application to Nginx (rails_env is set to development by default)
11
+ * Release your rails application
12
+
13
+ h2. Usage
14
+
15
+ h3. Installation
16
+
17
+ <code>gem install rda</code>
18
+
19
+ Or simply add rda to the Gemfile
20
+
21
+ <code>gem 'rda'</code>
22
+
23
+ h3. Configuration
24
+
25
+ For configuring rda, you should create an initialize for rda:
26
+
27
+ <pre>
28
+ <code>
29
+ # config/initializers/rda.rb
30
+ Rda.configure do
31
+ nginx_conf_paths ['/etc/nginx', '/opt/nginx/conf', '/usr/local/nginx/conf']
32
+ end
33
+ </code>
34
+ </pre>
35
+
36
+ h3. Setup RVM
37
+
38
+ <code>rake rda:rvm:setup</code>
39
+
40
+ First of all, this task 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:
41
+
42
+ <pre>
43
+ <code>
44
+ if [[ -s "/path/to/rvm/environments/ruby-1.9.3-p0@app_name" ]]; then
45
+ . "/path/to/rvm/environments/ruby-1.9.3-p0@app_name"
46
+ else
47
+ rvm use ruby-1.9.3-p0@app_name --create
48
+ fi
49
+ </code>
50
+ </pre>
51
+
52
+ If RVM is not installed this task will do nothing but exit.
53
+
54
+ h3. Discard RVM settings
55
+
56
+ <code>rake rda:rvm:discard</code>
57
+
58
+ This task removes the .rvmrc from your rails application.
59
+
60
+ h3. Setup Nginx
61
+
62
+ <code>rake rda:nginx:setup</code>
63
+
64
+ First this task will try to find the config files of Nginx which you have installed from the following paths:
65
+
66
+ * /etc/nginx
67
+ * /usr/local/nginx/conf
68
+ * /opt/nginx/conf
69
+
70
+ You can change the default searching paths by:
71
+
72
+ <pre>
73
+ <code>
74
+ Rda.configure { nginx_conf_paths ['/path/to/nginx/conf'] }
75
+ </code>
76
+ </pre>
77
+
78
+ Please make sure that you have the write permission of the directory you choosed, or you can run:
79
+
80
+ <code>sudo rake rda:nginx:setup</code>
81
+
82
+ If there are more than one paths found, it will give you a choice to decide which one will be used. After choosing a proper path, it will try to create two directories sites-available and sites-enabled to save the configs of rails applications.
83
+
84
+ * sites-available saves the configs of the rails applications.
85
+ * sites-enabled saves the link to the rails applications.
86
+
87
+ Next it will set Nginx to include the configs under sites-enabled. It means that only the applications under sites-enabled will be loaded. And than 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.
88
+
89
+ h3. Discard Nginx settings
90
+
91
+ <code>
92
+ rake rda:nginx:discard # Or
93
+
94
+ sudo rake rda:nginx:discard # Or
95
+
96
+ rvmsudo rake rda:nginx:discard # Using RVM
97
+ </code>
98
+
99
+ This task will clean up all the things created or configured by rda:nginx:setup.
100
+
101
+ h3. Restart application
102
+
103
+ <code> rake rda:app:restart</code>
104
+
105
+ This task touches tmp/restart.txt to restart your rails application, For detail, please visit http://modrails.com/documentation/Users%20guide%20Nginx.html#_redeploying_restarting_the_ruby_on_rails_application
106
+
107
+ h3. Release your rails application(not yet)
108
+
109
+ <code> rake rda:app:release</code>
110
+
111
+ h2. License
112
+
113
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Rda'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
data/lib/rda/app.rb ADDED
@@ -0,0 +1,11 @@
1
+ module Rda
2
+ class App < Thor
3
+ desc "Restart", "Restart rails application"
4
+ def restart
5
+ tmp_path = ::Rails.root.to_s + "/tmp"
6
+ FileUtils.mkdir_p tmp_path unless Dir.exists?(tmp_path)
7
+
8
+ FileUtils.touch tmp_path + "/restart.txt"
9
+ end
10
+ end
11
+ end
data/lib/rda/nginx.rb ADDED
@@ -0,0 +1,101 @@
1
+ module Rda
2
+ class Nginx < Thor
3
+ include Thor::Actions
4
+
5
+ DEFAULT_CONF_PATHS = ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf']
6
+
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ desc "Setup", "Deploy rails application to Nginx"
12
+ def setup
13
+ return unless installed?
14
+
15
+ mkdir_for_sites
16
+ include_sites_enabled
17
+
18
+ template("templates/nginx", "#{conf_path}/sites-available/#{hostname}")
19
+ link_file("#{conf_path}/sites-available/#{hostname}", "#{conf_path}/sites-enabled/#{hostname}")
20
+
21
+ append_file "/etc/hosts", "#{hostname} 127.0.0.1"
22
+ end
23
+
24
+ desc "Discard", "Remove the Nginx setting of rails application"
25
+ def discard
26
+ return unless installed?
27
+
28
+ %W(enabled available).each do |n|
29
+ remove_file("#{conf_path}/sites-#{n}/#{hostname}")
30
+ end
31
+
32
+ gsub_file("/etc/hosts", "#{hostname} 127.0.0.1", '')
33
+ end
34
+
35
+ private
36
+ def installed?
37
+ Dir.exists?(conf_path) if conf_path
38
+ end
39
+
40
+ def conf_path
41
+ return @conf_path if @conf_path
42
+
43
+ if available_paths.empty?
44
+ prompt_not_found
45
+
46
+ return
47
+ end
48
+
49
+ @conf_path = available_paths.first
50
+ begin
51
+ @conf_path = ask_for_choosing_one if available_paths.size > 1
52
+ rescue SystemExit
53
+ $stderr.puts "ERROR: You need to choose a config directory of Nginx!"
54
+ return
55
+ end
56
+
57
+ @conf_path
58
+ end
59
+
60
+ def hostname
61
+ "#{Rda::Rails.app_name}.local"
62
+ end
63
+
64
+ def available_paths
65
+ search_paths = Rda.config.nginx_conf_paths || []
66
+ search_paths = DEFAULT_CONF_PATHS if search_paths.empty?
67
+ @paths ||= search_paths.select { |p| Dir.exists? p if p } unless search_paths.empty?
68
+ end
69
+
70
+ def prompt_not_found
71
+ $stderr.puts "Config directory of Nginx is not found in the following paths:\n\n"
72
+ Rda.config.nginx_conf_paths.each { |p| $stderr.puts "* #{p}" }
73
+ $stderr.puts "\n"
74
+ end
75
+
76
+ def ask_for_choosing_one
77
+ available_paths.each_with_index { |p, i| puts "#{i + 1}) #{p}" }
78
+ puts "\n"
79
+ chosen = ask "Found more than one config directory of Nginx, please choose one to setup:"
80
+
81
+ index = chosen.to_i - 1
82
+
83
+ index >= 0 && index < available_paths.size ? available_paths[index] : exit
84
+ end
85
+
86
+ def mkdir_for_sites
87
+ %W(available enabled).each do |n|
88
+ dir = conf_path + "/sites-#{n}"
89
+ empty_directory(dir) unless Dir.exists?(dir)
90
+ end
91
+ end
92
+
93
+ def include_sites_enabled
94
+ conf = conf_path + '/nginx.conf'
95
+ gsub_file conf, /http {/, <<-INCLUDE_SITES_ENABLED
96
+ http {
97
+ include #{conf_path}/sites-enabled/*;
98
+ INCLUDE_SITES_ENABLED
99
+ end
100
+ end
101
+ end
data/lib/rda/rails.rb ADDED
@@ -0,0 +1,7 @@
1
+ module Rda
2
+ module Rails
3
+ def self.app_name
4
+ ::Rails.application.class.to_s.split('::').first.downcase
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Rda
2
+ class Railtie < Rails::Railtie
3
+ railtie_name :rda
4
+
5
+ rake_tasks do
6
+ load File.dirname(__FILE__) + "/../tasks/rda_tasks.rake"
7
+ end
8
+ end
9
+ end
data/lib/rda/rvm.rb ADDED
@@ -0,0 +1,48 @@
1
+ module Rda
2
+ class Rvm < Thor
3
+ include Thor::Actions
4
+
5
+ def self.source_root
6
+ File.dirname(__FILE__)
7
+ end
8
+
9
+ desc "setup", "Setup RVM for rails application"
10
+ def setup
11
+ if installed?
12
+ template('templates/rvmrc', rvmrc_path)
13
+ else
14
+ $stderr.puts "ERROR: RVM is not found. Please make sure that RVM is installed."
15
+ end
16
+ end
17
+
18
+ desc "discard", "Discard RVM settings for rails application"
19
+ def discard
20
+ if File.exists?(rvmrc_path)
21
+ remove_file(rvmrc_path)
22
+ else
23
+ $stderr.puts "ERROR: #{rvmrc_path} not found."
24
+ end
25
+ end
26
+
27
+ private
28
+ def installed?
29
+ rvm_path && Dir.exists?(rvm_path)
30
+ end
31
+
32
+ def rvm_path
33
+ ENV['rvm_path']
34
+ end
35
+
36
+ def gemset_name
37
+ "ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@#{Rda::Rails.app_name}"
38
+ end
39
+
40
+ def gemset_env
41
+ "#{rvm_path}/environments/#{gemset_name}"
42
+ end
43
+
44
+ def rvmrc_path
45
+ "#{::Rails.root}/.rvmrc"
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,6 @@
1
+ server {
2
+ server_name <%= hostname %>;
3
+ root <%= "#{::Rails.root}/public" %>;
4
+ passenger_enabled on;
5
+ rails_env development;
6
+ }
@@ -0,0 +1,5 @@
1
+ if [[ -s "<%= gemset_env %>" ]]; then
2
+ . "<%= gemset_env %>
3
+ else
4
+ rvm use <%= gemset_name %> --create
5
+ fi
@@ -0,0 +1,3 @@
1
+ module Rda
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rda.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'rails'
2
+ require 'thor'
3
+ require 'confstruct'
4
+
5
+ require 'rda/railtie'
6
+ require 'rda/rails'
7
+ require 'rda/rvm'
8
+ require 'rda/nginx'
9
+ require 'rda/app'
10
+
11
+ module Rda
12
+ @@config = Confstruct::Configuration.new do
13
+ nginx_conf_paths ['/etc/nginx', '/usr/local/nginx/conf', '/opt/nginx/conf']
14
+ end
15
+
16
+ def self.config
17
+ @@config
18
+ end
19
+
20
+ def self.configure(&block)
21
+ @@config.configure(&block)
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ namespace :rda do
2
+ namespace :rvm do
3
+ rvm = Rda::Rvm.new
4
+
5
+ desc "Setup RVM for rails application"
6
+ task :setup do
7
+ rvm.setup
8
+ end
9
+
10
+ desc "Discard RVM settings of rails application"
11
+ task :discard do
12
+ rvm.discard
13
+ end
14
+ end
15
+
16
+ namespace :nginx do
17
+ nginx = Rda::Nginx.new
18
+
19
+ desc "Setup Nginx for rails application"
20
+ task :setup => :environment do
21
+ nginx.setup
22
+ end
23
+
24
+ desc "Discard Nginx settings of rails application"
25
+ task :discard => :environment do
26
+ nginx.discard
27
+ end
28
+ end
29
+
30
+ namespace :app do
31
+ app = Rda::App.new
32
+
33
+ desc "Restart rails application"
34
+ task :restart do
35
+ app.restart
36
+ end
37
+ end
38
+ end
data/rda.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "rda/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "rda"
9
+ s.version = Rda::VERSION
10
+ s.authors = ["Tower He"]
11
+ s.email = ["towerhe@gmail.com"]
12
+ s.homepage = "https://github.com/towerhe/rda"
13
+ s.summary = "Rails Development Assist"
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
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency "rails", "~> 3.1.3"
21
+ s.add_dependency "thor"
22
+ s.add_dependency "confstruct"
23
+
24
+ s.add_development_dependency "pry"
25
+ s.add_development_dependency "rspec"
26
+ s.add_development_dependency "guard"
27
+ s.add_development_dependency "guard-bundler"
28
+ s.add_development_dependency "guard-rspec"
29
+ if RUBY_PLATFORM =~ /darwin/
30
+ s.add_development_dependency "ruby_gntp"
31
+ elsif RUBY_PLATFORM =~ /linux/
32
+ s.add_development_dependency "libnotify"
33
+ end
34
+ end
data/rvmrc.example ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@rda --create
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,7 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes