recot 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +43 -0
- data/Gemfile +3 -0
- data/Guardfile +22 -0
- data/LICENSE +21 -0
- data/README.md +100 -0
- data/Rakefile +7 -0
- data/bin/recot +47 -0
- data/lib/recot.rb +44 -0
- data/lib/recot/cache/state_cache.rb +74 -0
- data/lib/recot/commands.rb +46 -0
- data/lib/recot/commands/current_clear.rb +32 -0
- data/lib/recot/commands/guard_server.rb +36 -0
- data/lib/recot/commands/interactive_ui.rb +67 -0
- data/lib/recot/commands/listener.rb +49 -0
- data/lib/recot/commands/observer.rb +24 -0
- data/lib/recot/commands/rack_server.rb +37 -0
- data/lib/recot/commands/recent_cancel.rb +44 -0
- data/lib/recot/commands/tree_generator.rb +20 -0
- data/lib/recot/config.rb +48 -0
- data/lib/recot/render/html_renderer.rb +50 -0
- data/lib/recot/tasks.rb +12 -0
- data/lib/recot/tasks/base_task.rb +55 -0
- data/lib/recot/tasks/indexdoc_task.rb +55 -0
- data/lib/recot/tasks/resdoc_task.rb +83 -0
- data/lib/recot/tasks/sync_task.rb +43 -0
- data/lib/recot/utils/recot_util.rb +72 -0
- data/lib/recot/version.rb +5 -0
- data/recot.gemspec +35 -0
- data/template/css/recot.css +87 -0
- data/template/css/theme/white.css +75 -0
- data/template/index.html.erb +36 -0
- data/template/resdoc.html.erb +44 -0
- metadata +217 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'recot/config'
|
3
|
+
require 'recot/tasks/base_task'
|
4
|
+
|
5
|
+
module Recot
|
6
|
+
module Tasks
|
7
|
+
|
8
|
+
# Task for update index.html.
|
9
|
+
class IndexdocTask < BaseTask
|
10
|
+
|
11
|
+
# Path of gem root path.
|
12
|
+
ROOT_DIR = "#{File.expand_path('../../../../', __FILE__)}".freeze
|
13
|
+
|
14
|
+
# Path of indexdoc template.
|
15
|
+
INDEXDOC_TEMPLATE = "#{ROOT_DIR}/template/index.html.erb".freeze
|
16
|
+
|
17
|
+
INDEX_HTML = 'index.html'.freeze
|
18
|
+
|
19
|
+
def run(args = nil)
|
20
|
+
generate(args)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# Generate index html file.
|
26
|
+
#
|
27
|
+
# == Parameters:
|
28
|
+
# Arguments of index files.
|
29
|
+
def generate(args)
|
30
|
+
|
31
|
+
# Get resource html files.
|
32
|
+
files = []
|
33
|
+
Dir::glob("#{Recot.resources_dir}/*.html").each do |f|
|
34
|
+
# Create evidence file path.
|
35
|
+
files << relative_path_from_output(f)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Set the data hash object.
|
39
|
+
data = {}
|
40
|
+
data[:title] = Config.instance.project_name
|
41
|
+
data[:theme] = Config.instance.theme
|
42
|
+
data[:resources] = files
|
43
|
+
data[:version] = Recot::VERSION
|
44
|
+
|
45
|
+
# Render
|
46
|
+
Recot::Render::HtmlRenderer.new.render_doc(INDEXDOC_TEMPLATE, index_path, data)
|
47
|
+
end
|
48
|
+
|
49
|
+
def index_path
|
50
|
+
"#{Recot.output_dir}/#{INDEX_HTML}"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'recot/config'
|
3
|
+
require 'recot/tasks/base_task'
|
4
|
+
require 'recot/cache/state_cache'
|
5
|
+
require 'recot/render/html_renderer'
|
6
|
+
|
7
|
+
module Recot
|
8
|
+
module Tasks
|
9
|
+
|
10
|
+
# Generate resources html file task.
|
11
|
+
class ResdocTask < BaseTask
|
12
|
+
|
13
|
+
# Path of gem root path.
|
14
|
+
ROOT_DIR = "#{File.expand_path('../../../../', __FILE__)}".freeze
|
15
|
+
|
16
|
+
# Path of resdoc template.
|
17
|
+
RESDOC_TEMPLATE = "#{ROOT_DIR}/template/resdoc.html.erb".freeze
|
18
|
+
|
19
|
+
# Run the resdoc task.
|
20
|
+
#
|
21
|
+
# == Parameters:
|
22
|
+
# Arguments of resource files.
|
23
|
+
def run(args)
|
24
|
+
unless valid_state?(args)
|
25
|
+
$stderr.puts "invalid state. files #{args}"
|
26
|
+
else
|
27
|
+
generate(args)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# Generate resource html file.
|
34
|
+
#
|
35
|
+
# == Parameters:
|
36
|
+
# Arguments of resource files.
|
37
|
+
def generate(args)
|
38
|
+
|
39
|
+
# Get resource files.
|
40
|
+
files = []
|
41
|
+
Dir::glob("#{evidence_path}/*").each do |f|
|
42
|
+
# Create evidence file path.
|
43
|
+
files << relative_path_from_resource(f)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Set the data hash object.
|
47
|
+
data = {}
|
48
|
+
data[:title] = get_testno()
|
49
|
+
data[:files] = files
|
50
|
+
data[:theme] = Config.instance.theme
|
51
|
+
data[:version] = Recot::VERSION
|
52
|
+
|
53
|
+
# Render
|
54
|
+
Recot::Render::HtmlRenderer.new.render_doc(RESDOC_TEMPLATE, resdoc_path, data)
|
55
|
+
end
|
56
|
+
|
57
|
+
def gen_resdir
|
58
|
+
unless File.exist?()
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get resource doc html path.
|
63
|
+
#
|
64
|
+
# == Returns:
|
65
|
+
# A path of resdoc. If not cached return 'unkown.html'.
|
66
|
+
def resdoc_path()
|
67
|
+
"#{evidence_path}.html"
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check args and test no.
|
71
|
+
#
|
72
|
+
# == Parameters:
|
73
|
+
# Arguments array object.
|
74
|
+
#
|
75
|
+
# == Returns:
|
76
|
+
# True if valid state.
|
77
|
+
def valid_state?(args)
|
78
|
+
no = test_no = Recot::Cache::StateCache.restore_no
|
79
|
+
no && args && args.size > 0
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'fileutils'
|
3
|
+
require 'recot/tasks/base_task'
|
4
|
+
require 'recot/cache/state_cache'
|
5
|
+
|
6
|
+
# TODO sync work dir to __output dir
|
7
|
+
module Recot
|
8
|
+
module Tasks
|
9
|
+
class SyncTask < BaseTask
|
10
|
+
|
11
|
+
SEPARATOR = '/'.freeze
|
12
|
+
|
13
|
+
def initialize()
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def run(args = nil)
|
18
|
+
# get evidence path
|
19
|
+
path = evidence_path()
|
20
|
+
unless File.exist?(path)
|
21
|
+
$stderr.puts "unkown #{path} directory."
|
22
|
+
else
|
23
|
+
move(path)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def move(path)
|
29
|
+
files = Dir.glob("#{Recot.basket_dir}/*")
|
30
|
+
# move all
|
31
|
+
FileUtils.mv(files, "#{path}/")
|
32
|
+
|
33
|
+
# Cached evidence files
|
34
|
+
cache_files = []
|
35
|
+
files.each do |f|
|
36
|
+
cache_files << "#{path}/#{File.basename(f)}"
|
37
|
+
end
|
38
|
+
Recot::Cache::StateCache.store_recent_evidence(cache_files)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'fileutils'
|
3
|
+
require 'recot/cache/state_cache'
|
4
|
+
|
5
|
+
module Recot
|
6
|
+
module Utils
|
7
|
+
class RecotUtil
|
8
|
+
|
9
|
+
ROOT_DIR = "#{File.expand_path('../../../../', __FILE__)}".freeze
|
10
|
+
CSS_TEMPLATE_DIR = "#{ROOT_DIR}/template/css".freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
|
14
|
+
# Prepare for recot.
|
15
|
+
#
|
16
|
+
# Create directory.
|
17
|
+
# * __output/resource
|
18
|
+
# * basket
|
19
|
+
# * log
|
20
|
+
#
|
21
|
+
# Copy css files.
|
22
|
+
# Remove if exist log file.
|
23
|
+
def prepare()
|
24
|
+
# Create '__output/resource' directory.
|
25
|
+
unless File.exist?(Recot.resources_dir)
|
26
|
+
FileUtils.mkdir_p(Recot.resources_dir)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Create 'basket' directory.
|
30
|
+
unless File.exist?(Recot.basket_dir)
|
31
|
+
FileUtils.mkdir_p(Recot.basket_dir)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Remove 'log' directory.
|
35
|
+
if File.exist?("#{Dir.pwd}/log")
|
36
|
+
FileUtils.rm_r("#{Dir.pwd}/log")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Create 'log' directory.
|
40
|
+
FileUtils.mkdir("#{Dir.pwd}/log")
|
41
|
+
|
42
|
+
# Copy css files.
|
43
|
+
unless File.exist?("#{Recot.output_dir}/css")
|
44
|
+
FileUtils.cp_r(CSS_TEMPLATE_DIR, Recot.output_dir)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Remove all directory and cache.
|
49
|
+
#
|
50
|
+
# * __output
|
51
|
+
# * __output/resource
|
52
|
+
# * __output/css
|
53
|
+
# * basket
|
54
|
+
def remove()
|
55
|
+
# Remove '__output' directory.
|
56
|
+
if File.exist?(Recot.output_dir)
|
57
|
+
FileUtils.rm_r(Recot.output_dir)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Remove 'basket' directory.
|
61
|
+
if File.exist?(Recot.basket_dir)
|
62
|
+
FileUtils.rm_r(Recot.basket_dir)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Remove cache.
|
66
|
+
Cache::StateCache.clear
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/recot.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'recot/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "recot"
|
8
|
+
spec.version = Recot::VERSION
|
9
|
+
spec.authors = ["slowhand0309"]
|
10
|
+
spec.email = ["slowhand0309@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Recot is a tool to gather evidence of the test'
|
13
|
+
spec.description = 'To generate a test result of documents in HTML format automatically'
|
14
|
+
spec.homepage = 'https://github.com/Slowhand0309/recot'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# Runtime Dependencies
|
23
|
+
spec.add_runtime_dependency "gli", "~> 2.13"
|
24
|
+
spec.add_runtime_dependency "guard", "~> 2.13"
|
25
|
+
spec.add_runtime_dependency "guard-livereload", "~> 2.4"
|
26
|
+
spec.add_runtime_dependency "rack", "~> 1.6"
|
27
|
+
spec.add_runtime_dependency "rack-livereload", "~> 0.3"
|
28
|
+
spec.add_runtime_dependency "listen", "~> 3.0"
|
29
|
+
spec.add_runtime_dependency "activesupport", "~> 4.0"
|
30
|
+
|
31
|
+
# Development Dependencies
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*!
|
2
|
+
* recot
|
3
|
+
* https://github.com/Slowhand0309/recot
|
4
|
+
* MIT licensed
|
5
|
+
*
|
6
|
+
* Copyright (C) 2016 Slowhand0309
|
7
|
+
*/
|
8
|
+
|
9
|
+
/* Global Style */
|
10
|
+
html {
|
11
|
+
font-family: sans-serif;
|
12
|
+
}
|
13
|
+
|
14
|
+
body {
|
15
|
+
color: #000000;
|
16
|
+
margin: 0;
|
17
|
+
text-align: center;
|
18
|
+
background-color: #ffffff;
|
19
|
+
}
|
20
|
+
|
21
|
+
pre {
|
22
|
+
text-align: left;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* Header */
|
26
|
+
#header {
|
27
|
+
padding: 1px;
|
28
|
+
font-size: 36px;
|
29
|
+
}
|
30
|
+
|
31
|
+
/* Content */
|
32
|
+
#content {
|
33
|
+
|
34
|
+
}
|
35
|
+
|
36
|
+
/* Footer */
|
37
|
+
#footer {
|
38
|
+
min-height: 500px;
|
39
|
+
}
|
40
|
+
|
41
|
+
/* Navigate */
|
42
|
+
.navigate {
|
43
|
+
padding: 5px;
|
44
|
+
text-align: left;
|
45
|
+
}
|
46
|
+
|
47
|
+
/* Lists */
|
48
|
+
.lists {
|
49
|
+
margin-left: 200px;
|
50
|
+
margin-right: 200px;
|
51
|
+
}
|
52
|
+
|
53
|
+
/* List items */
|
54
|
+
.lists > .item {
|
55
|
+
padding: 10px;
|
56
|
+
margin: 0px;
|
57
|
+
text-align: left;
|
58
|
+
font-size: 24px;
|
59
|
+
border-radius: 5px;
|
60
|
+
-webkit-transition: 0.1s color ease, 0.1s padding-left ease, 0.1s background-color ease;
|
61
|
+
transition: 0.1s color ease, 0.1s padding-left ease, 0.1s background-color ease;
|
62
|
+
}
|
63
|
+
|
64
|
+
/* Information */
|
65
|
+
.information {
|
66
|
+
padding-top: 20px;
|
67
|
+
font-size: 18px;
|
68
|
+
text-align: left;
|
69
|
+
}
|
70
|
+
|
71
|
+
/* Text */
|
72
|
+
.text {
|
73
|
+
margin-left: 23%;
|
74
|
+
margin-right: 23%;
|
75
|
+
}
|
76
|
+
/* Copyright */
|
77
|
+
.copyright {
|
78
|
+
padding: 5px;
|
79
|
+
font-size: 12px;
|
80
|
+
text-align: left;
|
81
|
+
margin: 0 auto;
|
82
|
+
}
|
83
|
+
|
84
|
+
.copyright > hr {
|
85
|
+
border: 0;
|
86
|
+
height: 1px;
|
87
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*!
|
2
|
+
* recot
|
3
|
+
* https://github.com/Slowhand0309/recot
|
4
|
+
* MIT licensed
|
5
|
+
*
|
6
|
+
* Copyright (C) 2016 Slowhand0309
|
7
|
+
*/
|
8
|
+
|
9
|
+
/* Header */
|
10
|
+
#header {
|
11
|
+
color: #ffffff;
|
12
|
+
background-color: #FA5858;
|
13
|
+
}
|
14
|
+
|
15
|
+
/* Content */
|
16
|
+
#content {
|
17
|
+
background-color: #FFFFFF;
|
18
|
+
}
|
19
|
+
|
20
|
+
/* Footer */
|
21
|
+
#footer {
|
22
|
+
color: #dadada;
|
23
|
+
padding-left: 300px;
|
24
|
+
padding-right: 300px;
|
25
|
+
background: #585f69 none repeat scroll 0% 0%;
|
26
|
+
}
|
27
|
+
|
28
|
+
/* Button */
|
29
|
+
.btn {
|
30
|
+
padding: 5px;
|
31
|
+
background: #dadada;
|
32
|
+
border-radius: 5px;
|
33
|
+
display: inline-block;
|
34
|
+
}
|
35
|
+
|
36
|
+
.btn > a {
|
37
|
+
font-size: 18px;
|
38
|
+
color: #000000;
|
39
|
+
text-align: center;
|
40
|
+
text-decoration: none;
|
41
|
+
}
|
42
|
+
|
43
|
+
.btn:hover {
|
44
|
+
background-color: #cacbcd;
|
45
|
+
}
|
46
|
+
|
47
|
+
/* List items */
|
48
|
+
.lists > .item {
|
49
|
+
color: rgba(0, 0, 0, 0.4);
|
50
|
+
}
|
51
|
+
|
52
|
+
.lists > .item:hover {
|
53
|
+
background: #fafafa;
|
54
|
+
}
|
55
|
+
|
56
|
+
.lists > hr {
|
57
|
+
border: 0;
|
58
|
+
height: 1px;
|
59
|
+
background: #585f69;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Text */
|
63
|
+
.text {
|
64
|
+
background-color: #e6e6e6;
|
65
|
+
}
|
66
|
+
|
67
|
+
/* Copyright */
|
68
|
+
.copyright {
|
69
|
+
color: #dadada;
|
70
|
+
background: #585f69 none repeat scroll 0% 0%;
|
71
|
+
}
|
72
|
+
|
73
|
+
.copyright > hr {
|
74
|
+
background: #dadada;
|
75
|
+
}
|