platform1 0.0.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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/bin/p1 +106 -0
- data/platform1.gemspec +25 -0
- metadata +93 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/p1
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'clamp'
|
4
|
+
require 'launchy'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
class Platform1Command < Clamp::Command
|
9
|
+
|
10
|
+
self.description = %{
|
11
|
+
Platform1 helps you serve your Rails/Rack app using Passenger Standalone.
|
12
|
+
}
|
13
|
+
|
14
|
+
subcommand "init", "Prepare to serve a new app." do
|
15
|
+
|
16
|
+
self.description = %{
|
17
|
+
Configure Platform1 to serve the app in the current directory.
|
18
|
+
}
|
19
|
+
|
20
|
+
parameter "PORT", "the port to be used for this app"
|
21
|
+
|
22
|
+
def execute
|
23
|
+
update_configuration do |config|
|
24
|
+
config["port"] = port
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
subcommand "start", "Start Passenger Standalone." do
|
31
|
+
|
32
|
+
def execute
|
33
|
+
sh("passenger start -p #{passenger_port} -d")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
subcommand "stop", "Stop Passenger Standalone." do
|
39
|
+
|
40
|
+
def execute
|
41
|
+
sh("passenger stop -p #{passenger_port}")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
subcommand "status", "Show Passenger status." do
|
47
|
+
|
48
|
+
def execute
|
49
|
+
sh("passenger status -p #{passenger_port}")
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
subcommand "open", "Open app in a browser." do
|
55
|
+
|
56
|
+
def execute
|
57
|
+
Launchy.open(application_url)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
subcommand "restart", "Ask app to restart" do
|
63
|
+
|
64
|
+
def execute
|
65
|
+
FileUtils.touch("tmp/restart.txt")
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def passenger_port
|
73
|
+
configuration["port"] || signal_usage_error("port not defined: please run 'init' first")
|
74
|
+
end
|
75
|
+
|
76
|
+
def application_url
|
77
|
+
"http://localhost:#{passenger_port}/"
|
78
|
+
end
|
79
|
+
|
80
|
+
def sh(command)
|
81
|
+
system(command) || raise("Error running: #{command.inspect}")
|
82
|
+
end
|
83
|
+
|
84
|
+
def config_file
|
85
|
+
".platform1.yml"
|
86
|
+
end
|
87
|
+
|
88
|
+
def configuration
|
89
|
+
@config ||= if File.exist?(config_file)
|
90
|
+
YAML.load_file(config_file)
|
91
|
+
else
|
92
|
+
{}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def update_configuration
|
97
|
+
config = configuration
|
98
|
+
yield config
|
99
|
+
File.open(config_file, 'w') do |out|
|
100
|
+
YAML.dump(config, out)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
Platform1Command.run
|
data/platform1.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
|
6
|
+
gem.name = "platform1"
|
7
|
+
gem.version = "0.0.1"
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
|
10
|
+
gem.authors = ["Mike Williams"]
|
11
|
+
gem.email = ["mdub@dogbiscuit.org"]
|
12
|
+
|
13
|
+
gem.summary = %q{Simple and speedy Rails/Rack development server.}
|
14
|
+
gem.description = %q{A thin wrapper around Passenger Standalone.}
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_dependency "clamp", ">= 0.1.8"
|
22
|
+
gem.add_dependency "passenger", ">= 3.0"
|
23
|
+
gem.add_dependency "launchy", ">= 0.4.0"
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: platform1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mike Williams
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-17 00:00:00 +10:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: clamp
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.1.8
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: passenger
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "3.0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: launchy
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.4.0
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
description: A thin wrapper around Passenger Standalone.
|
50
|
+
email:
|
51
|
+
- mdub@dogbiscuit.org
|
52
|
+
executables:
|
53
|
+
- p1
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- Rakefile
|
62
|
+
- bin/p1
|
63
|
+
- platform1.gemspec
|
64
|
+
has_rdoc: true
|
65
|
+
homepage:
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: "0"
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.6.2
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: Simple and speedy Rails/Rack development server.
|
92
|
+
test_files: []
|
93
|
+
|