cassette-rack 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +9 -0
- data/cassette-rack.gemspec +29 -0
- data/config.ru +2 -0
- data/lib/cassette-rack.rb +28 -0
- data/lib/cassette-rack/configure.rb +49 -0
- data/lib/cassette-rack/decorator/request.rb +25 -0
- data/lib/cassette-rack/decorator/response.rb +32 -0
- data/lib/cassette-rack/default.rb +25 -0
- data/lib/cassette-rack/drawer.rb +40 -0
- data/lib/cassette-rack/engine.rb +83 -0
- data/lib/cassette-rack/request.rb +45 -0
- data/lib/cassette-rack/response.rb +19 -0
- data/lib/cassette-rack/tree.rb +10 -0
- data/lib/cassette-rack/tree/branch.rb +36 -0
- data/lib/cassette-rack/tree/leaf.rb +26 -0
- data/lib/cassette-rack/version.rb +3 -0
- data/lib/templates/layouts/application.html.liquid +115 -0
- data/lib/templates/layouts/content.md.liquid +15 -0
- data/spec/grant-front_spec.rb +4 -0
- data/spec/lib/version_spec.rb +9 -0
- data/spec/spec_helper.rb +1 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 41fd94c93390feedfb4b437fe9770ada43beb1b0
|
4
|
+
data.tar.gz: 1d5bd08c1c4c656979f800d47b946c5b61a11d3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67d52b9fff5af84bcfa5f12616cd8eb5104f33bf369a87718fdb9913a358563f8b82b322ae382499d8d32f385a980db49d8b769a81b3662951af804916dd45a3
|
7
|
+
data.tar.gz: 379495c4b20ab95b3ec17efc145f0cc6194df6b34e7e61ad1da8ddd96850d2f0b5b1223fd8655c972e6025bdf8d0efc29a36a2f50a2158adb86c43e1c2c9441f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 ogom
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# CassetteRack
|
2
|
+
|
3
|
+
Operate of the VCR cassette on Rack.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'cassette-rack'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem install cassette-rack
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add this line to your `config.ru`:
|
28
|
+
|
29
|
+
```
|
30
|
+
run CassetteRack::Engine
|
31
|
+
```
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
* MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cassette-rack/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cassette-rack"
|
8
|
+
spec.version = CassetteRack::VERSION
|
9
|
+
spec.authors = ["ogom"]
|
10
|
+
spec.email = ["ogom@hotmail.co.jp"]
|
11
|
+
spec.summary = %q{Operate of the VCR cassette}
|
12
|
+
spec.description = %q{Operate of the VCR cassette on Rack}
|
13
|
+
spec.homepage = "http://ogom.github.io/cassette-rack"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'faraday'
|
22
|
+
spec.add_dependency 'kramdown'
|
23
|
+
spec.add_dependency 'liquid'
|
24
|
+
spec.add_dependency 'rack'
|
25
|
+
spec.add_dependency 'vcr'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'rake'
|
29
|
+
end
|
data/config.ru
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'liquid'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
require_relative 'cassette-rack/version'
|
5
|
+
require_relative 'cassette-rack/configure'
|
6
|
+
require_relative 'cassette-rack/default'
|
7
|
+
require_relative 'cassette-rack/engine'
|
8
|
+
require_relative 'cassette-rack/tree'
|
9
|
+
require_relative 'cassette-rack/drawer'
|
10
|
+
require_relative 'cassette-rack/request'
|
11
|
+
|
12
|
+
module CassetteRack
|
13
|
+
class << self
|
14
|
+
def configure
|
15
|
+
yield CassetteRack::Configure
|
16
|
+
end
|
17
|
+
|
18
|
+
def config
|
19
|
+
CassetteRack::Configure
|
20
|
+
end
|
21
|
+
|
22
|
+
def root
|
23
|
+
@root ||= Pathname.new(File.expand_path('..', File.dirname(__FILE__)))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
CassetteRack::Configure.setup
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
module CassetteRack
|
4
|
+
module Configure
|
5
|
+
class << self
|
6
|
+
attr_accessor :cassette_extension, :cassette_path, :url
|
7
|
+
|
8
|
+
def setup
|
9
|
+
keys.each do |key|
|
10
|
+
instance_variable_set(:"@#{key}", CassetteRack::Default.send(key))
|
11
|
+
end
|
12
|
+
|
13
|
+
FileUtils.mkdir_p(self.source_path)
|
14
|
+
|
15
|
+
VCR.configure do |config|
|
16
|
+
config.cassette_library_dir = self.source_path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def keys
|
21
|
+
@keys ||= %i[cassette_extension cassette_path url]
|
22
|
+
end
|
23
|
+
|
24
|
+
def source_path
|
25
|
+
@source_path ||= File.expand_path(self.cassette_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def templates_path
|
29
|
+
@templates_path ||= CassetteRack.root.join('lib', 'templates').to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
def application_layout
|
33
|
+
@application_layout ||= File.expand_path('application.html.liquid', File.join(self.templates_path, 'layouts'))
|
34
|
+
end
|
35
|
+
|
36
|
+
def content_layout
|
37
|
+
@content_layout ||= File.expand_path('content.md.liquid', File.join(self.templates_path, 'layouts'))
|
38
|
+
end
|
39
|
+
|
40
|
+
def application_template
|
41
|
+
File.read(self.application_layout)
|
42
|
+
end
|
43
|
+
|
44
|
+
def content_template
|
45
|
+
File.read(self.content_layout)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
module Decorator
|
3
|
+
class Request
|
4
|
+
def initialize(request)
|
5
|
+
@request = request
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_liquid
|
9
|
+
{
|
10
|
+
'method' => method,
|
11
|
+
'path' => path
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def method
|
16
|
+
@request.method.to_s.upcase
|
17
|
+
end
|
18
|
+
|
19
|
+
def path
|
20
|
+
URI.parse(@request.uri).path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
module Decorator
|
3
|
+
class Response
|
4
|
+
def initialize(response)
|
5
|
+
@response = response
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_liquid
|
9
|
+
{
|
10
|
+
'status_code' => status_code,
|
11
|
+
'status_message' => status_message,
|
12
|
+
'body' => body,
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def status_code
|
17
|
+
@response.status.code
|
18
|
+
end
|
19
|
+
|
20
|
+
def status_message
|
21
|
+
@response.status.message
|
22
|
+
end
|
23
|
+
|
24
|
+
def body
|
25
|
+
JSON.pretty_generate JSON.parse(@response.body)
|
26
|
+
rescue
|
27
|
+
@response.body
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
module Default
|
3
|
+
CASSETTE_EXTENSION = 'yml'.freeze
|
4
|
+
CASSETTE_PATH = 'spec/cassettes'.freeze
|
5
|
+
URL = 'http://localhost:3000'.freeze
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def options
|
9
|
+
Hash[CassetteRack::Configure.keys.map{|key| [key, send(key)]}]
|
10
|
+
end
|
11
|
+
|
12
|
+
def cassette_extension
|
13
|
+
CASSETTE_EXTENSION
|
14
|
+
end
|
15
|
+
|
16
|
+
def cassette_path
|
17
|
+
CASSETTE_PATH
|
18
|
+
end
|
19
|
+
|
20
|
+
def url
|
21
|
+
URL
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative 'decorator/request'
|
2
|
+
require_relative 'decorator/response'
|
3
|
+
|
4
|
+
module CassetteRack
|
5
|
+
class Drawer
|
6
|
+
attr_reader :name
|
7
|
+
|
8
|
+
def initialize(name, options={})
|
9
|
+
@name = name
|
10
|
+
end
|
11
|
+
|
12
|
+
def cassette
|
13
|
+
@cassette ||= VCR::Cassette.new(name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def render
|
17
|
+
Kramdown::Document.new(self.pull).to_html
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete
|
21
|
+
File.delete cassette.file if self.exist?
|
22
|
+
end
|
23
|
+
|
24
|
+
def exist?
|
25
|
+
File.exist?(cassette.file)
|
26
|
+
end
|
27
|
+
|
28
|
+
def pull
|
29
|
+
request = CassetteRack::Decorator::Request.new(http.request)
|
30
|
+
response = CassetteRack::Decorator::Response.new(http.response)
|
31
|
+
|
32
|
+
template = Liquid::Template.parse(CassetteRack::Configure.content_template)
|
33
|
+
template.render('title' => name, 'request' => request, 'response' => response)
|
34
|
+
end
|
35
|
+
|
36
|
+
def http
|
37
|
+
cassette.http_interactions.interactions.first
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
module CassetteRack
|
4
|
+
class Engine
|
5
|
+
def call(env)
|
6
|
+
controller(env)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def prototype
|
11
|
+
@prototype ||= new
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
prototype.call(env)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def controller(env)
|
21
|
+
request = Rack::Request.new(env)
|
22
|
+
drawer = CassetteRack::Drawer.new(request.path_info)
|
23
|
+
|
24
|
+
case request.request_method
|
25
|
+
when 'DELETE'
|
26
|
+
drawer.delete
|
27
|
+
end
|
28
|
+
|
29
|
+
tree = CassetteRack::Tree.create(CassetteRack::Configure.source_path)
|
30
|
+
cassettes_tag = render_branch(tree, request.script_name, request.path_info)
|
31
|
+
cassette_tag = render_leaf(drawer, request.script_name + request.path_info)
|
32
|
+
|
33
|
+
status = 200
|
34
|
+
headers = {'Content-Type' => 'text/html'}
|
35
|
+
template = Liquid::Template.parse(CassetteRack::Configure.application_template)
|
36
|
+
body = template.render('cassettes_tag' => cassettes_tag, 'cassette_tag' => cassette_tag)
|
37
|
+
|
38
|
+
[status, headers, [body]]
|
39
|
+
end
|
40
|
+
|
41
|
+
def render_branch(node, script_name, path_info)
|
42
|
+
raw = "<ol #{node.level == 0 ? "id='tree'" : nil}><li>"
|
43
|
+
raw += "<label class='branch' for='#{node.id}'>#{node.name}</label>"
|
44
|
+
raw += "<input type='checkbox' id='#{node.id}' checked />\n"
|
45
|
+
|
46
|
+
entries = []
|
47
|
+
node.entries.each do |entry|
|
48
|
+
if entry.leaf?
|
49
|
+
entries << entry
|
50
|
+
else
|
51
|
+
raw += render_branch(entry, script_name, path_info)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if entries.count > 0
|
56
|
+
raw += "<ol>"
|
57
|
+
raw += entries.map do |entry|
|
58
|
+
raw = "<li class='leaf #{entry.id == path_info ? "active" : nil}'>"
|
59
|
+
raw += "<a href=#{script_name}#{entry.id}>#{entry.name}</a></li>"
|
60
|
+
end.join("\n")
|
61
|
+
raw += "</ol>\n"
|
62
|
+
end
|
63
|
+
|
64
|
+
raw += "</li></ol>\n"
|
65
|
+
raw
|
66
|
+
end
|
67
|
+
|
68
|
+
def render_leaf(drawer, action)
|
69
|
+
if drawer.exist?
|
70
|
+
raw = drawer.render
|
71
|
+
raw += "<form method='post' action='#{action}'>\n"
|
72
|
+
raw += "<input name='_method' value='delete' type='hidden' />\n"
|
73
|
+
raw += "<input class='btn btn-danger' type='submit' value='Destroy'>\n"
|
74
|
+
raw += "</form>\n"
|
75
|
+
else
|
76
|
+
raw = "<h3>Please select cassette</h3>"
|
77
|
+
end
|
78
|
+
|
79
|
+
raw
|
80
|
+
end
|
81
|
+
# end private
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'cassette-rack/response'
|
3
|
+
|
4
|
+
module CassetteRack
|
5
|
+
module Request
|
6
|
+
def get(path, params=nil, headers=nil)
|
7
|
+
request(:get, path, params, headers)
|
8
|
+
end
|
9
|
+
|
10
|
+
def post(path, body, headers=nil)
|
11
|
+
request(:post, path, nil, headers, body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def patch(path, body, headers=nil)
|
15
|
+
request(:patch, path, nil, headers, body)
|
16
|
+
end
|
17
|
+
|
18
|
+
def put(path, body=nil, headers=nil)
|
19
|
+
request(:put, path, nil, headers, body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete(path)
|
23
|
+
request(:delete, path)
|
24
|
+
end
|
25
|
+
|
26
|
+
def request(method, path, params=nil, headers=nil, body=nil, options=nil)
|
27
|
+
conn = Faraday.new(url: CassetteRack.config.url, headers: headers)
|
28
|
+
res = conn.send(method) do |req|
|
29
|
+
case method
|
30
|
+
when :get, :delete
|
31
|
+
req.url path
|
32
|
+
when :post, :patch, :put
|
33
|
+
req.path = path
|
34
|
+
req.body = body
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
@response = CassetteRack::Response.new(res)
|
39
|
+
end
|
40
|
+
|
41
|
+
def response
|
42
|
+
@response
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
class Response
|
3
|
+
attr_reader :status, :headers, :body, :method
|
4
|
+
|
5
|
+
def initialize(response)
|
6
|
+
@status = response.status
|
7
|
+
@headers = response.headers
|
8
|
+
@body = response.body
|
9
|
+
end
|
10
|
+
|
11
|
+
def status_code
|
12
|
+
status
|
13
|
+
end
|
14
|
+
|
15
|
+
def response_headers
|
16
|
+
headers
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
module Tree
|
3
|
+
class Branch < CassetteRack::Tree::Leaf
|
4
|
+
attr_reader :entries
|
5
|
+
|
6
|
+
def initialize(path, level=0, trunk=nil)
|
7
|
+
super
|
8
|
+
@entries = []
|
9
|
+
node
|
10
|
+
end
|
11
|
+
|
12
|
+
def leaf?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def each(&block)
|
17
|
+
entries.each do |entry|
|
18
|
+
block.call(entry)
|
19
|
+
entry.each(&block) if entry.is_a?(CassetteRack::Tree::Branch)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def node
|
25
|
+
Dir[File.join(path, '*')].each do |path|
|
26
|
+
if File.directory?(path)
|
27
|
+
entries << CassetteRack::Tree::Branch.new(path, level, trunk)
|
28
|
+
else
|
29
|
+
entries << CassetteRack::Tree::Leaf.new(path, level, trunk)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# end private
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module CassetteRack
|
2
|
+
module Tree
|
3
|
+
class Leaf
|
4
|
+
attr_reader :name, :path, :level, :trunk, :id
|
5
|
+
|
6
|
+
def initialize(path, level=0, trunk=nil)
|
7
|
+
@name = File.basename(path, '.*')
|
8
|
+
@path = File.expand_path(path)
|
9
|
+
|
10
|
+
if trunk.nil?
|
11
|
+
@level = level
|
12
|
+
@trunk = path
|
13
|
+
@id = :root
|
14
|
+
else
|
15
|
+
@level = level + 1
|
16
|
+
@trunk = trunk
|
17
|
+
@id = "#{File.dirname(@path)}/#{@name}".sub(trunk, '')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def leaf?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Cassette Rack</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #333; }
|
7
|
+
|
8
|
+
body, p, ol, ul, td {
|
9
|
+
font-family: helvetica, verdana, arial, sans-serif;
|
10
|
+
font-size: 13px;
|
11
|
+
line-height: 18px;
|
12
|
+
}
|
13
|
+
|
14
|
+
pre {
|
15
|
+
background-color: #eee;
|
16
|
+
padding: 10px;
|
17
|
+
font-size: 11px;
|
18
|
+
white-space: pre-wrap;
|
19
|
+
margin-left: 20px;
|
20
|
+
}
|
21
|
+
|
22
|
+
h2 { padding-left: 10px; }
|
23
|
+
h3 { padding-left: 10px; }
|
24
|
+
ol { padding-left: 10px; }
|
25
|
+
|
26
|
+
#header {
|
27
|
+
position: relative
|
28
|
+
}
|
29
|
+
|
30
|
+
#wrapper {
|
31
|
+
float: left;
|
32
|
+
width: 100%
|
33
|
+
}
|
34
|
+
|
35
|
+
#content {
|
36
|
+
margin-left: 140px;
|
37
|
+
border-left: solid #ccc;
|
38
|
+
}
|
39
|
+
|
40
|
+
#sidebar {
|
41
|
+
float: left;
|
42
|
+
width: 140px;
|
43
|
+
margin-left: -100%;
|
44
|
+
background: #fff;
|
45
|
+
border-right: solid #ccc;
|
46
|
+
}
|
47
|
+
|
48
|
+
#tree li { list-style: none; }
|
49
|
+
|
50
|
+
#tree li label.branch {
|
51
|
+
position: relative;
|
52
|
+
}
|
53
|
+
|
54
|
+
#tree li label.branch:before {
|
55
|
+
content: '';
|
56
|
+
position: absolute;
|
57
|
+
top: 50%;
|
58
|
+
left: -10px;
|
59
|
+
margin-top: -4px;
|
60
|
+
border: 4px solid transparent;
|
61
|
+
border-left: 7px solid #999;
|
62
|
+
}
|
63
|
+
|
64
|
+
#tree li .branch { cursor: pointer; }
|
65
|
+
#tree li .branch + input[type=checkbox] { opacity: 0; }
|
66
|
+
#tree li .branch + input[type=checkbox] + ol > li { display: none; }
|
67
|
+
#tree li .branch + input[type=checkbox]:checked + ol > li { display: block; }
|
68
|
+
|
69
|
+
#tree li .leaf { padding-left: 10px; }
|
70
|
+
#tree li .leaf > a { color: #333; text-decoration: none; }
|
71
|
+
#tree li .leaf > a:visited { color: #333; }
|
72
|
+
#tree li .leaf > a:hover { color: #333; background-color:#fff; }
|
73
|
+
#tree li .active { background-color: #999; }
|
74
|
+
#tree li .active > a:visited { color: #fff; }
|
75
|
+
#tree li .active > a:hover { color: #fff; background-color:#999; }
|
76
|
+
|
77
|
+
div.scroll {
|
78
|
+
width: 130px;
|
79
|
+
overflow: scroll;
|
80
|
+
}
|
81
|
+
|
82
|
+
.btn {
|
83
|
+
padding: 5px 10px;
|
84
|
+
margin-left: 10px;
|
85
|
+
cursor: pointer;
|
86
|
+
background-image: none;
|
87
|
+
border: 1px solid transparent;
|
88
|
+
padding: 8px 12px;
|
89
|
+
font-size: 12px;
|
90
|
+
}
|
91
|
+
|
92
|
+
.btn-danger {
|
93
|
+
color: #ffffff;
|
94
|
+
background-color: #f04124;
|
95
|
+
border-color: #ea2f10;
|
96
|
+
}
|
97
|
+
</style>
|
98
|
+
</head>
|
99
|
+
<body>
|
100
|
+
<div id="container">
|
101
|
+
<div id="header">
|
102
|
+
<h2>Cassette Rack</h2>
|
103
|
+
<p>Operation of the Video Cassette Recorder</p>
|
104
|
+
</div>
|
105
|
+
<div id="wrapper">
|
106
|
+
<div id="content">
|
107
|
+
{{ cassette_tag }}
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div id="sidebar" class="scroll">
|
111
|
+
{{ cassettes_tag }}
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
</body>
|
115
|
+
</html>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'cassette-rack'
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cassette-rack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ogom
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
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: kramdown
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: liquid
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
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: rack
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
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: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Operate of the VCR cassette on Rack
|
112
|
+
email:
|
113
|
+
- ogom@hotmail.co.jp
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- cassette-rack.gemspec
|
124
|
+
- config.ru
|
125
|
+
- lib/cassette-rack.rb
|
126
|
+
- lib/cassette-rack/configure.rb
|
127
|
+
- lib/cassette-rack/decorator/request.rb
|
128
|
+
- lib/cassette-rack/decorator/response.rb
|
129
|
+
- lib/cassette-rack/default.rb
|
130
|
+
- lib/cassette-rack/drawer.rb
|
131
|
+
- lib/cassette-rack/engine.rb
|
132
|
+
- lib/cassette-rack/request.rb
|
133
|
+
- lib/cassette-rack/response.rb
|
134
|
+
- lib/cassette-rack/tree.rb
|
135
|
+
- lib/cassette-rack/tree/branch.rb
|
136
|
+
- lib/cassette-rack/tree/leaf.rb
|
137
|
+
- lib/cassette-rack/version.rb
|
138
|
+
- lib/templates/layouts/application.html.liquid
|
139
|
+
- lib/templates/layouts/content.md.liquid
|
140
|
+
- spec/grant-front_spec.rb
|
141
|
+
- spec/lib/version_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
homepage: http://ogom.github.io/cassette-rack
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.2.2
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: Operate of the VCR cassette
|
167
|
+
test_files:
|
168
|
+
- spec/grant-front_spec.rb
|
169
|
+
- spec/lib/version_spec.rb
|
170
|
+
- spec/spec_helper.rb
|