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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 315a07523c46f23704d325b5e2af697a0c6ec5d2
4
+ data.tar.gz: 4852373998c41402ab84a47a40f742400a1de9cb
5
+ SHA512:
6
+ metadata.gz: c222cb011ee356aec5ba82eb1232be1e96d43acbd12d797100be10f9c135a5a8434050eef24d64c32fb5e27557ce1e48b9285b60a90f42d2eb7319a2a2756333
7
+ data.tar.gz: ac7dfb345660e024fd94164bb3cc175d3d7de5c4cd3ad9ae2ec19ed95a42ae05e1ee4e89a1e1611dca2550ec54e9a585354156dc9ce7b4d5176c71640fc7c5e8
@@ -0,0 +1,43 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
37
+
38
+ # output directory for recot
39
+ /__output/
40
+ /basket/
41
+ /log/
42
+ .cahce
43
+ config.yml
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ notification :off
2
+
3
+ guard 'livereload' do
4
+ extensions = {
5
+ css: :css,
6
+ js: :js,
7
+ html: :html,
8
+ png: :png,
9
+ gif: :gif,
10
+ jpg: :jpg,
11
+ jpeg: :jpeg,
12
+ }
13
+
14
+ exts = %w(erb haml html)
15
+
16
+ # file types LiveReload may optimize refresh for
17
+ compiled_exts = extensions.values.uniq
18
+ watch(%r{__output/public/.+\.(#{compiled_exts * '|'})})
19
+
20
+ # file needing a full reload of the page anyway
21
+ watch(%r{__output/.+\.(#{exts * '|'})$})
22
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Slowhand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,100 @@
1
+ # Recot
2
+
3
+ **R**uby **e**vidence **co**llect **t**ool<br>
4
+
5
+ Recot is a tool to gather evidence of the test.
6
+
7
+ ## Description
8
+ Create evidence document for test to easy.<br>
9
+ Throw evidence(screen shots or file...) to specific folder for create evidence document.
10
+
11
+ ## Install
12
+
13
+ Install the gem with:
14
+
15
+ ```sh
16
+ gem install recot
17
+ ```
18
+ ## Usage
19
+
20
+ To begin the test with the following command:
21
+
22
+ ```sh
23
+ $ recot start
24
+ Start recot ver 0.1.0
25
+
26
+ ____ __
27
+ / __ \___ _________ / /
28
+ / /_/ / _ \/ ___/ __ \/ __/
29
+ / _, _/ __/ /__/ /_/ / /
30
+ /_/ |_|\___/\___/\____/\__/
31
+ ```
32
+
33
+ Enter the test number as follows:
34
+
35
+ ```sh
36
+ [1](recot) > A1
37
+ ```
38
+
39
+ Directory corresponding to the test number is created under `__output/resources`.
40
+
41
+ ```
42
+ ├── __output
43
+ │   └── resources
44
+ │   ├── A1
45
+ ```
46
+
47
+ It threw the evidence to the `basket` directory.
48
+
49
+ It will be reflected in the HTML automatically.
50
+
51
+ ```
52
+ ├── __output
53
+ │   ├── index.html
54
+ │   └── resources
55
+ │   ├── A1
56
+ │   │   ├── access.log
57
+ │   │   └── screenshot.png
58
+ │   └── A1.html
59
+ ```
60
+
61
+ access the 'http://localhost:9292/__output/index.html'
62
+
63
+ * index.html
64
+ ![img001](http://slowhand0309.github.io/images/recot/index_html.png)
65
+
66
+ * resource.html
67
+ ![img002](http://slowhand0309.github.io/images/recot/resource_html.png)
68
+
69
+ If you want to delete the previous evidence, run the following command:
70
+
71
+ ```sh
72
+ [2](recot) > cancle
73
+ ```
74
+
75
+ If you want to delete all the evidence of the particular test number, run the following command:
76
+
77
+ ```sh
78
+ [3](recot) > clear
79
+ ```
80
+
81
+ If you want to test the end, run the following command:
82
+
83
+ ```sh
84
+ [4](recot) > exit
85
+ ```
86
+
87
+ If you want to delete all file and directory,
88
+ run the following command:
89
+
90
+ ```sh
91
+ [5](recot) > destroy
92
+ ```
93
+
94
+ ## Licence
95
+
96
+ [MIT](https://github.com/tcnksm/tool/blob/master/LICENCE)
97
+
98
+ ## Author
99
+
100
+ [slowhand0309](https://github.com/Slowhand0309)
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gli"
4
+ require "recot"
5
+
6
+ class RecotExecutable
7
+ extend GLI::App
8
+
9
+ version Recot::VERSION
10
+
11
+ desc 'Start server for recot'
12
+ command :s, :server do |cmd|
13
+
14
+ cmd.desc 'Server listen port'
15
+ cmd.flag [:p, :port], default_value: 9292
16
+ cmd.action do |_, options, _|
17
+ Recot::Commands.server(options[:port])
18
+ end
19
+ end
20
+
21
+ desc 'Start recot'
22
+ command :start do |cmd|
23
+
24
+ cmd.action do |_, options, _|
25
+ Recot::Commands.start
26
+ end
27
+ end
28
+
29
+ desc 'Clean cache'
30
+ command :cleanup do |cmd|
31
+
32
+ cmd.action do |_, options, _|
33
+ Recot::Cache::StateCache.clear
34
+ puts "Remove all of the cache."
35
+ end
36
+ end
37
+
38
+ desc 'Remove all files and cache'
39
+ command :destroy do |cmd|
40
+
41
+ cmd.action do |_, options, _|
42
+ Recot::Commands.destroy
43
+ end
44
+ end
45
+
46
+ exit run(ARGV)
47
+ end
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+ require 'recot/version'
3
+ require 'recot/commands'
4
+ require 'recot/tasks'
5
+
6
+ module Recot
7
+
8
+ # Generate files directory name.
9
+ OUTPUT_DIR = '__output'.freeze
10
+
11
+ # Throw evidence directory name.
12
+ BASKET_DIR = 'basket'.freeze
13
+
14
+ # Resource files directory name.
15
+ RESOURCE_DIR = 'resources'.freeze
16
+
17
+ class << self
18
+
19
+ # Get output directory path.
20
+ #
21
+ # == Returns:
22
+ # A string of output directory path.
23
+ def output_dir()
24
+ "#{Dir.pwd}/#{OUTPUT_DIR}"
25
+ end
26
+
27
+ # Get resources directory path.
28
+ #
29
+ # == Returns:
30
+ # A string of resources directory path.
31
+ def resources_dir()
32
+ "#{output_dir}/#{RESOURCE_DIR}"
33
+ end
34
+
35
+ # Get basket directory path.
36
+ #
37
+ # == Returns:
38
+ # A string of basket directory path.
39
+ def basket_dir()
40
+ "#{Dir.pwd}/#{BASKET_DIR}"
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,74 @@
1
+ # coding: utf-8
2
+ require 'active_support'
3
+
4
+ module Recot
5
+ module Cache
6
+
7
+ class StateCache
8
+
9
+ # Cache directory name.
10
+ CACHE_FILE = '.cahce'.freeze
11
+
12
+ # Key of current test no.
13
+ CACHE_KEY_NO = 'current_number'.freeze
14
+
15
+ # Key of recent evidence file name.
16
+ CACHE_KEY_RECENT_EVIDENCE = 'recent_evidence'.freeze
17
+
18
+ class << self
19
+
20
+ # Store current test no to cache.
21
+ #
22
+ # == Parameters:
23
+ # Test no for cache.
24
+ def store_no(number)
25
+ fcache = get_cache()
26
+ fcache.write(CACHE_KEY_NO, number)
27
+ end
28
+
29
+ # Get cached current test no.
30
+ #
31
+ # == Returns:
32
+ # Current test no.
33
+ def restore_no()
34
+ fcache = get_cache()
35
+ fcache.read(CACHE_KEY_NO)
36
+ end
37
+
38
+ # Store recent evidence to cache.
39
+ #
40
+ # == Parameters:
41
+ # evidence file name.
42
+ def store_recent_evidence(evidence)
43
+ fcache = get_cache()
44
+ fcache.write(CACHE_KEY_RECENT_EVIDENCE, evidence)
45
+ end
46
+
47
+ # Get cached recent evidence.
48
+ #
49
+ # == Returns:
50
+ # evidence file name.
51
+ def restore_recent_evidence()
52
+ fcache = get_cache()
53
+ fcache.read(CACHE_KEY_RECENT_EVIDENCE)
54
+ end
55
+
56
+ # All clear cache.
57
+ #
58
+ def clear()
59
+ fcache = get_cache()
60
+ fcache.clear
61
+ end
62
+
63
+ # Get cache object.
64
+ #
65
+ # == Returns:
66
+ # ActiveSupport::Cache object.
67
+ def get_cache()
68
+ ActiveSupport::Cache::FileStore.new(CACHE_FILE)
69
+ end
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,46 @@
1
+ # coding: utf-8
2
+ require 'recot/config'
3
+ require 'recot/commands/rack_server'
4
+ require 'recot/commands/guard_server'
5
+ require 'recot/commands/interactive_ui'
6
+ require 'recot/commands/listener'
7
+ require 'recot/utils/recot_util'
8
+
9
+ module Recot
10
+ module Commands
11
+
12
+ # Start recot.
13
+ #
14
+ def self.start
15
+
16
+ # Prepare.
17
+ Utils::RecotUtil.prepare
18
+
19
+ # Start guard server.
20
+ GuardServer.new.run
21
+
22
+ # Start rack server.
23
+ Thread.new do
24
+ RackServer.new.run
25
+ end
26
+
27
+ # Start listener.
28
+ Listener.new.run
29
+
30
+ # Start interactive operate.
31
+ InteractiveUi.new.start
32
+ end
33
+
34
+ # Start server.
35
+ #
36
+ def self.server(port = nil)
37
+ RackServer.new(port).run
38
+ end
39
+
40
+ # All clear.
41
+ #
42
+ def self.destroy
43
+ InteractiveUi.new.destroy
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ require 'fileutils'
3
+ require 'recot/cache/state_cache'
4
+ require 'recot/tasks/indexdoc_task'
5
+
6
+ module Recot
7
+ module Commands
8
+ class CurrentClear
9
+
10
+ # Clear current test no resources.
11
+ #
12
+ # Set nil to cache after delete resources.
13
+ def self.clear
14
+ # Get current test no.
15
+ test_no = Recot::Cache::StateCache.restore_no
16
+ if test_no
17
+ # Delete resource directory.
18
+ FileUtils.rm_r("#{Recot.resources_dir}/#{test_no}")
19
+
20
+ # Delete resource html file.
21
+ FileUtils.rm("#{Recot.resources_dir}/#{test_no}.html")
22
+
23
+ # Update index html file.
24
+ Recot::Tasks::IndexdocTask.new.run
25
+
26
+ Recot::Cache::StateCache.store_no(nil)
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end