feedcellar-test 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +8 -1
- data/feedcellar-test.gemspec +1 -0
- data/lib/feedcellar/test/command.rb +1 -49
- data/lib/feedcellar/test/server.rb +57 -0
- data/lib/feedcellar/test/version.rb +1 -1
- data/lib/feedcellar/test.rb +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6994ddf848e3fa7ce75627b5fb3b89b69e216900
|
4
|
+
data.tar.gz: 81b558810bc9f19cf6e88d27134a731c83edaa6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d63e82e700fc536d1e76e2e5fbc3f81a4f89cea48a88db086d4cc43f9c7f865f67d35a3c777b2322b86f2cff180aeef2035e93017be63b6561973384980fca9
|
7
|
+
data.tar.gz: e593c21b2f388a05ab0e9a2b6fc38d6f8801b83afbc48a26b8a942eb82eccb8af29926248c56e3b9ecc39459cfc42a1fbec10e346891183ed8b8f520610985fb
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/feedcellar-test.gemspec
CHANGED
@@ -1,56 +1,8 @@
|
|
1
1
|
require "thor"
|
2
|
-
require "
|
3
|
-
require "tmpdir"
|
4
|
-
require "feedcellar/test/config"
|
5
|
-
require "feedcellar/test/feed"
|
2
|
+
require "feedcellar/test/server"
|
6
3
|
|
7
4
|
module Feedcellar
|
8
5
|
module Test
|
9
|
-
class Server < Thor
|
10
|
-
def initialize(*args)
|
11
|
-
super
|
12
|
-
@tmpdir = Dir.mktmpdir("feedcellar-test")
|
13
|
-
File.write(File.join(@tmpdir, "feed.xml"),
|
14
|
-
Feed.make)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "server start", "Start server."
|
18
|
-
def start
|
19
|
-
srv_proc = lambda do
|
20
|
-
config = {
|
21
|
-
:DocumentRoot => './',
|
22
|
-
:BindAddress => '127.0.0.1',
|
23
|
-
:Port => PORT,
|
24
|
-
}
|
25
|
-
Dir.chdir(@tmpdir) do
|
26
|
-
srv = WEBrick::HTTPServer.new(config)
|
27
|
-
trap("INT") { srv.shutdown }
|
28
|
-
srv.start
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if File.basename($0) == "feedcellar-test"
|
33
|
-
srv_proc.call
|
34
|
-
else
|
35
|
-
if @server && @server.alive?
|
36
|
-
$stderr.puts("Server is still running.")
|
37
|
-
return false
|
38
|
-
end
|
39
|
-
@server = Thread.start(&srv_proc)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "server stop", "Stop server."
|
44
|
-
def stop
|
45
|
-
if @server && @server.alive?
|
46
|
-
@server.kill
|
47
|
-
else
|
48
|
-
$stderr.puts("Server is not run.")
|
49
|
-
return false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
6
|
class Command < Thor
|
55
7
|
map "-v" => :version
|
56
8
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "webrick"
|
3
|
+
require "tmpdir"
|
4
|
+
require "feedcellar/test/config"
|
5
|
+
require "feedcellar/test/feed"
|
6
|
+
|
7
|
+
module Feedcellar
|
8
|
+
module Test
|
9
|
+
class Server < Thor
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
@tmpdir = Dir.mktmpdir("feedcellar-test")
|
13
|
+
File.write(File.join(@tmpdir, "feed.xml"),
|
14
|
+
Feed.make)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "server start", "Start server."
|
18
|
+
def start
|
19
|
+
config = {
|
20
|
+
:DocumentRoot => './',
|
21
|
+
:BindAddress => '127.0.0.1',
|
22
|
+
:Port => PORT,
|
23
|
+
}
|
24
|
+
|
25
|
+
srv_proc = lambda do
|
26
|
+
Dir.chdir(@tmpdir) do
|
27
|
+
srv = WEBrick::HTTPServer.new(config)
|
28
|
+
trap("INT") { srv.shutdown }
|
29
|
+
srv.start
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if File.basename($0) == "feedcellar-test"
|
34
|
+
srv_proc.call
|
35
|
+
else
|
36
|
+
if @server && @server.alive?
|
37
|
+
$stderr.puts("Server is still running.")
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
config[:Logger] = WEBrick::Log.new(File.open(File::NULL, "w"))
|
41
|
+
config[:AccessLog] = []
|
42
|
+
@server = Thread.start(&srv_proc)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "server stop", "Stop server."
|
47
|
+
def stop
|
48
|
+
if @server && @server.alive?
|
49
|
+
@server.kill
|
50
|
+
else
|
51
|
+
$stderr.puts("Server is not run.")
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/feedcellar/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedcellar-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +86,7 @@ files:
|
|
72
86
|
- lib/feedcellar/test/command.rb
|
73
87
|
- lib/feedcellar/test/config.rb
|
74
88
|
- lib/feedcellar/test/feed.rb
|
89
|
+
- lib/feedcellar/test/server.rb
|
75
90
|
- lib/feedcellar/test/version.rb
|
76
91
|
homepage: https://github.com/feedcellar/feedcellar-test
|
77
92
|
licenses: []
|