feedcellar-test 0.1.1 → 0.1.2

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: 6994ddf848e3fa7ce75627b5fb3b89b69e216900
4
- data.tar.gz: 81b558810bc9f19cf6e88d27134a731c83edaa6d
3
+ metadata.gz: f8973226860c036022307054b5154158bbb3c044
4
+ data.tar.gz: d91dcdfd7a5cd064c402622cf5264b69d81898f7
5
5
  SHA512:
6
- metadata.gz: 3d63e82e700fc536d1e76e2e5fbc3f81a4f89cea48a88db086d4cc43f9c7f865f67d35a3c777b2322b86f2cff180aeef2035e93017be63b6561973384980fca9
7
- data.tar.gz: e593c21b2f388a05ab0e9a2b6fc38d6f8801b83afbc48a26b8a942eb82eccb8af29926248c56e3b9ecc39459cfc42a1fbec10e346891183ed8b8f520610985fb
6
+ metadata.gz: 7cf4211ab69c9ed6e93de2408a52b60ab689c184e504843566e08083599faaa93b57579084583df1fdbc54c5d717a70977b1f7fd6bb9ac0ccd1692a8fef89bb1
7
+ data.tar.gz: a6ce25408d5ae4f6237497af5ea53be4e311f4dba1dd7a9cbad92be0a01966317e0493a2a7ad7844d234d746e37fdddff753fe48434dcf27a2c1b110f77db2be
data/README.md CHANGED
@@ -22,14 +22,14 @@ Or install it yourself as:
22
22
 
23
23
  Start server for sample RSS feed (http://localhost:20075/feed.xml):
24
24
 
25
- $ feedcellar-test server start
25
+ $ feedcellar-test server start --port 20075
26
26
 
27
27
  Or
28
28
 
29
29
  ```ruby
30
30
  require "feedcellar/test/server"
31
31
 
32
- server = Feedcellar::Test::Server.new
32
+ server = Feedcellar::Test::Server.new(port: 20075)
33
33
  server.start
34
34
  # use http://localhost:20075/feed.xml
35
35
  server.stop
@@ -21,6 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "thor"
22
22
 
23
23
  spec.add_development_dependency "faraday"
24
+ spec.add_development_dependency "test-unit"
25
+ spec.add_development_dependency "test-unit-notify"
26
+ spec.add_development_dependency "test-unit-rr"
24
27
  spec.add_development_dependency "bundler", "~> 1.11"
25
28
  spec.add_development_dependency "rake", "~> 10.0"
26
29
  end
@@ -6,7 +6,12 @@ module Feedcellar
6
6
  class Command < Thor
7
7
  map "-v" => :version
8
8
 
9
- register(Server, "server", "server start/stop", "server commands.")
9
+ desc "start", "Start server."
10
+ option :port, :type => :string, :desc => "Lock port number"
11
+ def start
12
+ server = Server.new(options)
13
+ server.start
14
+ end
10
15
 
11
16
  desc "version", "Show version number."
12
17
  def version
@@ -1,19 +1,18 @@
1
1
  require "rss"
2
- require "feedcellar/test/config"
3
2
 
4
3
  module Feedcellar
5
4
  module Test
6
5
  class Feed
7
- def self.make
6
+ def self.make(base_url)
8
7
  rss = RSS::Maker.make("2.0") do |maker|
9
- maker.channel.about = File.join(BASE_URL, "feed.xml")
8
+ maker.channel.about = File.join(base_url, "feed.xml")
10
9
  maker.channel.title = "Feedcellar Test"
11
10
  maker.channel.description = "Test Site"
12
- maker.channel.link = BASE_URL
11
+ maker.channel.link = base_url
13
12
 
14
13
  1.upto(3) do |i|
15
14
  item = maker.items.new_item
16
- item.link = File.join(BASE_URL, "article#{i}.html")
15
+ item.link = File.join(base_url, "article#{i}.html")
17
16
  item.title = "Sample Article #{i}"
18
17
  item.description = <<-DESCRIPTION
19
18
  Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?'
@@ -1,25 +1,25 @@
1
1
  require "thor"
2
2
  require "webrick"
3
3
  require "tmpdir"
4
- require "feedcellar/test/config"
5
4
  require "feedcellar/test/feed"
6
5
 
7
6
  module Feedcellar
8
7
  module Test
9
- class Server < Thor
10
- def initialize(*args)
11
- super
8
+ class Server
9
+ attr_reader :port, :base_url
10
+ def initialize(options={})
12
11
  @tmpdir = Dir.mktmpdir("feedcellar-test")
12
+ @port = options[:port] || 20000 + rand(5000)
13
+ @base_url = "http://localhost:#{@port}"
13
14
  File.write(File.join(@tmpdir, "feed.xml"),
14
- Feed.make)
15
+ Feed.make(@base_url))
15
16
  end
16
17
 
17
- desc "server start", "Start server."
18
18
  def start
19
19
  config = {
20
20
  :DocumentRoot => './',
21
21
  :BindAddress => '127.0.0.1',
22
- :Port => PORT,
22
+ :Port => @port,
23
23
  }
24
24
 
25
25
  srv_proc = lambda do
@@ -43,7 +43,6 @@ module Feedcellar
43
43
  end
44
44
  end
45
45
 
46
- desc "server stop", "Stop server."
47
46
  def stop
48
47
  if @server && @server.alive?
49
48
  @server.kill
@@ -1,5 +1,5 @@
1
1
  module Feedcellar
2
2
  module Test
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedcellar-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-07 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit-notify
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: test-unit-rr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: bundler
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +126,6 @@ files:
84
126
  - feedcellar-test.gemspec
85
127
  - lib/feedcellar/test.rb
86
128
  - lib/feedcellar/test/command.rb
87
- - lib/feedcellar/test/config.rb
88
129
  - lib/feedcellar/test/feed.rb
89
130
  - lib/feedcellar/test/server.rb
90
131
  - lib/feedcellar/test/version.rb
@@ -1,6 +0,0 @@
1
- module Feedcellar
2
- module Test
3
- PORT = 20075
4
- BASE_URL = "http://localhost:#{PORT}"
5
- end
6
- end