guard-webrick 0.1.1 → 0.1.2
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/.travis.yml +7 -2
- data/CHANGELOG.md +26 -3
- data/Gemfile +8 -0
- data/README.md +2 -1
- data/guard-webrick.gemspec +3 -5
- data/lib/guard/webrick/server.rb +18 -6
- data/lib/guard/webrick/version.rb +1 -1
- data/lib/guard/webrick.rb +4 -1
- data/spec/guard/webrick/server_spec.rb +11 -0
- data/spec/guard/webrick_spec.rb +27 -4
- metadata +38 -71
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,31 @@
|
|
1
|
-
## 0.1.
|
1
|
+
## 0.1.3.dev (unreleased)
|
2
|
+
|
3
|
+
|
4
|
+
## 0.1.2 (May 10, 2012)
|
5
|
+
|
6
|
+
### New features
|
7
|
+
|
8
|
+
* Pull request [#1](https://github.com/fnichol/guard-webrick/pull/1): SSL support. ([@JustinLove][])
|
9
|
+
|
10
|
+
### Improvements
|
11
|
+
|
12
|
+
* Fill out Ruby testing on TravisCI. ([@fnichol][])
|
13
|
+
|
14
|
+
|
15
|
+
## 0.1.1 (May 17, 2011)
|
16
|
+
|
17
|
+
### Bug fixes
|
18
|
+
|
19
|
+
* Add missing launch gem dependency ([@fnichol][])
|
20
|
+
|
21
|
+
### Improvements
|
22
|
+
|
23
|
+
* Add project to travis-ci.org ([@fnichol][])
|
2
24
|
|
3
|
-
* Add project to travis-ci.org
|
4
|
-
* Add missing launch gem dependency
|
5
25
|
|
6
26
|
## 0.1.0 (Mar 19, 2011)
|
7
27
|
|
8
28
|
Initial release.
|
29
|
+
|
30
|
+
[@fnichol]: https://github.com/fnichol
|
31
|
+
[@JustinLove]: https://github.com/JustinLove
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Guard::WEBrick automatically starts and restarts WEBrick when needed. Useful when you are working on a static site but want to benefit from [Guard::LiveReload](http://github.com/guard/guard-livereload).
|
6
6
|
|
7
|
-
* Tested on Ruby 1.
|
7
|
+
* Tested on Ruby 1.9.3, 1.9.2, 1.8.7, Ruby Enterprise Edition, and JRuby (thanks TravisCI!)
|
8
8
|
|
9
9
|
## Install
|
10
10
|
|
@@ -46,6 +46,7 @@ Available options:
|
|
46
46
|
|
47
47
|
:host => '127.3.3.1' # default '0.0.0.0'
|
48
48
|
:port => '12345' # default '3000'
|
49
|
+
:ssl => true # default false
|
49
50
|
:docroot => 'public' # default current working directory
|
50
51
|
:launchy => false # default true
|
51
52
|
|
data/guard-webrick.gemspec
CHANGED
@@ -15,14 +15,12 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.required_rubygems_version = '>= 1.3.6'
|
16
16
|
s.rubyforge_project = "guard-webrick"
|
17
17
|
|
18
|
-
s.add_dependency 'guard', '~> 0.
|
19
|
-
s.add_dependency 'ffi', '~> 1.0.7'
|
18
|
+
s.add_dependency 'guard', '~> 1.0.2'
|
20
19
|
s.add_dependency 'spoon', '~> 0.0.1'
|
21
|
-
s.add_dependency 'launchy', '~>
|
20
|
+
s.add_dependency 'launchy', '~> 2.1.0'
|
22
21
|
|
23
|
-
s.add_development_dependency 'bundler', '~> 1.0.10'
|
24
22
|
s.add_development_dependency 'rspec', '~> 2.5.0'
|
25
|
-
s.add_development_dependency 'guard-rspec', '~> 0.
|
23
|
+
s.add_development_dependency 'guard-rspec', '~> 0.7.0'
|
26
24
|
s.add_development_dependency 'guard-bundler', '~> 0.1.1'
|
27
25
|
|
28
26
|
s.files = `git ls-files`.split("\n")
|
data/lib/guard/webrick/server.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'webrick'
|
2
|
+
require 'webrick/https'
|
2
3
|
|
3
4
|
module Guard
|
4
5
|
class WEBrick
|
@@ -7,11 +8,21 @@ module Guard
|
|
7
8
|
attr_reader :server
|
8
9
|
|
9
10
|
def initialize(options = {})
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
if options[:ssl]
|
12
|
+
@server = ::WEBrick::HTTPServer.new(
|
13
|
+
:BindAddress => options[:host],
|
14
|
+
:Port => options[:port],
|
15
|
+
:DocumentRoot => File.expand_path(options[:docroot]),
|
16
|
+
:SSLEnable => true,
|
17
|
+
:SSLCertName => [%w[CN localhost]]
|
18
|
+
)
|
19
|
+
else
|
20
|
+
@server = ::WEBrick::HTTPServer.new(
|
21
|
+
:BindAddress => options[:host],
|
22
|
+
:Port => options[:port],
|
23
|
+
:DocumentRoot => File.expand_path(options[:docroot])
|
24
|
+
)
|
25
|
+
end
|
15
26
|
end
|
16
27
|
|
17
28
|
def start
|
@@ -25,10 +36,11 @@ module Guard
|
|
25
36
|
end
|
26
37
|
|
27
38
|
if __FILE__ == $0
|
28
|
-
host, port, docroot = ARGV
|
39
|
+
host, port, ssl, docroot = ARGV
|
29
40
|
Guard::WEBrick::Server.new(
|
30
41
|
:host => host,
|
31
42
|
:port => port,
|
43
|
+
:ssl => ssl == 'true',
|
32
44
|
:docroot => docroot
|
33
45
|
).start
|
34
46
|
end
|
data/lib/guard/webrick.rb
CHANGED
@@ -15,6 +15,7 @@ module Guard
|
|
15
15
|
@options = {
|
16
16
|
:host => '0.0.0.0',
|
17
17
|
:port => 3000,
|
18
|
+
:ssl => false,
|
18
19
|
:docroot => Dir::pwd,
|
19
20
|
:launchy => true
|
20
21
|
}.update(options)
|
@@ -35,11 +36,13 @@ module Guard
|
|
35
36
|
File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),
|
36
37
|
@options[:host],
|
37
38
|
@options[:port].to_s,
|
39
|
+
@options[:ssl].to_s,
|
38
40
|
@options[:docroot]
|
39
41
|
)
|
40
42
|
wait_for_port
|
41
43
|
if @options[:launchy]
|
42
|
-
|
44
|
+
scheme = options[:ssl] ? "https" : "http"
|
45
|
+
Launchy.open("#{scheme}://#{@options[:host]}:#{@options[:port]}")
|
43
46
|
@options[:launchy] = false # only run once
|
44
47
|
end
|
45
48
|
@pid
|
@@ -22,6 +22,17 @@ describe Guard::WEBrick::Server do
|
|
22
22
|
)
|
23
23
|
new_server(:docroot => 'public')
|
24
24
|
end
|
25
|
+
|
26
|
+
it "should create an ssl server" do
|
27
|
+
::WEBrick::HTTPServer.should_receive(:new).with(
|
28
|
+
:BindAddress => '0.0.0.0',
|
29
|
+
:Port => 3000,
|
30
|
+
:DocumentRoot => Dir::pwd,
|
31
|
+
:SSLEnable => true,
|
32
|
+
:SSLCertName => [%w[CN localhost]]
|
33
|
+
)
|
34
|
+
new_server(:ssl => true)
|
35
|
+
end
|
25
36
|
end
|
26
37
|
|
27
38
|
describe "start" do
|
data/spec/guard/webrick_spec.rb
CHANGED
@@ -35,6 +35,19 @@ describe Guard::WEBrick do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe "ssl" do
|
39
|
+
|
40
|
+
it "should be false by default" do
|
41
|
+
subject = Guard::WEBrick.new([])
|
42
|
+
subject.options[:ssl].should be_false
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be set to true" do
|
46
|
+
subject = Guard::WEBrick.new([], { :ssl => true })
|
47
|
+
subject.options[:ssl].should be_true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
38
51
|
describe "docroot" do
|
39
52
|
|
40
53
|
it "should be Dir::pwd by default" do
|
@@ -70,13 +83,16 @@ describe Guard::WEBrick do
|
|
70
83
|
end
|
71
84
|
|
72
85
|
it "should spawn the server instance" do
|
73
|
-
subject = Guard::WEBrick.new([], {
|
86
|
+
subject = Guard::WEBrick.new([], {
|
87
|
+
:host => '127.0.2.5',
|
88
|
+
:port => 8080,
|
89
|
+
:ssl => true,
|
74
90
|
:docroot => '/tmp' })
|
75
91
|
subject.stub(:wait_for_port)
|
76
92
|
Spoon.should_receive(:spawnp).with( 'ruby',
|
77
93
|
File.expand_path(File.join(File.dirname(__FILE__),
|
78
94
|
%w{.. .. lib guard webrick server.rb})),
|
79
|
-
'127.0.2.5', '8080', '/tmp'
|
95
|
+
'127.0.2.5', '8080', 'true', '/tmp'
|
80
96
|
)
|
81
97
|
subject.start
|
82
98
|
end
|
@@ -85,7 +101,7 @@ describe Guard::WEBrick do
|
|
85
101
|
Spoon.should_receive(:spawnp).with( 'ruby',
|
86
102
|
File.expand_path(File.join(File.dirname(__FILE__),
|
87
103
|
%w{.. .. lib guard webrick server.rb})),
|
88
|
-
'0.0.0.0', '3000', Dir::pwd
|
104
|
+
'0.0.0.0', '3000', 'false', Dir::pwd
|
89
105
|
)
|
90
106
|
subject.start
|
91
107
|
end
|
@@ -107,11 +123,18 @@ describe Guard::WEBrick do
|
|
107
123
|
subject.start
|
108
124
|
end
|
109
125
|
|
110
|
-
it "should open
|
126
|
+
it "should open an HTTP web browser page" do
|
111
127
|
Launchy.should_receive(:open).with("http://0.0.0.0:3000")
|
112
128
|
subject.start
|
113
129
|
end
|
114
130
|
|
131
|
+
it "should open an HTTPS web browser page" do
|
132
|
+
Launchy.should_receive(:open).with("https://0.0.0.0:3000")
|
133
|
+
subject = Guard::WEBrick.new([], { :ssl => true })
|
134
|
+
subject.stub(:wait_for_port)
|
135
|
+
subject.start
|
136
|
+
end
|
137
|
+
|
115
138
|
it "should not open a web browser if disabled" do
|
116
139
|
subject = Guard::WEBrick.new([], { :launchy => false })
|
117
140
|
subject.stub(:wait_for_port)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-webrick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Fletcher Nichol
|
@@ -15,44 +15,26 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-05-11 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 3
|
33
|
-
version: "0.3"
|
34
|
-
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: ffi
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 25
|
26
|
+
hash: 19
|
45
27
|
segments:
|
46
28
|
- 1
|
47
29
|
- 0
|
48
|
-
-
|
49
|
-
version: 1.0.
|
30
|
+
- 2
|
31
|
+
version: 1.0.2
|
32
|
+
prerelease: false
|
33
|
+
requirement: *id001
|
50
34
|
type: :runtime
|
51
|
-
|
35
|
+
name: guard
|
52
36
|
- !ruby/object:Gem::Dependency
|
53
|
-
|
54
|
-
prerelease: false
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
56
38
|
none: false
|
57
39
|
requirements:
|
58
40
|
- - ~>
|
@@ -63,44 +45,28 @@ dependencies:
|
|
63
45
|
- 0
|
64
46
|
- 1
|
65
47
|
version: 0.0.1
|
66
|
-
type: :runtime
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: launchy
|
70
48
|
prerelease: false
|
71
|
-
requirement:
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 15
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
- 4
|
80
|
-
- 0
|
81
|
-
version: 0.4.0
|
49
|
+
requirement: *id002
|
82
50
|
type: :runtime
|
83
|
-
|
51
|
+
name: spoon
|
84
52
|
- !ruby/object:Gem::Dependency
|
85
|
-
|
86
|
-
prerelease: false
|
87
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
88
54
|
none: false
|
89
55
|
requirements:
|
90
56
|
- - ~>
|
91
57
|
- !ruby/object:Gem::Version
|
92
|
-
hash:
|
58
|
+
hash: 11
|
93
59
|
segments:
|
60
|
+
- 2
|
94
61
|
- 1
|
95
62
|
- 0
|
96
|
-
|
97
|
-
version: 1.0.10
|
98
|
-
type: :development
|
99
|
-
version_requirements: *id005
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: rspec
|
63
|
+
version: 2.1.0
|
102
64
|
prerelease: false
|
103
|
-
requirement:
|
65
|
+
requirement: *id003
|
66
|
+
type: :runtime
|
67
|
+
name: launchy
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
104
70
|
none: false
|
105
71
|
requirements:
|
106
72
|
- - ~>
|
@@ -111,28 +77,28 @@ dependencies:
|
|
111
77
|
- 5
|
112
78
|
- 0
|
113
79
|
version: 2.5.0
|
80
|
+
prerelease: false
|
81
|
+
requirement: *id004
|
114
82
|
type: :development
|
115
|
-
|
83
|
+
name: rspec
|
116
84
|
- !ruby/object:Gem::Dependency
|
117
|
-
|
118
|
-
prerelease: false
|
119
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
120
86
|
none: false
|
121
87
|
requirements:
|
122
88
|
- - ~>
|
123
89
|
- !ruby/object:Gem::Version
|
124
|
-
hash:
|
90
|
+
hash: 3
|
125
91
|
segments:
|
126
92
|
- 0
|
127
|
-
-
|
93
|
+
- 7
|
128
94
|
- 0
|
129
|
-
version: 0.
|
95
|
+
version: 0.7.0
|
96
|
+
prerelease: false
|
97
|
+
requirement: *id005
|
130
98
|
type: :development
|
131
|
-
|
99
|
+
name: guard-rspec
|
132
100
|
- !ruby/object:Gem::Dependency
|
133
|
-
|
134
|
-
prerelease: false
|
135
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
136
102
|
none: false
|
137
103
|
requirements:
|
138
104
|
- - ~>
|
@@ -143,8 +109,10 @@ dependencies:
|
|
143
109
|
- 1
|
144
110
|
- 1
|
145
111
|
version: 0.1.1
|
112
|
+
prerelease: false
|
113
|
+
requirement: *id006
|
146
114
|
type: :development
|
147
|
-
|
115
|
+
name: guard-bundler
|
148
116
|
description: Guard::WEBrick automatically starts and restarts WEBrick when needed.
|
149
117
|
email:
|
150
118
|
- fnichol@nichol.ca
|
@@ -171,7 +139,6 @@ files:
|
|
171
139
|
- spec/guard/webrick/server_spec.rb
|
172
140
|
- spec/guard/webrick_spec.rb
|
173
141
|
- spec/spec_helper.rb
|
174
|
-
has_rdoc: true
|
175
142
|
homepage: http://rubygems.org/gems/guard-webrick
|
176
143
|
licenses: []
|
177
144
|
|
@@ -203,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
170
|
requirements: []
|
204
171
|
|
205
172
|
rubyforge_project: guard-webrick
|
206
|
-
rubygems_version: 1.
|
173
|
+
rubygems_version: 1.8.17
|
207
174
|
signing_key:
|
208
175
|
specification_version: 3
|
209
176
|
summary: Guard gem for WEBrick
|