iterm2-viewer 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +6 -6
- data/Rakefile +3 -2
- data/bin/iterm2-viewer +24 -15
- data/lib/iterm2/viewer/media.rb +0 -1
- data/lib/iterm2/viewer/version.rb +1 -1
- data/spec/lib/iterm2/viewer/media_spec.rb +20 -0
- data/spec/lib/iterm2/viewer/render_spec.rb +22 -0
- data/{test/lib/iterm2/viewer/test_version.rb → spec/lib/iterm2/viewer/version_spec.rb} +0 -0
- data/{test/media → spec/support}/supported.png +0 -0
- data/{test/media → spec/support}/unsupported.txt +0 -0
- data/{test → spec}/test_helper.rb +2 -1
- metadata +13 -13
- data/test/lib/iterm2/viewer/test_media.rb +0 -20
- data/test/lib/iterm2/viewer/test_render.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82d2b04ac41d01e5c67ef2d497c1e537d2d840d4
|
4
|
+
data.tar.gz: 313c60595ee35131d632d56eb604630136ef8cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c4b8cc964335a74d3f2c6f57ab5f77ce2b2a76a2f96513697581af9adaa49650a854dd98176d147e2ad631b208c9a520c38e112f8b006070aa71712a80ddea
|
7
|
+
data.tar.gz: f8afa082227fb6e61f13dd081338e3a494bc08b7384e1d9796ed87d3a519ea0f73e245600930a0bf4e1169b37c4a0d0f88305fad7b49c6214a7ff0629f3b97af
|
data/Guardfile
CHANGED
@@ -26,12 +26,12 @@ end
|
|
26
26
|
guard :minitest, all_after_pass: true do
|
27
27
|
#guard :minitest do
|
28
28
|
# with Minitest::Unit
|
29
|
-
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
30
|
-
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
31
|
-
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
29
|
+
#watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
30
|
+
#watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
31
|
+
#watch(%r{^test/test_helper\.rb$}) { 'test' }
|
32
32
|
|
33
33
|
# with Minitest::Spec
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
watch(%r{^spec/(.*)\/?spec_(.*)\.rb$})
|
35
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}spec_#{m[2]}.rb" }
|
36
|
+
watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
37
37
|
end
|
data/Rakefile
CHANGED
data/bin/iterm2-viewer
CHANGED
@@ -16,35 +16,44 @@ module Iterm2
|
|
16
16
|
class << self
|
17
17
|
def show(arguments)
|
18
18
|
# initialize whenever application called from iTerm2 with arguments
|
19
|
-
return unless ENV['TERM_PROGRAM'] == 'iTerm.app' || arguments.nil?
|
19
|
+
return unless ENV['TERM_PROGRAM'] == 'iTerm.app' || !arguments.nil?
|
20
20
|
|
21
21
|
# catch options
|
22
22
|
if arguments[0] =~ /^(-\w|--\w{2,}?)$/
|
23
|
-
# @todo
|
24
|
-
# @todo
|
23
|
+
# @todo Refactoring is needed
|
24
|
+
# @todo Notification, command not found
|
25
25
|
version if arguments[0].to_s == '--version' || arguments[0].to_s == '-v'
|
26
26
|
# switch to renders
|
27
27
|
else
|
28
28
|
# clean entire screen
|
29
|
-
# todo
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
# @todo Optimize (fit to enitre screen)
|
30
|
+
|
31
|
+
# prerapre media files for render
|
32
|
+
render arguments
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Preare routes argumetns to render
|
37
|
+
#
|
38
|
+
# @param routes [Array] parameters with path to file
|
39
|
+
def render(objects)
|
40
|
+
return if objects.nil?
|
41
|
+
print "\e[2J\e[f"
|
42
|
+
objects.each do |o|
|
43
|
+
begin
|
44
|
+
Render.new(Media.new o).reveal
|
45
|
+
rescue ArgumentError
|
46
|
+
next
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
43
50
|
|
51
|
+
# Display current version of application
|
52
|
+
#
|
53
|
+
# @return [String] Constant of version of application
|
44
54
|
def version
|
45
55
|
abort VERSION
|
46
56
|
end
|
47
|
-
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
data/lib/iterm2/viewer/media.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Iterm2::Viewer::Media do
|
4
|
+
it 'media will not be created without route argument' do
|
5
|
+
assert_raises ArgumentError do
|
6
|
+
Iterm2::Viewer::Media.new
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'media will not be created with incorrect route argument' do
|
11
|
+
assert_raises ArgumentError do
|
12
|
+
Iterm2::Viewer::Media.new 'String'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'media will be created if route and mime argument is correct' do
|
17
|
+
file = File.absolute_path(File.dirname(__FILE__) + '../../../../support/supported.png')
|
18
|
+
Iterm2::Viewer::Media.new(file).wont_be_empty
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Iterm2::Viewer::Render do
|
4
|
+
it 'renderer will not be created without media object as argument' do
|
5
|
+
assert_raises ArgumentError do
|
6
|
+
Iterm2::Viewer::Render.new
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'renderer will not be initialized with incorrect object argument' do
|
11
|
+
assert_raises ArgumentError do
|
12
|
+
Iterm2::Viewer::Render.new 'String'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'render will be initialized if object type will be correct' do
|
17
|
+
file = File.absolute_path(File.dirname(__FILE__) + '../../../../support/supported.png')
|
18
|
+
media = Iterm2::Viewer::Media.new(file)
|
19
|
+
|
20
|
+
Iterm2::Viewer::Render.new(media).wont_be_nil
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iterm2-viewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Antipov
|
@@ -274,12 +274,12 @@ files:
|
|
274
274
|
- lib/iterm2/viewer/media.rb
|
275
275
|
- lib/iterm2/viewer/render.rb
|
276
276
|
- lib/iterm2/viewer/version.rb
|
277
|
-
-
|
278
|
-
-
|
279
|
-
-
|
280
|
-
-
|
281
|
-
-
|
282
|
-
-
|
277
|
+
- spec/lib/iterm2/viewer/media_spec.rb
|
278
|
+
- spec/lib/iterm2/viewer/render_spec.rb
|
279
|
+
- spec/lib/iterm2/viewer/version_spec.rb
|
280
|
+
- spec/support/supported.png
|
281
|
+
- spec/support/unsupported.txt
|
282
|
+
- spec/test_helper.rb
|
283
283
|
homepage: https://github.com/AndreyAntipov/iterm2-viewer
|
284
284
|
licenses:
|
285
285
|
- MIT
|
@@ -305,10 +305,10 @@ signing_key:
|
|
305
305
|
specification_version: 4
|
306
306
|
summary: Utility for view images in the terminal
|
307
307
|
test_files:
|
308
|
-
-
|
309
|
-
-
|
310
|
-
-
|
311
|
-
-
|
312
|
-
-
|
313
|
-
-
|
308
|
+
- spec/lib/iterm2/viewer/media_spec.rb
|
309
|
+
- spec/lib/iterm2/viewer/render_spec.rb
|
310
|
+
- spec/lib/iterm2/viewer/version_spec.rb
|
311
|
+
- spec/support/supported.png
|
312
|
+
- spec/support/unsupported.txt
|
313
|
+
- spec/test_helper.rb
|
314
314
|
has_rdoc:
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe Iterm2::Viewer::Media do
|
4
|
-
it 'media will not be created without route argument' do
|
5
|
-
assert_raises ArgumentError do
|
6
|
-
Iterm2::Viewer::Media.new
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'media will not be created with incorrect route argument' do
|
11
|
-
assert_raises ArgumentError do
|
12
|
-
Iterm2::Viewer::Media.new 'String'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'media will be created if route and mime argument is correct' do
|
17
|
-
file = File.absolute_path(__dir__ + '/../../../media/supported.png')
|
18
|
-
Iterm2::Viewer::Media.new(file).wont_be_empty
|
19
|
-
end
|
20
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
|
4
|
-
describe Iterm2::Viewer::Render do
|
5
|
-
it 'renderer will not be created without media object as argument' do
|
6
|
-
assert_raises ArgumentError do
|
7
|
-
Iterm2::Viewer::Render.new
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'renderer will not be initialized with incorrect object argument' do
|
12
|
-
assert_raises ArgumentError do
|
13
|
-
Iterm2::Viewer::Render.new 'String'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'render will be initialized if object type will be correct' do
|
18
|
-
file = File.absolute_path(__dir__ + '/../../../media/supported.png')
|
19
|
-
media = Iterm2::Viewer::Media.new(file)
|
20
|
-
|
21
|
-
Iterm2::Viewer::Render.new(media).wont_be_nil
|
22
|
-
end
|
23
|
-
end
|