recot 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96c534505e5416224fc434e3506543ee7fac9c53
4
- data.tar.gz: 33efcbe72b012be05dfda47d3dafef098a098dbb
3
+ metadata.gz: fe31131b31eeabb365a4d3b1fb8b93604205dac9
4
+ data.tar.gz: 439362ae55e5316cffc7dc4cb46e2088d0e004a0
5
5
  SHA512:
6
- metadata.gz: a8c113ea40eccb21e9f89d5f7d9317e31c0a80950559f0bd297a9f508eba807012b5b906692e594b86e9a89e080b978c25eec32b69a04ac2528ffff8fb865034
7
- data.tar.gz: 784c38ed79d0c5eb0df29e93ea621fb814b104aebf6b7f18ea600fbdacc673b6571c56f73a52645f8b1674b8abf6cb7a39189b26fd567b3e63f5cebd4f2b3ebe
6
+ metadata.gz: fb63a9558b651e5ffa1ed7222409630fb17ce8111ed5010be344b8262da0c771309f0aaafa5efe6eafd2c22c61250d3f265b52de84ad8fefac63503e7a287eef
7
+ data.tar.gz: 69849627fa9cb5bfef103e049cef011d17680cf3aff8c59da1a6808be1754120163d0fa29b59d9a5840b1e0b75187ad61d7aef976a8a1b5d1a919d162d29200b
data/.gitignore CHANGED
@@ -41,3 +41,6 @@ Gemfile.lock
41
41
  /log/
42
42
  .cahce
43
43
  config.yml
44
+
45
+ # Mac OS
46
+ .DS_Store
data/README.md CHANGED
@@ -20,11 +20,41 @@ gem install recot
20
20
  ```
21
21
  ## Usage
22
22
 
23
+ #### Recot command
24
+
25
+ ```sh
26
+ $ rect <command>
27
+ ```
28
+
29
+ |Command|Description|
30
+ |:------|:----------|
31
+ |start|Start recot to collect evidence.|
32
+ |cleanup|Clean up cache.|
33
+ |destroy|Delete all file.|
34
+
35
+ If you want to delete cacche.
36
+ run the following command:
37
+
38
+ ```sh
39
+ $ recot cleanup
40
+ ```
41
+
42
+ If you want to delete all file and directory,
43
+ run the following command:
44
+
45
+ ```sh
46
+ $ recot destroy
47
+ Sure you want to delete all the files? [y/N] > y
48
+ Removed all dependency files.
49
+ ```
50
+
51
+ #### Start recot
52
+
23
53
  To begin the test with the following command:
24
54
 
25
55
  ```sh
26
56
  $ recot start
27
- Start recot ver 0.2.0
57
+ Start recot ver 0.2.1
28
58
 
29
59
  ____ __
30
60
  / __ \___ _________ / /
@@ -33,6 +63,17 @@ Start recot ver 0.2.0
33
63
  /_/ |_|\___/\___/\____/\__/
34
64
  ```
35
65
 
66
+ ###### Options
67
+
68
+ `recot start` command has the following options:
69
+
70
+ |Option|Command|Description|Default|
71
+ |:-----|:------|:----------|:------|
72
+ |port|-p, --port|Set server port.|9292|
73
+ |open|-o, --open|Open top page by default browser.|nil|
74
+
75
+ ###### Interactive command
76
+
36
77
  Enter the test number as follows:
37
78
 
38
79
  ```sh
@@ -72,6 +113,21 @@ access the http://localhost:9292/__output/index.html
72
113
  When you click the image to display the popup.
73
114
  ![img003](http://slowhand0309.github.io/images/recot/popup.png)
74
115
 
116
+ If you want to output the contents of the clipboard as a log, run the following command:
117
+
118
+ ```sh
119
+ [2](recot) > paste <filename>
120
+ ```
121
+
122
+ e.g.
123
+
124
+ ※ State that has already been copied to the clipboard.
125
+ ```sh
126
+ [1](recot) > A100
127
+ [2](recot) > paste copy.log
128
+ ```
129
+ `copy.log` is output to the location of the `__output/resource/A100/`.
130
+
75
131
  If you want to delete the previous evidence, run the following command:
76
132
 
77
133
  ```sh
@@ -90,12 +146,6 @@ If you want to test the end, run the following command:
90
146
  [4](recot) > exit
91
147
  ```
92
148
 
93
- If you want to delete all file and directory,
94
- run the following command:
95
-
96
- ```sh
97
- [5](recot) > destroy
98
- ```
99
149
 
100
150
  ## Configuration
101
151
 
@@ -125,6 +175,15 @@ theme: "white"
125
175
  ```
126
176
 
127
177
 
178
+ > ProjectName
179
+
180
+ You can set a project name for evidecnce.
181
+
182
+ Set the following in 'config.yml'.
183
+ ```yml
184
+ project_name: "Your project name"
185
+ ```
186
+
128
187
  ## Licence
129
188
 
130
189
  [MIT](https://github.com/tcnksm/tool/blob/master/LICENCE)
data/bin/recot CHANGED
@@ -13,8 +13,12 @@ class RecotExecutable
13
13
 
14
14
  cmd.desc 'Server listen port'
15
15
  cmd.flag [:p, :port], default_value: 9292
16
+
17
+ cmd.desc 'Open default browser'
18
+ cmd.switch [:o, :open]
19
+
16
20
  cmd.action do |_, options, _|
17
- Recot::Commands.start(options[:port])
21
+ Recot::Commands.start(options[:port], options[:open])
18
22
  end
19
23
  end
20
24
 
@@ -5,6 +5,7 @@ require 'recot/commands/guard_server'
5
5
  require 'recot/commands/interactive_ui'
6
6
  require 'recot/commands/listener'
7
7
  require 'recot/utils/recot_util'
8
+ require 'recot/utils/browser_util'
8
9
 
9
10
  module Recot
10
11
  module Commands
@@ -13,7 +14,7 @@ module Recot
13
14
  #
14
15
  # == Parameters:
15
16
  # Server listen port.
16
- def self.start(port = nil)
17
+ def self.start(port, open)
17
18
 
18
19
  # Prepare.
19
20
  Utils::RecotUtil.prepare
@@ -29,6 +30,11 @@ module Recot
29
30
  # Start listener.
30
31
  Listener.new.run
31
32
 
33
+ # Open browser.
34
+ if open
35
+ Utils::BrowserUtil.open(port)
36
+ end
37
+
32
38
  # Start interactive operate.
33
39
  InteractiveUi.new.start
34
40
  end
@@ -1,5 +1,6 @@
1
1
  # coding: utf-8
2
2
  require 'recot/utils/recot_util'
3
+ require 'recot/utils/clipboard_util'
3
4
  require 'recot/commands/recent_cancel'
4
5
  require 'recot/commands/current_clear'
5
6
  require 'recot/commands/tree_generator'
@@ -17,7 +18,7 @@ module Recot
17
18
  count = 1
18
19
  loop do
19
20
 
20
- print "[#{count}](recot) > "
21
+ print "\e[33m[#{count}](recot) > \e[0m"
21
22
  input_str = STDIN.gets.chomp
22
23
  case input_str
23
24
  when /[Ee]xit/
@@ -28,6 +29,9 @@ module Recot
28
29
  when /[Cc]lear/
29
30
  # Clear current test no.
30
31
  CurrentClear.clear
32
+ when /[Pp]aste ([a-zA-Z\d.]*)/
33
+ # Output file from clipboard.
34
+ Utils::ClipboardUtil.paste_out($1)
31
35
  when /\d{1,3}(-\d{1,3})?(-\d{1,3})?/
32
36
  # Generate tree.
33
37
  TreeGenerator.generate(input_str)
@@ -7,11 +7,8 @@ module Recot
7
7
  module Commands
8
8
  class RackServer
9
9
 
10
- DEF_PORT = 9292
11
-
12
- def initialize(port = nil)
10
+ def initialize(port)
13
11
  @port = port
14
- @port ||= DEF_PORT
15
12
  end
16
13
 
17
14
  def run
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ module Recot
4
+ module Utils
5
+ class BrowserUtil
6
+
7
+ class << self
8
+
9
+ # Open browser at argument url.
10
+ #
11
+ # == Parameters:
12
+ # Server listen port.
13
+ def open(port)
14
+
15
+ url = "http://localhost:#{port}/__output/index.html"
16
+
17
+ if RUBY_PLATFORM =~ /darwin/
18
+ # Mac OS
19
+ system "open #{url}"
20
+ elsif RUBY_PLATFORM =~ /mswin(?!ce)|mingw|cygwin|bccwin/
21
+ # Windows
22
+ system "start #{url}"
23
+ else
24
+ puts "Unsupport platform of open browser."
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ require 'clipboard'
3
+
4
+ module Recot
5
+ module Utils
6
+ class ClipboardUtil
7
+
8
+ class << self
9
+
10
+ # Output file from clipboard.
11
+ #
12
+ # == Parameters:
13
+ # A file name
14
+ def paste_out(filename)
15
+
16
+ text = Clipboard.paste
17
+ unless text.to_s.empty?
18
+ path = "#{Recot.basket_dir}/#{filename}"
19
+ open(path, 'w') do |f|
20
+ f.write text
21
+ end
22
+ else
23
+ puts "\e[31mClipboard empty!\e[0m"
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+
3
+ module Recot
4
+ module Utils
5
+ class ScreencapUtil
6
+
7
+ class << self
8
+
9
+ # Capture full screen.
10
+ #
11
+ # == Parameters:
12
+ # Output filename
13
+ def capture(filename)
14
+
15
+ if RUBY_PLATFORM =~ /darwin/
16
+ # Mac OS
17
+ system("screencapture -x basket/#{filename}")
18
+ elsif RUBY_PLATFORM =~ /mswin(?!ce)|mingw|cygwin|bccwin/
19
+ # Windows
20
+ else
21
+ puts "Unsupport platform of screencapture."
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Recot
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "listen", "= 3.0.6"
30
30
  spec.add_runtime_dependency "activesupport", "~> 4.0"
31
31
  spec.add_runtime_dependency "wdm", ">= 0.1.0" if Gem.win_platform?
32
+ spec.add_runtime_dependency "clipboard", "~> 1.1"
33
+ spec.add_runtime_dependency "ffi", "~> 1.9" if Gem.win_platform?
32
34
 
33
35
  # Development Dependencies
34
36
  spec.add_development_dependency "rake", "~> 10.0"
@@ -9,7 +9,7 @@
9
9
  </head>
10
10
  <body>
11
11
  <div id="header">
12
- <p>Evidence lists by Recot.</p>
12
+ <p><%= data[:title] %> Project Evidence lists by Recot.</p>
13
13
  </div>
14
14
  <h4>Evidences</h4>
15
15
  <hr>
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - slowhand0309
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-24 00:00:00.000000000 Z
11
+ date: 2016-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: clipboard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.1'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.1'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +184,10 @@ files:
170
184
  - lib/recot/tasks/indexdoc_task.rb
171
185
  - lib/recot/tasks/resdoc_task.rb
172
186
  - lib/recot/tasks/sync_task.rb
187
+ - lib/recot/utils/browser_util.rb
188
+ - lib/recot/utils/clipboard_util.rb
173
189
  - lib/recot/utils/recot_util.rb
190
+ - lib/recot/utils/screencap_util.rb
174
191
  - lib/recot/version.rb
175
192
  - recot.gemspec
176
193
  - template/css/lightbox.min.css