platform1 0.0.3 → 0.0.4
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/bin/platform1 +81 -11
- data/platform1.gemspec +4 -4
- metadata +43 -52
    
        data/bin/platform1
    CHANGED
    
    | @@ -27,26 +27,81 @@ class Platform1Command < Clamp::Command | |
| 27 27 |  | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| 30 | 
            -
               | 
| 30 | 
            +
              module Warnings
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                extend Clamp::Option::Declaration
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                option "--no-warn", :flag, "don't print warnings"
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                def warn(message)
         | 
| 37 | 
            +
                  $stderr.puts(message) unless no_warn?
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              subcommand "start", "Start the server." do
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                self.description = %{
         | 
| 45 | 
            +
                  Start Passenger Standalone, as a daemon process.
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  Succeeds, with a warning, if the server is already running.
         | 
| 48 | 
            +
                }
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                include Warnings
         | 
| 31 51 |  | 
| 32 52 | 
             
                def execute
         | 
| 33 | 
            -
                   | 
| 53 | 
            +
                  if pid = passenger_pid
         | 
| 54 | 
            +
                    warn "already UP (pid #{pid})"
         | 
| 55 | 
            +
                  else
         | 
| 56 | 
            +
                    sh("passenger start -p #{passenger_port} -d")
         | 
| 57 | 
            +
                  end
         | 
| 34 58 | 
             
                end
         | 
| 35 59 |  | 
| 36 60 | 
             
              end
         | 
| 37 61 |  | 
| 38 | 
            -
              subcommand "stop", "Stop  | 
| 62 | 
            +
              subcommand "stop", "Stop the server." do
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                self.description = %{
         | 
| 65 | 
            +
                  Stop Passenger Standalone.
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  Succeeds, with a warning, if the server is not running.
         | 
| 68 | 
            +
                }
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                include Warnings
         | 
| 39 71 |  | 
| 40 72 | 
             
                def execute
         | 
| 41 | 
            -
                   | 
| 73 | 
            +
                  if passenger_pid
         | 
| 74 | 
            +
                    sh("passenger stop -p #{passenger_port}")
         | 
| 75 | 
            +
                  else
         | 
| 76 | 
            +
                    warn "already DOWN"
         | 
| 77 | 
            +
                  end
         | 
| 42 78 | 
             
                end
         | 
| 43 79 |  | 
| 44 80 | 
             
              end
         | 
| 45 81 |  | 
| 46 82 | 
             
              subcommand "status", "Show Passenger status." do
         | 
| 47 83 |  | 
| 84 | 
            +
                self.description = %{
         | 
| 85 | 
            +
                  Show status of the Passenger Standalone server.
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                  Prints "UP", plus the server pid, if the server is running.
         | 
| 88 | 
            +
                  Otherwise, prints "DOWN".
         | 
| 89 | 
            +
                }
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                def execute
         | 
| 92 | 
            +
                  if pid = passenger_pid
         | 
| 93 | 
            +
                    puts "UP (pid #{pid})"
         | 
| 94 | 
            +
                  else
         | 
| 95 | 
            +
                    puts "DOWN"
         | 
| 96 | 
            +
                  end
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
              end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
              subcommand "run", "Run Passenger Standalone." do
         | 
| 102 | 
            +
             | 
| 48 103 | 
             
                def execute
         | 
| 49 | 
            -
                  sh("passenger  | 
| 104 | 
            +
                  sh("passenger start -p #{passenger_port}")
         | 
| 50 105 | 
             
                end
         | 
| 51 106 |  | 
| 52 107 | 
             
              end
         | 
| @@ -54,7 +109,7 @@ class Platform1Command < Clamp::Command | |
| 54 109 | 
             
              subcommand "open", "Open app in a browser." do
         | 
| 55 110 |  | 
| 56 111 | 
             
                parameter "[PATH]", "a path to append to the app url"
         | 
| 57 | 
            -
             | 
| 112 | 
            +
             | 
| 58 113 | 
             
                def execute
         | 
| 59 114 | 
             
                  Launchy.open(url(path))
         | 
| 60 115 | 
             
                end
         | 
| @@ -62,13 +117,13 @@ class Platform1Command < Clamp::Command | |
| 62 117 | 
             
              end
         | 
| 63 118 |  | 
| 64 119 | 
             
              subcommand "url", "Print application url." do
         | 
| 65 | 
            -
             | 
| 120 | 
            +
             | 
| 66 121 | 
             
                def execute
         | 
| 67 122 | 
             
                  puts application_url
         | 
| 68 123 | 
             
                end
         | 
| 69 124 |  | 
| 70 125 | 
             
              end
         | 
| 71 | 
            -
             | 
| 126 | 
            +
             | 
| 72 127 | 
             
              subcommand "restart", "Ask app to restart" do
         | 
| 73 128 |  | 
| 74 129 | 
             
                def execute
         | 
| @@ -78,13 +133,28 @@ class Platform1Command < Clamp::Command | |
| 78 133 | 
             
              end
         | 
| 79 134 |  | 
| 80 135 | 
             
              private
         | 
| 81 | 
            -
             | 
| 136 | 
            +
             | 
| 82 137 | 
             
              def passenger_port
         | 
| 83 138 | 
             
                configuration["port"] || signal_usage_error("port not defined: please run 'init' first")
         | 
| 84 139 | 
             
              end
         | 
| 85 140 |  | 
| 141 | 
            +
              def passenger_pid
         | 
| 142 | 
            +
                return nil unless File.exists?(passenger_pid_file)
         | 
| 143 | 
            +
                pid = Integer(File.read(passenger_pid_file))
         | 
| 144 | 
            +
                begin
         | 
| 145 | 
            +
                  Process.kill(0, pid) # check that it's actually running
         | 
| 146 | 
            +
                  pid
         | 
| 147 | 
            +
                rescue Errno::ESRCH
         | 
| 148 | 
            +
                  nil
         | 
| 149 | 
            +
                end
         | 
| 150 | 
            +
              end
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              def passenger_pid_file
         | 
| 153 | 
            +
                "tmp/pids/passenger.#{passenger_port}.pid"
         | 
| 154 | 
            +
              end
         | 
| 155 | 
            +
             | 
| 86 156 | 
             
              def application_url
         | 
| 87 | 
            -
                "http:// | 
| 157 | 
            +
                "http://localhost:#{passenger_port}/"
         | 
| 88 158 | 
             
              end
         | 
| 89 159 |  | 
| 90 160 | 
             
              def url(path = nil)
         | 
| @@ -94,7 +164,7 @@ class Platform1Command < Clamp::Command | |
| 94 164 | 
             
                end
         | 
| 95 165 | 
             
                url
         | 
| 96 166 | 
             
              end
         | 
| 97 | 
            -
             | 
| 167 | 
            +
             | 
| 98 168 | 
             
              def sh(command)
         | 
| 99 169 | 
             
                system(command) || raise("Error running: #{command.inspect}")
         | 
| 100 170 | 
             
              end
         | 
    
        data/platform1.gemspec
    CHANGED
    
    | @@ -2,17 +2,17 @@ | |
| 2 2 | 
             
            $:.push File.expand_path("../lib", __FILE__)
         | 
| 3 3 |  | 
| 4 4 | 
             
            Gem::Specification.new do |gem|
         | 
| 5 | 
            -
             | 
| 5 | 
            +
             | 
| 6 6 | 
             
              gem.name        = "platform1"
         | 
| 7 | 
            -
              gem.version     = "0.0. | 
| 7 | 
            +
              gem.version     = "0.0.4"
         | 
| 8 8 | 
             
              gem.platform    = Gem::Platform::RUBY
         | 
| 9 | 
            -
             | 
| 9 | 
            +
             | 
| 10 10 | 
             
              gem.authors     = ["Mike Williams"]
         | 
| 11 11 | 
             
              gem.email       = ["mdub@dogbiscuit.org"]
         | 
| 12 12 |  | 
| 13 13 | 
             
              gem.summary     = %q{Simple and speedy Rails/Rack development server.}
         | 
| 14 14 | 
             
              gem.description = %q{A thin wrapper around Passenger Standalone.}
         | 
| 15 | 
            -
             | 
| 15 | 
            +
             | 
| 16 16 | 
             
              gem.files         = `git ls-files`.split("\n")
         | 
| 17 17 | 
             
              gem.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 18 18 | 
             
              gem.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,95 +1,86 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: platform1
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.4
         | 
| 4 5 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.0.3
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors: | 
| 7 | 
            +
            authors:
         | 
| 8 8 | 
             
            - Mike Williams
         | 
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
            dependencies: 
         | 
| 16 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 12 | 
            +
            date: 2012-02-23 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 17 15 | 
             
              name: clamp
         | 
| 18 | 
            -
               | 
| 19 | 
            -
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 16 | 
            +
              requirement: &70256246804980 !ruby/object:Gem::Requirement
         | 
| 20 17 | 
             
                none: false
         | 
| 21 | 
            -
                requirements: | 
| 22 | 
            -
                - -  | 
| 23 | 
            -
                  - !ruby/object:Gem::Version | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ! '>='
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 24 21 | 
             
                    version: 0.1.8
         | 
| 25 22 | 
             
              type: :runtime
         | 
| 26 | 
            -
              version_requirements: *id001
         | 
| 27 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 28 | 
            -
              name: passenger
         | 
| 29 23 | 
             
              prerelease: false
         | 
| 30 | 
            -
               | 
| 24 | 
            +
              version_requirements: *70256246804980
         | 
| 25 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 26 | 
            +
              name: passenger
         | 
| 27 | 
            +
              requirement: &70256246804200 !ruby/object:Gem::Requirement
         | 
| 31 28 | 
             
                none: false
         | 
| 32 | 
            -
                requirements: | 
| 33 | 
            -
                - -  | 
| 34 | 
            -
                  - !ruby/object:Gem::Version | 
| 35 | 
            -
                    version:  | 
| 29 | 
            +
                requirements:
         | 
| 30 | 
            +
                - - ! '>='
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: '3.0'
         | 
| 36 33 | 
             
              type: :runtime
         | 
| 37 | 
            -
              version_requirements: *id002
         | 
| 38 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 39 | 
            -
              name: launchy
         | 
| 40 34 | 
             
              prerelease: false
         | 
| 41 | 
            -
               | 
| 35 | 
            +
              version_requirements: *70256246804200
         | 
| 36 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 37 | 
            +
              name: launchy
         | 
| 38 | 
            +
              requirement: &70256246803720 !ruby/object:Gem::Requirement
         | 
| 42 39 | 
             
                none: false
         | 
| 43 | 
            -
                requirements: | 
| 44 | 
            -
                - -  | 
| 45 | 
            -
                  - !ruby/object:Gem::Version | 
| 40 | 
            +
                requirements:
         | 
| 41 | 
            +
                - - ! '>='
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 46 43 | 
             
                    version: 0.4.0
         | 
| 47 44 | 
             
              type: :runtime
         | 
| 48 | 
            -
               | 
| 45 | 
            +
              prerelease: false
         | 
| 46 | 
            +
              version_requirements: *70256246803720
         | 
| 49 47 | 
             
            description: A thin wrapper around Passenger Standalone.
         | 
| 50 | 
            -
            email: | 
| 48 | 
            +
            email:
         | 
| 51 49 | 
             
            - mdub@dogbiscuit.org
         | 
| 52 | 
            -
            executables: | 
| 50 | 
            +
            executables:
         | 
| 53 51 | 
             
            - p1
         | 
| 54 52 | 
             
            - platform1
         | 
| 55 53 | 
             
            extensions: []
         | 
| 56 | 
            -
             | 
| 57 54 | 
             
            extra_rdoc_files: []
         | 
| 58 | 
            -
             | 
| 59 | 
            -
            files: 
         | 
| 55 | 
            +
            files:
         | 
| 60 56 | 
             
            - .gitignore
         | 
| 61 57 | 
             
            - Gemfile
         | 
| 62 58 | 
             
            - Rakefile
         | 
| 63 59 | 
             
            - bin/p1
         | 
| 64 60 | 
             
            - bin/platform1
         | 
| 65 61 | 
             
            - platform1.gemspec
         | 
| 66 | 
            -
            has_rdoc: true
         | 
| 67 62 | 
             
            homepage: 
         | 
| 68 63 | 
             
            licenses: []
         | 
| 69 | 
            -
             | 
| 70 64 | 
             
            post_install_message: 
         | 
| 71 65 | 
             
            rdoc_options: []
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            require_paths: 
         | 
| 66 | 
            +
            require_paths:
         | 
| 74 67 | 
             
            - lib
         | 
| 75 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement | 
| 68 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 76 69 | 
             
              none: false
         | 
| 77 | 
            -
              requirements: | 
| 78 | 
            -
              - -  | 
| 79 | 
            -
                - !ruby/object:Gem::Version | 
| 80 | 
            -
                  version:  | 
| 81 | 
            -
            required_rubygems_version: !ruby/object:Gem::Requirement | 
| 70 | 
            +
              requirements:
         | 
| 71 | 
            +
              - - ! '>='
         | 
| 72 | 
            +
                - !ruby/object:Gem::Version
         | 
| 73 | 
            +
                  version: '0'
         | 
| 74 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 82 75 | 
             
              none: false
         | 
| 83 | 
            -
              requirements: | 
| 84 | 
            -
              - -  | 
| 85 | 
            -
                - !ruby/object:Gem::Version | 
| 86 | 
            -
                  version:  | 
| 76 | 
            +
              requirements:
         | 
| 77 | 
            +
              - - ! '>='
         | 
| 78 | 
            +
                - !ruby/object:Gem::Version
         | 
| 79 | 
            +
                  version: '0'
         | 
| 87 80 | 
             
            requirements: []
         | 
| 88 | 
            -
             | 
| 89 81 | 
             
            rubyforge_project: 
         | 
| 90 | 
            -
            rubygems_version: 1. | 
| 82 | 
            +
            rubygems_version: 1.8.11
         | 
| 91 83 | 
             
            signing_key: 
         | 
| 92 84 | 
             
            specification_version: 3
         | 
| 93 85 | 
             
            summary: Simple and speedy Rails/Rack development server.
         | 
| 94 86 | 
             
            test_files: []
         | 
| 95 | 
            -
             |