rda 0.2.0 → 0.3.0
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +13 -33
- data/bin/rda +1 -1
- data/lib/rda/app.rb +35 -4
- data/lib/rda/railtie.rb +0 -4
- data/lib/rda/version.rb +1 -1
- metadata +4 -5
- data/lib/tasks/rda_tasks.rake +0 -38
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        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  | 
| 5 | 
            +
            Rda(Rails Development Assist) is combined with lots of useful commands which can help you to setup your development enviroments and tools more quickly.
         | 
| 6 6 |  | 
| 7 7 | 
             
            ### Features
         | 
| 8 8 |  | 
| 9 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
         | 
| 12 12 |  | 
| 13 13 | 
             
            ### Usage
         | 
| 14 14 |  | 
| @@ -24,6 +24,8 @@ Or simply add rda to the Gemfile | |
| 24 24 | 
             
            gem 'rda'
         | 
| 25 25 | 
             
            ```
         | 
| 26 26 |  | 
| 27 | 
            +
            That's all.
         | 
| 28 | 
            +
             | 
| 27 29 | 
             
            #### Configuration
         | 
| 28 30 |  | 
| 29 31 | 
             
            For configuring rda, you need to create an initializer for rda:
         | 
| @@ -41,12 +43,9 @@ end | |
| 41 43 |  | 
| 42 44 | 
             
            ```bash
         | 
| 43 45 | 
             
            rda rvm setup
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            # Or
         | 
| 46 | 
            -
            rake rda:rvm:setup
         | 
| 47 46 | 
             
            ```
         | 
| 48 47 |  | 
| 49 | 
            -
            First of all, this  | 
| 48 | 
            +
            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:
         | 
| 50 49 |  | 
| 51 50 | 
             
            ```bash
         | 
| 52 51 | 
             
            if [[ -s '/path/to/rvm/environments/ruby-1.9.3-p194@app_name' ]]; then
         | 
| @@ -64,29 +63,23 @@ rvm rvmrc trust | |
| 64 63 |  | 
| 65 64 | 
             
            Or you can set `rvm_trust_rvmrcs_flag=1` in ~/.rvmrc or /etc/rvmrc.
         | 
| 66 65 |  | 
| 67 | 
            -
            If RVM is not installed, this  | 
| 66 | 
            +
            If RVM is not installed, this command will do nothing but exit.
         | 
| 68 67 |  | 
| 69 68 | 
             
            #### Discard RVM settings
         | 
| 70 69 |  | 
| 71 70 | 
             
            ```bash
         | 
| 72 71 | 
             
            rda rvm:discard
         | 
| 73 | 
            -
             | 
| 74 | 
            -
            # Or
         | 
| 75 | 
            -
            rake rda:rvm:discard
         | 
| 76 72 | 
             
            ```
         | 
| 77 73 |  | 
| 78 | 
            -
            This  | 
| 74 | 
            +
            This command removes the .rvmrc from your rails application.
         | 
| 79 75 |  | 
| 80 76 | 
             
            #### Setup Nginx
         | 
| 81 77 |  | 
| 82 78 | 
             
            ```bash
         | 
| 83 79 | 
             
            rda nginx setup --environment production --hostname www.example.com
         | 
| 84 | 
            -
             | 
| 85 | 
            -
            # Or
         | 
| 86 | 
            -
            rake rda:nginx:setup
         | 
| 87 80 | 
             
            ```
         | 
| 88 81 |  | 
| 89 | 
            -
            First this  | 
| 82 | 
            +
            First this command will try to find the config files of Nginx, which you have installed, from the following paths:
         | 
| 90 83 |  | 
| 91 84 | 
             
            * /etc/nginx
         | 
| 92 85 | 
             
            * /usr/local/nginx/conf
         | 
| @@ -102,9 +95,6 @@ Please make sure that you have the write permission of the directory you choosed | |
| 102 95 |  | 
| 103 96 | 
             
            ```bash
         | 
| 104 97 | 
             
            rvmsudo rda nginx setup --environment production --hostname www.example.com
         | 
| 105 | 
            -
             | 
| 106 | 
            -
            # Or
         | 
| 107 | 
            -
            rvmsudo rake rda:nginx:setup
         | 
| 108 98 | 
             
            ```
         | 
| 109 99 |  | 
| 110 100 | 
             
            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.
         | 
| @@ -122,37 +112,27 @@ Finally, You need to start Nginx `/path/to/nginx/sbin/nginx` and then visit http | |
| 122 112 | 
             
            ```bash
         | 
| 123 113 | 
             
            rda nginx discard --hostname www.example.com # Or
         | 
| 124 114 |  | 
| 125 | 
            -
            rake rda:nginx:discard # Or
         | 
| 126 | 
            -
             | 
| 127 115 | 
             
            sudo rda nginx discard --hostname www.example.com # Or
         | 
| 128 116 |  | 
| 129 | 
            -
            sudo rake rda:nginx:discard # Or
         | 
| 130 | 
            -
             | 
| 131 117 | 
             
            rvmsudo rda nginx discard --hostname www.example.com # Using RVM
         | 
| 132 | 
            -
             | 
| 133 | 
            -
            rvmsudo rake rda:nginx:discard # Using RVM
         | 
| 134 118 | 
             
            ```
         | 
| 135 119 |  | 
| 136 | 
            -
            This  | 
| 120 | 
            +
            This command will clean up all the things created or configured by rda:nginx:setup.
         | 
| 137 121 |  | 
| 138 122 | 
             
            #### Restart application
         | 
| 139 123 |  | 
| 140 124 | 
             
            ```bash
         | 
| 141 125 | 
             
            rda app restart
         | 
| 142 | 
            -
             | 
| 143 | 
            -
            # Or
         | 
| 144 | 
            -
            rake rda:app:restart
         | 
| 145 126 | 
             
            ```
         | 
| 146 127 |  | 
| 147 | 
            -
            This  | 
| 128 | 
            +
            This command touches tmp/restart.txt to restart your rails application, For detail, please visit [http://bit.ly/ztKA07](http://bit.ly/ztKA07)
         | 
| 148 129 |  | 
| 149 | 
            -
            #### Release your rails application | 
| 130 | 
            +
            #### Release your rails application
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            You should create a `VERSION` under your application root path.
         | 
| 150 133 |  | 
| 151 134 | 
             
            ```bash
         | 
| 152 135 | 
             
            rda app release
         | 
| 153 | 
            -
             | 
| 154 | 
            -
            # Or
         | 
| 155 | 
            -
            rake rda:app:release
         | 
| 156 136 | 
             
            ```
         | 
| 157 137 |  | 
| 158 138 | 
             
            ### License
         | 
    
        data/bin/rda
    CHANGED
    
    | @@ -22,7 +22,7 @@ class RdaCommand < Thor | |
| 22 22 | 
             
                Rda::Nginx.new.send(action.to_sym, options)
         | 
| 23 23 | 
             
              end
         | 
| 24 24 |  | 
| 25 | 
            -
              desc 'app ACTION', 'Manage the lifecycle of the application. Available actions: restart.'
         | 
| 25 | 
            +
              desc 'app ACTION', 'Manage the lifecycle of the application. Available actions: restart, release.'
         | 
| 26 26 | 
             
              def app(action)
         | 
| 27 27 | 
             
                Rda::App.new.send(action.to_sym)
         | 
| 28 28 | 
             
              end
         | 
    
        data/lib/rda/app.rb
    CHANGED
    
    | @@ -1,11 +1,42 @@ | |
| 1 1 | 
             
            module Rda
         | 
| 2 2 | 
             
              class App < Thor
         | 
| 3 | 
            -
                desc  | 
| 3 | 
            +
                desc 'Restart', 'Restart the application'
         | 
| 4 4 | 
             
                def restart
         | 
| 5 | 
            -
                   | 
| 6 | 
            -
             | 
| 5 | 
            +
                  FileUtils.touch dir_of('tmp') + '/restart.txt'
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                desc 'Release', 'Release the application'
         | 
| 9 | 
            +
                def release
         | 
| 10 | 
            +
                  version_file = File.join(::Rails.root, 'VERSION')
         | 
| 11 | 
            +
                  version = File.exist?(version_file) ? File.read(version_file).strip : ""
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  app_name = Rda::Rails.app_name
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  pkg_dir = dir_of('pkg')
         | 
| 16 | 
            +
                  tmp_dir = dir_of("pkg/#{app_name}")
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  system("rm -fr #{tmp_dir}")
         | 
| 19 | 
            +
                  system("git clone #{::Rails.root} #{tmp_dir}")
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  puts "Create the src release..."
         | 
| 22 | 
            +
                  system("rm -fr #{tmp_dir}/.git")
         | 
| 23 | 
            +
                  system("rm -fr #{tmp_dir}/.gitignore")
         | 
| 24 | 
            +
                  system("cd #{pkg_dir};tar czf #{app_name}-#{version}.src.tar.gz #{app_name}")
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  puts "Create the bin release..."
         | 
| 27 | 
            +
                  system("bundle package")
         | 
| 28 | 
            +
                  system("mv #{::Rails.root}/vendor/cache #{tmp_dir}/vendor")
         | 
| 29 | 
            +
                  system("cd #{pkg_dir};tar czf #{app_name}-#{version}.bin.tar.gz #{app_name}")
         | 
| 30 | 
            +
                  system("rm -fr #{tmp_dir}")
         | 
| 31 | 
            +
                  puts "#{app_name} #{version} released!"
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                private
         | 
| 35 | 
            +
                def dir_of(dir)
         | 
| 36 | 
            +
                  dir = File.join(::Rails.root.to_s, dir)
         | 
| 37 | 
            +
                  FileUtils.mkdir_p dir unless Dir.exists?(dir)
         | 
| 7 38 |  | 
| 8 | 
            -
                   | 
| 39 | 
            +
                  dir
         | 
| 9 40 | 
             
                end
         | 
| 10 41 | 
             
              end
         | 
| 11 42 | 
             
            end
         | 
    
        data/lib/rda/railtie.rb
    CHANGED
    
    
    
        data/lib/rda/version.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 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-10- | 
| 12 | 
            +
            date: 2012-10-09 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: pry
         | 
| @@ -200,7 +200,6 @@ files: | |
| 200 200 | 
             
            - lib/rda/templates/rvmrc
         | 
| 201 201 | 
             
            - lib/rda/templates/setup_load_paths.rb
         | 
| 202 202 | 
             
            - lib/rda/version.rb
         | 
| 203 | 
            -
            - lib/tasks/rda_tasks.rake
         | 
| 204 203 | 
             
            - rda.gemspec
         | 
| 205 204 | 
             
            - rvmrc.example
         | 
| 206 205 | 
             
            - spec/dummy/Rakefile
         | 
| @@ -255,7 +254,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 255 254 | 
             
                  version: '0'
         | 
| 256 255 | 
             
                  segments:
         | 
| 257 256 | 
             
                  - 0
         | 
| 258 | 
            -
                  hash:  | 
| 257 | 
            +
                  hash: 3421142442146899695
         | 
| 259 258 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 260 259 | 
             
              none: false
         | 
| 261 260 | 
             
              requirements:
         | 
| @@ -264,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 264 263 | 
             
                  version: '0'
         | 
| 265 264 | 
             
                  segments:
         | 
| 266 265 | 
             
                  - 0
         | 
| 267 | 
            -
                  hash:  | 
| 266 | 
            +
                  hash: 3421142442146899695
         | 
| 268 267 | 
             
            requirements: []
         | 
| 269 268 | 
             
            rubyforge_project: 
         | 
| 270 269 | 
             
            rubygems_version: 1.8.24
         | 
    
        data/lib/tasks/rda_tasks.rake
    DELETED
    
    | @@ -1,38 +0,0 @@ | |
| 1 | 
            -
            namespace :rda do
         | 
| 2 | 
            -
              namespace :rvm do
         | 
| 3 | 
            -
                rvm = Rda::Rvm.new
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                desc "Set up RVM for your rails application"
         | 
| 6 | 
            -
                task :setup do
         | 
| 7 | 
            -
                  rvm.setup
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                desc "Discard RVM settings of your 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 "Set up Nginx for your rails application"
         | 
| 20 | 
            -
                task :setup => :environment do
         | 
| 21 | 
            -
                  nginx.setup
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                desc "Discard Nginx settings of your 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 your rails application"
         | 
| 34 | 
            -
                task :restart do
         | 
| 35 | 
            -
                  app.restart
         | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
              end
         | 
| 38 | 
            -
            end
         |