recot 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/bin/recot +12 -1
- data/lib/recot/commands.rb +9 -0
- data/lib/recot/utils/export_util.rb +110 -0
- data/lib/recot/version.rb +1 -1
- data/recot.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60d0a1b677aa5c0c1b34cc35044645665e53dd6
|
4
|
+
data.tar.gz: 242cf47f631781b00f44c615804119fdb7bf3de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2665db343b75129bb148c33299d30bd09f9baaccb383d5264286692b978c05d2a77d5a714310d027f2e6545a1ae110acb89127fb673c6ecafed5134e7ac6dd
|
7
|
+
data.tar.gz: 6e31d439113053ac443701754cc8ea91c84ea4c4c2f311099442f0033d78fc978eace34842f9e8ee2b4591e8ea545f0924d09269e599867700cf78755648766d
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Recot is a tool to gather evidence of the test.
|
6
6
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/recot.svg)](https://badge.fury.io/rb/recot)
|
8
|
-
![
|
8
|
+
[![Build Status](https://travis-ci.org/Slowhand0309/recot.svg?branch=master)](https://travis-ci.org/Slowhand0309/recot)
|
9
9
|
|
10
10
|
## Description
|
11
11
|
Create evidence document for test to easy.<br>
|
@@ -29,9 +29,17 @@ $ rect <command>
|
|
29
29
|
|Command|Description|
|
30
30
|
|:------|:----------|
|
31
31
|
|start|Start recot to collect evidence.|
|
32
|
+
|export|Export to another format.|
|
32
33
|
|cleanup|Clean up cache.|
|
33
34
|
|destroy|Delete all file.|
|
34
35
|
|
36
|
+
If you want to export to another format, run the following command:
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ recot export
|
40
|
+
```
|
41
|
+
※ Yet now, `.xlsx` format only
|
42
|
+
|
35
43
|
If you want to delete cacche.
|
36
44
|
run the following command:
|
37
45
|
|
@@ -54,7 +62,7 @@ To begin the test with the following command:
|
|
54
62
|
|
55
63
|
```sh
|
56
64
|
$ recot start
|
57
|
-
Start recot ver 0.2.
|
65
|
+
Start recot ver 0.2.2
|
58
66
|
|
59
67
|
____ __
|
60
68
|
/ __ \___ _________ / /
|
data/bin/recot
CHANGED
@@ -16,12 +16,23 @@ class RecotExecutable
|
|
16
16
|
|
17
17
|
cmd.desc 'Open default browser'
|
18
18
|
cmd.switch [:o, :open]
|
19
|
-
|
19
|
+
|
20
20
|
cmd.action do |_, options, _|
|
21
21
|
Recot::Commands.start(options[:port], options[:open])
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
desc 'Export'
|
26
|
+
command :export do |cmd|
|
27
|
+
|
28
|
+
cmd.desc 'Export format'
|
29
|
+
cmd.flag [:f, :format], default_value: 'excel'
|
30
|
+
|
31
|
+
cmd.action do |_, options, _|
|
32
|
+
Recot::Commands.export(options[:format])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
25
36
|
desc 'Clean cache'
|
26
37
|
command :cleanup do |cmd|
|
27
38
|
|
data/lib/recot/commands.rb
CHANGED
@@ -6,6 +6,7 @@ require 'recot/commands/interactive_ui'
|
|
6
6
|
require 'recot/commands/listener'
|
7
7
|
require 'recot/utils/recot_util'
|
8
8
|
require 'recot/utils/browser_util'
|
9
|
+
require 'recot/utils/export_util'
|
9
10
|
|
10
11
|
module Recot
|
11
12
|
module Commands
|
@@ -39,6 +40,14 @@ module Recot
|
|
39
40
|
InteractiveUi.new.start
|
40
41
|
end
|
41
42
|
|
43
|
+
# Export.
|
44
|
+
#
|
45
|
+
# == Parameters:
|
46
|
+
# Export format.
|
47
|
+
def self.export(format)
|
48
|
+
Utils::ExportUtil.execute(format)
|
49
|
+
end
|
50
|
+
|
42
51
|
# All clear.
|
43
52
|
#
|
44
53
|
def self.destroy
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'axlsx'
|
3
|
+
require 'recot/config'
|
4
|
+
|
5
|
+
module Recot
|
6
|
+
module Utils
|
7
|
+
class ExportUtil
|
8
|
+
|
9
|
+
IMAGE_SIZE_WIDTH = 512
|
10
|
+
IMAGE_SIZE_HEIGHT = 512
|
11
|
+
IMAGE_SIZE_ROWS = 25
|
12
|
+
|
13
|
+
class << self
|
14
|
+
|
15
|
+
# Execute export.
|
16
|
+
#
|
17
|
+
# == Parameters:
|
18
|
+
# Export format.
|
19
|
+
def execute(format)
|
20
|
+
puts "\e[33mExport resources [format: #{format}]\e[0m"
|
21
|
+
unless validate
|
22
|
+
# invalid
|
23
|
+
puts "\e[31mResources not found!\e[0m"
|
24
|
+
return
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fetch resoures.
|
28
|
+
fetch
|
29
|
+
|
30
|
+
puts "Export Success!!"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Validate for export.
|
34
|
+
#
|
35
|
+
# == Returns:
|
36
|
+
# True if normal, False if invalid.
|
37
|
+
def validate
|
38
|
+
|
39
|
+
# Check __output directory.
|
40
|
+
unless File.exist?(Recot.output_dir)
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
44
|
+
# Check __output/resources
|
45
|
+
unless File.exist?(Recot.resources_dir)
|
46
|
+
return false
|
47
|
+
end
|
48
|
+
return true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Fetch output resources.
|
52
|
+
def fetch
|
53
|
+
evidences = {}
|
54
|
+
Dir::glob("#{Recot.resources_dir}/*").each do |d|
|
55
|
+
if File::ftype(d) == "directory"
|
56
|
+
#images = Dir::entries(d).select{|e| File::ftype("#{d}/#{e}") == 'file'}
|
57
|
+
images = []
|
58
|
+
Dir::entries(d).each do |e|
|
59
|
+
path = "#{d}/#{e}"
|
60
|
+
images << path if File::ftype(path) == 'file'
|
61
|
+
end
|
62
|
+
evidences[File.basename(d)] = images
|
63
|
+
end
|
64
|
+
end
|
65
|
+
# Generate spreadsheet
|
66
|
+
name = Config.instance.project_name
|
67
|
+
name = 'recot' if name.empty?
|
68
|
+
to_spreadsheet("#{name}.xlsx", evidences)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Export spreadsheet.
|
72
|
+
#
|
73
|
+
# == Parameters:
|
74
|
+
# A spreadsheet file name
|
75
|
+
def to_spreadsheet(filename, evidences)
|
76
|
+
p = Axlsx::Package.new
|
77
|
+
wb = p.workbook
|
78
|
+
|
79
|
+
# Loop all evidences.
|
80
|
+
evidences.each do |no, evi|
|
81
|
+
|
82
|
+
# Add worksheet.
|
83
|
+
wb.add_worksheet(:name => no) do |sheet|
|
84
|
+
|
85
|
+
evi.each_with_index do |e, index|
|
86
|
+
sheet.add_row [File.basename(e)]
|
87
|
+
sheet.column_info.first.width = 5
|
88
|
+
|
89
|
+
# Add images.
|
90
|
+
sheet.add_image(:image_src => e, :noSelect => true, :noMove => true) do |image|
|
91
|
+
image.width = IMAGE_SIZE_WIDTH
|
92
|
+
image.height = IMAGE_SIZE_HEIGHT
|
93
|
+
image.start_at 1, 1 + index * IMAGE_SIZE_ROWS
|
94
|
+
|
95
|
+
end
|
96
|
+
(IMAGE_SIZE_ROWS - 1).times {
|
97
|
+
sheet.add_row
|
98
|
+
}
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
p.serialize(filename)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/recot/version.rb
CHANGED
data/recot.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency "wdm", ">= 0.1.0" if Gem.win_platform?
|
32
32
|
spec.add_runtime_dependency "clipboard", "~> 1.1"
|
33
33
|
spec.add_runtime_dependency "ffi", "~> 1.9" if Gem.win_platform?
|
34
|
+
spec.add_runtime_dependency "axlsx", "~> 2.0"
|
34
35
|
|
35
36
|
# Development Dependencies
|
36
37
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slowhand0309
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.1'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: axlsx
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rake
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +200,7 @@ files:
|
|
186
200
|
- lib/recot/tasks/sync_task.rb
|
187
201
|
- lib/recot/utils/browser_util.rb
|
188
202
|
- lib/recot/utils/clipboard_util.rb
|
203
|
+
- lib/recot/utils/export_util.rb
|
189
204
|
- lib/recot/utils/recot_util.rb
|
190
205
|
- lib/recot/utils/screencap_util.rb
|
191
206
|
- lib/recot/version.rb
|