rsf_services 0.1.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.
- checksums.yaml +7 -0
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/lib/rsf_services.rb +64 -0
 - metadata +108 -0
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 46001a2fbe201745f35014c352239ee1b2113a74
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8ab3b1a92839931bbd8c0d7b3a79c9a8d6f62df8
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a454bdf4c4696ba46da5b4e891830ee680ae9a3477bc640b17d3cbb3a90fdebbf2aadddb27400e0268b530f2d94a60b98be674d05666ed85ed1c3c7171e8c661
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2f6c456961efc434f53accfaeaea51f832191fa991d1e883cc082ac6c422cd36dabf2584c94618c9bec75a61b4de24eaaa4e5ea20cfcf440ce20d0fd3eafd3a9
         
     | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    ADDED
    
    | 
         Binary file 
     | 
    
        data/lib/rsf_services.rb
    ADDED
    
    | 
         @@ -0,0 +1,64 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # file: rsf_services.rb
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rscript'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'dws-registry'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            class RSFServices < RScript
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def initialize(reg_path='', package_basepath: '')
         
     | 
| 
      
 13 
     | 
    
         
            +
                super()
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                @services = {}
         
     | 
| 
      
 16 
     | 
    
         
            +
                @package_basepath = package_basepath
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                if reg_path.length > 0 then
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  @services['registry'] = reg = DWSRegistry.new reg_path
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  # load the system/startup RSF jobs
         
     | 
| 
      
 23 
     | 
    
         
            +
                  jobs = reg.get_keys('system/startup/.[load="1"]').inject({}) do |r, job|
         
     | 
| 
      
 24 
     | 
    
         
            +
                    settings = reg.get_keys("system/packages/#{job.name}/*")\
         
     | 
| 
      
 25 
     | 
    
         
            +
                                      .inject({}){|r,x| r.merge(x.name.to_sym => x.text) }
         
     | 
| 
      
 26 
     | 
    
         
            +
                    r.merge(job.name => settings)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  jobs.each do |package, settings| 
         
     | 
| 
      
 30 
     | 
    
         
            +
                    r = run_job(package.to_s, '//job:load', settings, 
         
     | 
| 
      
 31 
     | 
    
         
            +
                                                            package_path: settings[:url])
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              def run_job(package, jobs, params={}, *qargs, 
         
     | 
| 
      
 38 
     | 
    
         
            +
                              package_path: ("%s/%s.rsf" % [@package_basepath, package]))
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                yield(params) if block_given?
         
     | 
| 
      
 41 
     | 
    
         
            +
                result, args = read([package_path, jobs.split(/\s/),qargs].flatten)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                rws = self
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                begin
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  r = eval result
         
     | 
| 
      
 48 
     | 
    
         
            +
                  return r
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                rescue Exception => e  
         
     | 
| 
      
 51 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 52 
     | 
    
         
            +
                  err_label = e.message.to_s + " :: \n" + e.backtrace.join("\n")      
         
     | 
| 
      
 53 
     | 
    
         
            +
                  log(err_label)
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              def log(msg)
         
     | 
| 
      
 59 
     | 
    
         
            +
                if @log == true then
         
     | 
| 
      
 60 
     | 
    
         
            +
                  @logger.debug msg
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
                
         
     | 
| 
      
 64 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: rsf_services
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - James Robertson
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain:
         
     | 
| 
      
 11 
     | 
    
         
            +
            - |
         
     | 
| 
      
 12 
     | 
    
         
            +
              -----BEGIN CERTIFICATE-----
         
     | 
| 
      
 13 
     | 
    
         
            +
              MIIDmDCCAoCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBJMRIwEAYDVQQDDAlnZW1t
         
     | 
| 
      
 14 
     | 
    
         
            +
              YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjETMBEGCgmSJomT
         
     | 
| 
      
 15 
     | 
    
         
            +
              8ixkARkWA2V1XzAeFw0xNDA3MTIxOTQwMTlaFw0xNTA3MTIxOTQwMTlaMEkxEjAQ
         
     | 
| 
      
 16 
     | 
    
         
            +
              BgNVBAMMCWdlbW1hc3RlcjEeMBwGCgmSJomT8ixkARkWDmphbWVzcm9iZXJ0c29u
         
     | 
| 
      
 17 
     | 
    
         
            +
              MRMwEQYKCZImiZPyLGQBGRYDZXVfMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
         
     | 
| 
      
 18 
     | 
    
         
            +
              CgKCAQEA1DClU6Pd/0b4nvq/x5LFVUImRhnj6C/6fdSBcdyFObJOH8C5i6Mllr/G
         
     | 
| 
      
 19 
     | 
    
         
            +
              eRykF+Qvh1ZFi+RjrxecMIN5rZ5A6QIxqEhlLM2SQKOf4vIdqjrGQIcHeD8fsk/N
         
     | 
| 
      
 20 
     | 
    
         
            +
              djPLrfiX2OHYRQrsj4bAlMTQVTy70gK8I3+NOUpePyzYe52KX0Vde/xD+stvupCb
         
     | 
| 
      
 21 
     | 
    
         
            +
              CmswhWsbjFJGrQusFr5QFmJMgtPoxqWyNtkhPiqsM5eqp3r9ZJAD2veSqox9rq/Z
         
     | 
| 
      
 22 
     | 
    
         
            +
              dVRHwQG9DvVXyqveXqvb545X2Ef0+Nw9uNBDEJfSUvmFwT/q/l5Ps+7ydj+ansxx
         
     | 
| 
      
 23 
     | 
    
         
            +
              IhheD5wkWMOs/NkuUVas1wMMmOGrzQIDAQABo4GKMIGHMAkGA1UdEwQCMAAwCwYD
         
     | 
| 
      
 24 
     | 
    
         
            +
              VR0PBAQDAgSwMB0GA1UdDgQWBBQFiNJVQtZNj1IoNIOz+GzxFRjJ8DAmBgNVHREE
         
     | 
| 
      
 25 
     | 
    
         
            +
              HzAdgRtnZW1tYXN0ZXJAamFtZXNyb2JlcnRzb24uZXUwJgYDVR0SBB8wHYEbZ2Vt
         
     | 
| 
      
 26 
     | 
    
         
            +
              bWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MA0GCSqGSIb3DQEBBQUAA4IBAQAq6pKR
         
     | 
| 
      
 27 
     | 
    
         
            +
              Wx9Y5UDCEmxphcNgT90e9gR5B1zxSktEF1GO9WtrG/J/Eb6G48tweJKe1nrib4La
         
     | 
| 
      
 28 
     | 
    
         
            +
              Zx3+vHIDj7FguCB1fQgQx/pkx64kW+CZOzWtLOrsJiqKrme7/nak9TZyBy2BF5K2
         
     | 
| 
      
 29 
     | 
    
         
            +
              oCTU2uxFT74h6FmPLlrDR206F04F4HaFzJKNMKG7cDhanQs5hsuXFAEQdD6DWJik
         
     | 
| 
      
 30 
     | 
    
         
            +
              awGab/qAohwrAtP/MCNls9YNFvBWWDPozQ0WZlCe8zXjoTAtDpYUVBznhuWkdPpC
         
     | 
| 
      
 31 
     | 
    
         
            +
              FpnFf8SgVEggA3UJApMkdLJgylaFVRWB9YefdTYWcBgpvwnI5hrcpw06jXRmazk5
         
     | 
| 
      
 32 
     | 
    
         
            +
              JTUarTGO425WKYWE
         
     | 
| 
      
 33 
     | 
    
         
            +
              -----END CERTIFICATE-----
         
     | 
| 
      
 34 
     | 
    
         
            +
            date: 2014-07-12 00:00:00.000000000 Z
         
     | 
| 
      
 35 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 37 
     | 
    
         
            +
              name: rscript
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 39 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 40 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 42 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 43 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 44 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 45 
     | 
    
         
            +
                    version: 0.1.25
         
     | 
| 
      
 46 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 47 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 48 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 49 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 50 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 51 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 52 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 53 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 54 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 55 
     | 
    
         
            +
                    version: 0.1.25
         
     | 
| 
      
 56 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 57 
     | 
    
         
            +
              name: dws-registry
         
     | 
| 
      
 58 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 59 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 60 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 61 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 62 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 63 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 64 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 65 
     | 
    
         
            +
                    version: 0.1.3
         
     | 
| 
      
 66 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 67 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 69 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 70 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 71 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 72 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 0.1.3
         
     | 
| 
      
 76 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 77 
     | 
    
         
            +
            email: james@r0bertson.co.uk
         
     | 
| 
      
 78 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 79 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 80 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 81 
     | 
    
         
            +
            files:
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/rsf_services.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            homepage: https://github.com/jrobertson/rsf_services
         
     | 
| 
      
 84 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 85 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 86 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 87 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 88 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 90 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 91 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 92 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 93 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 94 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 95 
     | 
    
         
            +
                  version: 2.1.2
         
     | 
| 
      
 96 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 97 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 98 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 99 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 100 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 101 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 102 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 103 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
      
 104 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 105 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 106 
     | 
    
         
            +
            summary: Designed to run within a server to run RSF jobs, as well as otherservices.
         
     | 
| 
      
 107 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 108 
     | 
    
         
            +
            has_rdoc: 
         
     | 
    
        metadata.gz.sig
    ADDED
    
    | 
         Binary file 
     |