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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44864b502a6e4c37ef283541b945300de0d186a7
4
- data.tar.gz: 640c8dd70f585bf16967301ca83ed456794ba356
3
+ metadata.gz: 6994ddf848e3fa7ce75627b5fb3b89b69e216900
4
+ data.tar.gz: 81b558810bc9f19cf6e88d27134a731c83edaa6d
5
5
  SHA512:
6
- metadata.gz: 468471fb84c2f856da845a6bef533fed175cd93a3d78b1d2c66b6e1cdadbf7ac51b509a282db2137cb12cef1322691c071d0681415c9034599ea800d5e23c159
7
- data.tar.gz: 8d0f47609687bd9a14c684a4d7067b59e96b3da419e78364c04298ccc0c8a0bec9cac39a5fd752de3fe17add555e94d2967a2a2411dec82506ffe83b9093a296
6
+ metadata.gz: 3d63e82e700fc536d1e76e2e5fbc3f81a4f89cea48a88db086d4cc43f9c7f865f67d35a3c777b2322b86f2cff180aeef2035e93017be63b6561973384980fca9
7
+ data.tar.gz: e593c21b2f388a05ab0e9a2b6fc38d6f8801b83afbc48a26b8a942eb82eccb8af29926248c56e3b9ecc39459cfc42a1fbec10e346891183ed8b8f520610985fb
data/README.md CHANGED
@@ -27,7 +27,7 @@ Start server for sample RSS feed (http://localhost:20075/feed.xml):
27
27
  Or
28
28
 
29
29
  ```ruby
30
- require "feedcellar/test/command"
30
+ require "feedcellar/test/server"
31
31
 
32
32
  server = Feedcellar::Test::Server.new
33
33
  server.start
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
- task :default => :spec
2
+
3
+ desc "Run test"
4
+ task :test do
5
+ Bundler::GemHelper.install_tasks
6
+ ruby("test/run-test.rb")
7
+ end
8
+
9
+ task :default => :test
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "thor"
22
22
 
23
+ spec.add_development_dependency "faraday"
23
24
  spec.add_development_dependency "bundler", "~> 1.11"
24
25
  spec.add_development_dependency "rake", "~> 10.0"
25
26
  end
@@ -1,56 +1,8 @@
1
1
  require "thor"
2
- require "webrick"
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
@@ -1,5 +1,5 @@
1
1
  module Feedcellar
2
2
  module Test
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,2 +1,3 @@
1
1
  require "feedcellar/test/feed"
2
+ require "feedcellar/test/server"
2
3
  require "feedcellar/test/version"
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.0
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: []