dynobattery 0.1.0 → 0.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/Manifest +1 -0
- data/Rakefile +1 -1
- data/dynobattery.gemspec +2 -2
- data/lib/dynobattery.rb +14 -12
- metadata +3 -3
    
        data/Manifest
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -4,7 +4,7 @@ require 'echoe' | |
| 4 4 | 
             
            require 'net/http'
         | 
| 5 5 | 
             
            require 'heroku'
         | 
| 6 6 |  | 
| 7 | 
            -
            Echoe.new('dynobattery', '0.1. | 
| 7 | 
            +
            Echoe.new('dynobattery', '0.1.1') do |p|  
         | 
| 8 8 | 
             
              p.description     = "Submit request operations for dyno calculations on Heroku"  
         | 
| 9 9 | 
             
              p.url             = "http://github.com/fedesoria/dynobattery"  
         | 
| 10 10 | 
             
              p.author          = "Federico Soria"  
         | 
    
        data/dynobattery.gemspec
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{dynobattery}
         | 
| 5 | 
            -
              s.version = "0.1. | 
| 5 | 
            +
              s.version = "0.1.1"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["Federico Soria"]
         | 
| @@ -10,7 +10,7 @@ Gem::Specification.new do |s| | |
| 10 10 | 
             
              s.description = %q{Submit request operations for dyno calculations on Heroku}
         | 
| 11 11 | 
             
              s.email = %q{federico@dospuntocero.com.mx}
         | 
| 12 12 | 
             
              s.extra_rdoc_files = ["README.rdoc", "lib/dynobattery.rb"]
         | 
| 13 | 
            -
              s.files = ["Manifest", "README.rdoc", "Rakefile", " | 
| 13 | 
            +
              s.files = ["Manifest", "README.rdoc", "Rakefile", "dynobattery.gemspec", "lib/dynobattery.rb"]
         | 
| 14 14 | 
             
              s.homepage = %q{http://github.com/fedesoria/dynobattery}
         | 
| 15 15 | 
             
              s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Dynobattery", "--main", "README.rdoc"]
         | 
| 16 16 | 
             
              s.require_paths = ["lib"]
         | 
    
        data/lib/dynobattery.rb
    CHANGED
    
    | @@ -4,18 +4,20 @@ class DynoBattery | |
| 4 4 | 
             
              end
         | 
| 5 5 |  | 
| 6 6 | 
             
              def call(env)
         | 
| 7 | 
            -
                 | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                   | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
                   | 
| 7 | 
            +
                if defined?(DYNO_DOMAIN)
         | 
| 8 | 
            +
                  uri = URI.parse("http://dyno-battery.heroku.com/")
         | 
| 9 | 
            +
                  http = Net::HTTP.new(uri.host, uri.port)
         | 
| 10 | 
            +
                  http.open_timeout = 3
         | 
| 11 | 
            +
                  http.read_timeout = 3
         | 
| 12 | 
            +
                  start = Time.now  
         | 
| 13 | 
            +
                  status, headers, response = @app.call(env)  
         | 
| 14 | 
            +
                  stop = Time.now
         | 
| 15 | 
            +
                  if defined?(DYNO_USER)? && defined?(DYNO_PASSWORD) && stop.min == 40
         | 
| 16 | 
            +
                    get_dynos
         | 
| 17 | 
            +
                    http.post("/heroku","name=#{DYNO_DOMAIN}&date=#{start.to_s}&time=#{"%10.6f" % (stop - start)}&dyno=#{@dynos}")
         | 
| 18 | 
            +
                  else
         | 
| 19 | 
            +
                    http.post("/heroku","name=#{DYNO_DOMAIN}&date=#{start.to_s}&time=#{"%10.6f" % (stop - start)}")
         | 
| 20 | 
            +
                  end
         | 
| 19 21 | 
             
                end
         | 
| 20 22 | 
             
                [status, headers, response]
         | 
| 21 23 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 1
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.1. | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              version: 0.1.1
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - Federico Soria
         | 
| @@ -31,8 +31,8 @@ files: | |
| 31 31 | 
             
            - Manifest
         | 
| 32 32 | 
             
            - README.rdoc
         | 
| 33 33 | 
             
            - Rakefile
         | 
| 34 | 
            -
            - lib/dynobattery.rb
         | 
| 35 34 | 
             
            - dynobattery.gemspec
         | 
| 35 | 
            +
            - lib/dynobattery.rb
         | 
| 36 36 | 
             
            has_rdoc: true
         | 
| 37 37 | 
             
            homepage: http://github.com/fedesoria/dynobattery
         | 
| 38 38 | 
             
            licenses: []
         |