feedcellar-test 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/feedcellar-test +5 -0
- data/feedcellar-test.gemspec +25 -0
- data/lib/feedcellar/test/command.rb +65 -0
- data/lib/feedcellar/test/config.rb +6 -0
- data/lib/feedcellar/test/feed.rb +32 -0
- data/lib/feedcellar/test/version.rb +5 -0
- data/lib/feedcellar/test.rb +2 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 44864b502a6e4c37ef283541b945300de0d186a7
|
4
|
+
data.tar.gz: 640c8dd70f585bf16967301ca83ed456794ba356
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 468471fb84c2f856da845a6bef533fed175cd93a3d78b1d2c66b6e1cdadbf7ac51b509a282db2137cb12cef1322691c071d0681415c9034599ea800d5e23c159
|
7
|
+
data.tar.gz: 8d0f47609687bd9a14c684a4d7067b59e96b3da419e78364c04298ccc0c8a0bec9cac39a5fd752de3fe17add555e94d2967a2a2411dec82506ffe83b9093a296
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# feedcellar-test
|
2
|
+
|
3
|
+
A testing tool for [Feedcellar](http://myokoym.net/feedcellar).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'feedcellar-test'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install feedcellar-test
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Start server for sample RSS feed (http://localhost:20075/feed.xml):
|
24
|
+
|
25
|
+
$ feedcellar-test server start
|
26
|
+
|
27
|
+
Or
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require "feedcellar/test/command"
|
31
|
+
|
32
|
+
server = Feedcellar::Test::Server.new
|
33
|
+
server.start
|
34
|
+
# use http://localhost:20075/feed.xml
|
35
|
+
server.stop
|
36
|
+
```
|
37
|
+
|
38
|
+
## Development
|
39
|
+
|
40
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
41
|
+
|
42
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/feedcellar/feedcellar-test.
|
47
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "feedcellar/test"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/feedcellar-test
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'feedcellar/test/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "feedcellar-test"
|
8
|
+
spec.version = Feedcellar::Test::VERSION
|
9
|
+
spec.authors = ["Masafumi Yokoyama"]
|
10
|
+
spec.email = ["myokoym@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A tesing tools for Feedcellar.}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/feedcellar/feedcellar-test"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "thor"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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
|
+
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
|
+
class Command < Thor
|
55
|
+
map "-v" => :version
|
56
|
+
|
57
|
+
register(Server, "server", "server start/stop", "server commands.")
|
58
|
+
|
59
|
+
desc "version", "Show version number."
|
60
|
+
def version
|
61
|
+
puts Feedcellar::VERSION
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "rss"
|
2
|
+
require "feedcellar/test/config"
|
3
|
+
|
4
|
+
module Feedcellar
|
5
|
+
module Test
|
6
|
+
class Feed
|
7
|
+
def self.make
|
8
|
+
rss = RSS::Maker.make("2.0") do |maker|
|
9
|
+
maker.channel.about = File.join(BASE_URL, "feed.xml")
|
10
|
+
maker.channel.title = "Feedcellar Test"
|
11
|
+
maker.channel.description = "Test Site"
|
12
|
+
maker.channel.link = BASE_URL
|
13
|
+
|
14
|
+
1.upto(3) do |i|
|
15
|
+
item = maker.items.new_item
|
16
|
+
item.link = File.join(BASE_URL, "article#{i}.html")
|
17
|
+
item.title = "Sample Article #{i}"
|
18
|
+
item.description = <<-DESCRIPTION
|
19
|
+
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?'
|
20
|
+
|
21
|
+
So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
|
22
|
+
DESCRIPTION
|
23
|
+
item.date = Time.parse("2016/2/#{i} 00:00")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
rss
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: feedcellar-test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masafumi Yokoyama
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: A tesing tools for Feedcellar.
|
56
|
+
email:
|
57
|
+
- myokoym@gmail.com
|
58
|
+
executables:
|
59
|
+
- feedcellar-test
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- exe/feedcellar-test
|
70
|
+
- feedcellar-test.gemspec
|
71
|
+
- lib/feedcellar/test.rb
|
72
|
+
- lib/feedcellar/test/command.rb
|
73
|
+
- lib/feedcellar/test/config.rb
|
74
|
+
- lib/feedcellar/test/feed.rb
|
75
|
+
- lib/feedcellar/test/version.rb
|
76
|
+
homepage: https://github.com/feedcellar/feedcellar-test
|
77
|
+
licenses: []
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.5.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: A tesing tools for Feedcellar.
|
99
|
+
test_files: []
|
100
|
+
has_rdoc:
|