daemons-rails 1.1.0 → 1.1.1
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/README.markdown +17 -3
- data/daemons-rails.gemspec +1 -1
- data/lib/daemons/rails/config.rb +1 -0
- data/lib/daemons/rails/configuration.rb +3 -0
- data/lib/daemons/rails/monitoring.rb +6 -4
- data/lib/daemons/rails/version.rb +1 -1
- data/spec/lib/daemons/rails/configuration_spec.rb +1 -4
- data/spec/spec_helper.rb +1 -7
- metadata +34 -29
    
        data/README.markdown
    CHANGED
    
    | @@ -5,7 +5,7 @@ To get it work just add dependency to this gem in your Gemfile. | |
| 5 5 |  | 
| 6 6 | 
             
            ## NOTES ##
         | 
| 7 7 |  | 
| 8 | 
            -
            If you switching from version  | 
| 8 | 
            +
            **If you are switching from earlier version to 1.1 you may need to move script/daemons file to lib/daemons directory.**
         | 
| 9 9 |  | 
| 10 10 | 
             
            ## GENERATOR ##
         | 
| 11 11 |  | 
| @@ -29,7 +29,7 @@ Examples: | |
| 29 29 |  | 
| 30 30 | 
             
            App-wide control script:
         | 
| 31 31 |  | 
| 32 | 
            -
                ./ | 
| 32 | 
            +
                ./lib/daemons/daemons [start|stop|restart|status]
         | 
| 33 33 | 
             
                rake daemons:(start|stop|status)
         | 
| 34 34 |  | 
| 35 35 | 
             
            ## MONITORING API ##
         | 
| @@ -45,7 +45,7 @@ App-wide control script: | |
| 45 45 | 
             
                controller.app_name # => test.rb
         | 
| 46 46 | 
             
                controller.start # => starts daemon
         | 
| 47 47 | 
             
                controller.stop # => stops daemon
         | 
| 48 | 
            -
                controller.status # => :not_exists or :running
         | 
| 48 | 
            +
                controller.status # => :not_exists or :running    
         | 
| 49 49 |  | 
| 50 50 | 
             
            ## CONFIGURATION ##
         | 
| 51 51 |  | 
| @@ -63,8 +63,22 @@ If you want to use directory other than default lib/daemons then you should add | |
| 63 63 | 
             
            If you change your mind, you can easily move content of this directory to other place and change config. 
         | 
| 64 64 | 
             
            Notice: this feature available only from version 1.1 and old generated daemons can't be free moved, because uses hard-coded path to lib/daemons. So, you can generate daemons with same names and then move client code to generated templates.
         | 
| 65 65 |  | 
| 66 | 
            +
            ## USING MULTIPLE DAEMON SETS ##
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            At this moment it is not supported at generators and rake tasks levels, but you can generate daemon to default location and move to different folder (you should also copy *daemons* script to same directory). Then you will be able to operate with them using following scripts:
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                other/daemons/location/daemons [start|stop|restart|status]
         | 
| 71 | 
            +
                other/daemons/location/<daemon_name>_ctl [start|stop|restart|status]
         | 
| 72 | 
            +
                
         | 
| 73 | 
            +
            To access the daemons with Monitoring API you can use configured instance of *Daemons::Rails::Monitoring*:
         | 
| 74 | 
            +
                
         | 
| 75 | 
            +
                Daemons::Rails::Monitoring.new("other/daemons/location")
         | 
| 76 | 
            +
                
         | 
| 77 | 
            +
            and same set of methods. Effectively, *Daemons::Rails::Monitoring* just delegates all method calls to *Daemons::Rails::Monitoring.default* initialized with configured daemons path.
         | 
| 78 | 
            +
             | 
| 66 79 | 
             
            ## CHANGES ##
         | 
| 67 80 |  | 
| 81 | 
            +
            * 1.1.1 - fix dependencies, clean-up specs
         | 
| 68 82 | 
             
            * 1.1.0 - supported custom directory for daemons, support multiple daemons directories
         | 
| 69 83 | 
             
            * 1.0.0 - changed api for Daemons::Rails::Monitoring, fixed path in template for script, improved documentation, added RSpec
         | 
| 70 84 | 
             
            * 0.0.3 - added rake for running script without daemonization (rake daemon:\<name\>)
         | 
    
        data/daemons-rails.gemspec
    CHANGED
    
    
    
        data/lib/daemons/rails/config.rb
    CHANGED
    
    
| @@ -1,22 +1,24 @@ | |
| 1 1 | 
             
            require "daemons"
         | 
| 2 | 
            +
            require "pathname"
         | 
| 3 | 
            +
            require "forwardable"
         | 
| 2 4 | 
             
            require "daemons/rails"
         | 
| 3 5 | 
             
            require "daemons/rails/config"
         | 
| 4 6 | 
             
            require "daemons/rails/controller"
         | 
| 5 | 
            -
            require "active_support/core_ext/module/delegation.rb"
         | 
| 6 7 |  | 
| 7 8 | 
             
            module Daemons
         | 
| 8 9 | 
             
              module Rails
         | 
| 9 10 | 
             
                class Monitoring
         | 
| 11 | 
            +
                  singleton_class.extend Forwardable
         | 
| 12 | 
            +
                  singleton_class.def_delegators :default, :daemons_path=, :daemons_path, :controller, :controllers, :statuses, :start, :stop
         | 
| 13 | 
            +
             | 
| 10 14 | 
             
                  def self.default
         | 
| 11 15 | 
             
                    @default ||= self.new
         | 
| 12 16 | 
             
                  end
         | 
| 13 17 |  | 
| 14 | 
            -
                  def initialize(daemons_path =  | 
| 18 | 
            +
                  def initialize(daemons_path = nil)
         | 
| 15 19 | 
             
                    @daemons_path = daemons_path
         | 
| 16 20 | 
             
                  end
         | 
| 17 21 |  | 
| 18 | 
            -
                  singleton_class.delegate :daemons_path=, :daemons_path, :controller, :controllers, :statuses, :start, :stop, :to => :default
         | 
| 19 | 
            -
             | 
| 20 22 | 
             
                  # @deprecate use Daemons::Rails::Monitoring#daemons_path=
         | 
| 21 23 | 
             
                  def self.daemons_directory=(value)
         | 
| 22 24 | 
             
                    self.daemons_path = value
         | 
| @@ -10,7 +10,6 @@ describe Daemons::Rails::Configuration do | |
| 10 10 | 
             
                describe "rails env" do
         | 
| 11 11 | 
             
                  its(:root) { should == Rails.root }
         | 
| 12 12 | 
             
                  its(:daemons_path) { should == Rails.root.join('lib', 'daemons') }
         | 
| 13 | 
            -
                  its(:daemons_path) { should == Pathname.new('lib').join('daemons') }
         | 
| 14 13 | 
             
                end
         | 
| 15 14 |  | 
| 16 15 | 
             
                describe "no rails" do
         | 
| @@ -26,7 +25,6 @@ describe Daemons::Rails::Configuration do | |
| 26 25 | 
             
                  end
         | 
| 27 26 | 
             
                  its(:root) { should == Rails_.root }
         | 
| 28 27 | 
             
                  its(:daemons_path) { should == Rails_.root.join('lib', 'daemons') }
         | 
| 29 | 
            -
                  its(:daemons_path) { should == Pathname.new('lib').join('daemons') }
         | 
| 30 28 | 
             
                end
         | 
| 31 29 | 
             
              end
         | 
| 32 30 |  | 
| @@ -42,11 +40,10 @@ describe Daemons::Rails::Configuration do | |
| 42 40 | 
             
                end
         | 
| 43 41 |  | 
| 44 42 | 
             
                its(:daemons_path) { should == Rails.root.join('daemons') }
         | 
| 45 | 
            -
                its(:daemons_path) { should == Pathname.new('daemons') }
         | 
| 46 43 |  | 
| 47 44 | 
             
                it "should override daemons directory" do
         | 
| 48 45 | 
             
                  Daemons::Rails::Monitoring.daemons_path.should == Rails.root.join('daemons')
         | 
| 49 46 | 
             
                  Daemons::Rails::Monitoring.controllers.map(&:app_name).should == %w(test2.rb)
         | 
| 50 47 | 
             
                end
         | 
| 51 48 | 
             
              end
         | 
| 52 | 
            -
            end
         | 
| 49 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -2,10 +2,4 @@ class Rails | |
| 2 2 | 
             
              def Rails.root
         | 
| 3 3 | 
             
                @root ||= Pathname.new(File.absolute_path(File.dirname(__FILE__))).join('fixtures')
         | 
| 4 4 | 
             
              end
         | 
| 5 | 
            -
            end
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            RSpec.configure do |config|
         | 
| 8 | 
            -
              config.treat_symbols_as_metadata_keys_with_true_values = true
         | 
| 9 | 
            -
              config.run_all_when_everything_filtered = true
         | 
| 10 | 
            -
              config.filter_run :focus
         | 
| 11 | 
            -
            end
         | 
| 5 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: daemons-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,88 +9,88 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2013-01-10 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            -
              name: rails
         | 
| 16 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 17 | 
             
                - - ~>
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 19 | 
             
                    version: '3.0'
         | 
| 20 | 
            +
                none: false
         | 
| 22 21 | 
             
              type: :runtime
         | 
| 23 | 
            -
               | 
| 22 | 
            +
              name: rails
         | 
| 24 23 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 24 | 
             
                requirements:
         | 
| 27 25 | 
             
                - - ~>
         | 
| 28 26 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 27 | 
             
                    version: '3.0'
         | 
| 28 | 
            +
                none: false
         | 
| 29 | 
            +
              prerelease: false
         | 
| 30 30 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            -
              name: daemons
         | 
| 32 31 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 32 | 
             
                requirements:
         | 
| 35 33 | 
             
                - - ! '>='
         | 
| 36 34 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 35 | 
             
                    version: '0'
         | 
| 36 | 
            +
                none: false
         | 
| 38 37 | 
             
              type: :runtime
         | 
| 39 | 
            -
               | 
| 38 | 
            +
              name: daemons
         | 
| 40 39 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 40 | 
             
                requirements:
         | 
| 43 41 | 
             
                - - ! '>='
         | 
| 44 42 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 43 | 
             
                    version: '0'
         | 
| 44 | 
            +
                none: false
         | 
| 45 | 
            +
              prerelease: false
         | 
| 46 46 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            -
              name: multi_json
         | 
| 48 47 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 48 | 
             
                requirements:
         | 
| 51 49 | 
             
                - - ~>
         | 
| 52 50 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 51 | 
             
                    version: '1.0'
         | 
| 52 | 
            +
                none: false
         | 
| 54 53 | 
             
              type: :runtime
         | 
| 55 | 
            -
               | 
| 54 | 
            +
              name: multi_json
         | 
| 56 55 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 56 | 
             
                requirements:
         | 
| 59 57 | 
             
                - - ~>
         | 
| 60 58 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 59 | 
             
                    version: '1.0'
         | 
| 60 | 
            +
                none: false
         | 
| 61 | 
            +
              prerelease: false
         | 
| 62 62 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            -
              name: rake
         | 
| 64 63 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 64 | 
             
                requirements:
         | 
| 67 65 | 
             
                - - ! '>='
         | 
| 68 66 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 67 | 
             
                    version: '0'
         | 
| 68 | 
            +
                none: false
         | 
| 70 69 | 
             
              type: :development
         | 
| 71 | 
            -
               | 
| 70 | 
            +
              name: rake
         | 
| 72 71 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 72 | 
             
                requirements:
         | 
| 75 73 | 
             
                - - ! '>='
         | 
| 76 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 75 | 
             
                    version: '0'
         | 
| 76 | 
            +
                none: false
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 78 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 | 
            -
              name: rspec
         | 
| 80 79 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 80 | 
             
                requirements:
         | 
| 83 | 
            -
                - -  | 
| 81 | 
            +
                - - ! '>='
         | 
| 84 82 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 | 
            -
                    version: 2. | 
| 83 | 
            +
                    version: '2.12'
         | 
| 84 | 
            +
                none: false
         | 
| 86 85 | 
             
              type: :development
         | 
| 87 | 
            -
               | 
| 86 | 
            +
              name: rspec
         | 
| 88 87 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            -
                none: false
         | 
| 90 88 | 
             
                requirements:
         | 
| 91 | 
            -
                - -  | 
| 89 | 
            +
                - - ! '>='
         | 
| 92 90 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            -
                    version: 2. | 
| 91 | 
            +
                    version: '2.12'
         | 
| 92 | 
            +
                none: false
         | 
| 93 | 
            +
              prerelease: false
         | 
| 94 94 | 
             
            description: daemons gem support for Rails 3
         | 
| 95 95 | 
             
            email: []
         | 
| 96 96 | 
             
            executables: []
         | 
| @@ -135,17 +135,23 @@ rdoc_options: [] | |
| 135 135 | 
             
            require_paths:
         | 
| 136 136 | 
             
            - lib
         | 
| 137 137 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 138 | 
            -
              none: false
         | 
| 139 138 | 
             
              requirements:
         | 
| 140 139 | 
             
              - - ! '>='
         | 
| 141 140 | 
             
                - !ruby/object:Gem::Version
         | 
| 141 | 
            +
                  hash: -1919585855362980352
         | 
| 142 142 | 
             
                  version: '0'
         | 
| 143 | 
            -
             | 
| 143 | 
            +
                  segments:
         | 
| 144 | 
            +
                  - 0
         | 
| 144 145 | 
             
              none: false
         | 
| 146 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 145 147 | 
             
              requirements:
         | 
| 146 148 | 
             
              - - ! '>='
         | 
| 147 149 | 
             
                - !ruby/object:Gem::Version
         | 
| 150 | 
            +
                  hash: -1919585855362980352
         | 
| 148 151 | 
             
                  version: '0'
         | 
| 152 | 
            +
                  segments:
         | 
| 153 | 
            +
                  - 0
         | 
| 154 | 
            +
              none: false
         | 
| 149 155 | 
             
            requirements: []
         | 
| 150 156 | 
             
            rubyforge_project: 
         | 
| 151 157 | 
             
            rubygems_version: 1.8.24
         | 
| @@ -153,4 +159,3 @@ signing_key: | |
| 153 159 | 
             
            specification_version: 3
         | 
| 154 160 | 
             
            summary: daemons gem support for Rails 3
         | 
| 155 161 | 
             
            test_files: []
         | 
| 156 | 
            -
            has_rdoc: 
         |