iterm2-viewer 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e669b5969e6184f423ac372b5fc2dec5d8a29f40
4
- data.tar.gz: ce0019766d06fc9b4f263ed531033e252268df0c
3
+ metadata.gz: 832d19f977fb9f52c754339921906db1b41975e0
4
+ data.tar.gz: a5ea41ede95ac467e297d87df41f702d0d2f381a
5
5
  SHA512:
6
- metadata.gz: 3645f7d37581fd296342db543c593b2d31e6787b3894951db07097657167ef454a11f37ae3449bb514b1cdecd649a6ebc493410dd8d1c1f49f4be45e7d49556b
7
- data.tar.gz: 56e3b46fd2d1455445f6d0179e2679f4b6dd89f5db3abe42b56751143d3130f628c3b01b250c9bf47476d591482922983b32da6b44921d952174b36d582d31d6
6
+ metadata.gz: 82a9726452593757dc86e15ab3cd3b2b1569fa7ff9d1ceff89eae82ba90c75e4766a3095a7f7bbd265a0e5bd143a7212f47cc649acad5f18081b43cc123f7686
7
+ data.tar.gz: 36852f9fc8071c2cc71b85da6d7adefcba7bbc3ce074a2b8c26f601f6cb7930381ee3825688578185acf049eeb336515f2363b0dbbac0d83f7bb6069bb1e05ba
data/.cfg.reek ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ UncommunicativeMethodName:
3
+ enabled: false
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Style/FileName:
2
+ Enabled: false
3
+
4
+ Metrics/LineLength:
5
+ Max: 100
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - 'Guardfile'
10
+ - '*.gemspec'
data/.travis.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
- gemfile:
3
- - gemfiles/Gemfile
4
- addons:
5
- code_climate:
6
- repo_token: ab8664da98d6bfb6a14e4bd439bb87efe95b19785f42ba496077b3fd5ef3ecc3
7
2
  rvm:
8
3
  - 2.1.1
9
4
  - 2.0.0
10
5
  - 1.9.3
11
- #cache: bundler
6
+ - 1.8.7
7
+ addons:
8
+ code_climate:
9
+ repo_token: ab8664da98d6bfb6a14e4bd439bb87efe95b19785f42ba496077b3fd5ef3ecc3
10
+ install: bundle install
11
+ cache: bundler
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private
2
+ lib/test/**/*.rb
3
+ -
4
+ *.txt
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  group :test do
4
4
  gem 'rake'
5
- gem "codeclimate-test-reporter", require: nil
5
+ gem 'codeclimate-test-reporter', require: nil
6
6
  end
7
7
 
8
8
  # Specify your gem's dependencies in iterm2-viewer.gemspec
data/Guardfile CHANGED
@@ -24,7 +24,8 @@ guard :yard do
24
24
  watch(%r{lib/.+\.rb})
25
25
  end
26
26
 
27
- guard :minitest do
27
+ guard :minitest, all_after_pass: true do
28
+ #guard :minitest do
28
29
  # with Minitest::Unit
29
30
  watch(%r{^test/(.*)\/?test_(.*)\.rb$})
30
31
  watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
data/README.md CHANGED
@@ -4,9 +4,12 @@
4
4
  [![Build Status](https://travis-ci.org/AndreyAntipov/iterm2-viewer.svg?branch=master)](https://travis-ci.org/AndreyAntipov/iterm2-viewer)
5
5
  [![Test Coverage](https://codeclimate.com/github/AndreyAntipov/iterm2-viewer/badges/coverage.svg)](https://codeclimate.com/github/AndreyAntipov/iterm2-viewer)
6
6
 
7
- # iterm2-viewer
7
+ # 💎 iterm2-viewer
8
+ Utility for view images in the terminal
9
+
10
+ 📎 Note: currently work only in mac iTerm2-nightly
11
+
8
12
 
9
- Display media files in terminal. iTerm2-nightly is required
10
13
 
11
14
  ## Supported types
12
15
  - png
@@ -14,6 +17,8 @@ Display media files in terminal. iTerm2-nightly is required
14
17
  - tiff
15
18
  - gif
16
19
 
20
+
21
+
17
22
  ## Installation
18
23
 
19
24
  Add this line to your application's Gemfile:
@@ -30,6 +35,8 @@ Or install it yourself as:
30
35
 
31
36
  $ gem install iterm2-viewer
32
37
 
38
+
39
+
33
40
  ## Usage
34
41
 
35
42
  ```ruby
@@ -39,20 +46,30 @@ display multiple images
39
46
  ```ruby
40
47
  iterm2-viewer IMAGE_FILE_1_PATH IMAGE_FILE_2_PATH
41
48
  ```
42
- ---
43
49
 
50
+ ##### Options
51
+ | Key | Action |
52
+ |:------------------|:-----------------------------:|
53
+ | `-v` or `--version` | show current version |
54
+
55
+
56
+ ## How it look like
44
57
  ![How it look like 1](https://raw.githubusercontent.com/AndreyAntipov/iterm2-viewer/media/screenshot_1.png "How it look like 1")
45
58
 
46
59
  ![How it look like 2](https://raw.githubusercontent.com/AndreyAntipov/iterm2-viewer/media/screenshot_2.png "How it look like 2")
47
60
 
48
61
  ---
49
62
 
63
+
64
+
50
65
  ## License
51
66
 
52
67
  The MIT License (MIT)
53
68
 
54
69
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions in [LICENSE.txt](https://github.com/AndreyAntipov/iterm2-viewer/blob/master/LICENSE.txt)
55
70
 
71
+
72
+
56
73
  ## Contributing
57
74
 
58
75
  1. Fork it ( https://github.com/AndreyAntipov/iterm2-viewer/fork )
data/Rakefile CHANGED
@@ -1,9 +1,13 @@
1
1
  require 'rake/testtask'
2
2
 
3
3
  Rake::TestTask.new do |t|
4
- t.libs << 'test'
5
- # t.warning = true
6
- #t.verbose = true
7
- t.pattern = "test/**/test_*.rb"
4
+ t.libs << 'test'
5
+ t.pattern = 'test/**/test_*.rb'
8
6
  end
9
- task :default => [:test]
7
+
8
+ desc 'Guard'
9
+ task :guard do
10
+ exec('bundle exec guard')
11
+ end
12
+
13
+ task default: [:test]
data/bin/iterm2-viewer CHANGED
@@ -7,21 +7,21 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
7
7
  require 'iterm2/viewer'
8
8
 
9
9
  module Iterm2
10
+ # Display media files in command line
10
11
  module Viewer
11
12
  # Command line interface
12
13
  # @param [String, #arguments] routes to files
13
14
  class << self
14
- def show(arguments)
15
- # show current version
16
- puts VERSION if arguments[0].to_s == "--version" || arguments[0].to_s == "-v"
17
-
15
+ def show(arguments)
18
16
  # initialize whenever application called from iTerm2
19
- if ENV['TERM_PROGRAM'] == 'iTerm.app'
20
- arguments.each do |route|
21
- Render.new(Media.new route) if File.file? route
22
- end
23
- end
24
- end
17
+ return unless ENV['TERM_PROGRAM'] == 'iTerm.app'
18
+
19
+ # show current version
20
+ puts VERSION if arguments[0].to_s == '--version' || arguments[0].to_s == '-v'
21
+
22
+ # initialize routes
23
+ arguments.each { |route| Render.new(Media.new route) if File.file? route }
24
+ end
25
25
  end
26
26
  end
27
27
  end
@@ -6,10 +6,11 @@ require 'iterm2/viewer/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'iterm2-viewer'
8
8
  spec.version = Iterm2::Viewer::VERSION
9
- spec.authors = ['Andrey']
9
+ spec.authors = ['Andrey Antipov']
10
10
  spec.email = ['andrey@antipov.me']
11
- spec.summary = %q{Display media files in iTerm2.}
12
- spec.description = %q{Display media files in terminal. iTerm2 is required}
11
+ spec.summary = %q(Utility for view images in the terminal)
12
+ spec.description = %q(Utility for view images in the terminal. iTerm2-nightly is required)
13
+ spec.extra_rdoc_files = ['LICENSE.txt', 'README.md']
13
14
  spec.homepage = 'https://github.com/AndreyAntipov/iterm2-viewer'
14
15
  spec.license = 'MIT'
15
16
 
data/lib/iterm2/viewer.rb CHANGED
@@ -3,6 +3,7 @@ require 'iterm2/viewer/media'
3
3
  require 'iterm2/viewer/render'
4
4
 
5
5
  module Iterm2
6
+ # Display media files in command line
6
7
  module Viewer
7
8
  end
8
9
  end
@@ -6,11 +6,14 @@ module Iterm2
6
6
  require 'mime/types'
7
7
  require 'base64'
8
8
 
9
+ # Validate and construct media object
10
+ #
11
+ # @param object [String] file path which are need to open
9
12
  def initialize(object)
10
13
  @mime ||= MIME::Types.of(object).first
11
14
 
12
15
  # Raise error an error if file type isn't supported
13
- raise TypeError unless renderable?
16
+ fail TypeError unless renderable?
14
17
 
15
18
  @data ||= renderable? ? construct(object) : nil
16
19
  end
@@ -19,14 +22,16 @@ module Iterm2
19
22
  attr_reader :data
20
23
 
21
24
  # Construct base64 blob from binary
22
- # @param [String] file which are need to open
25
+ #
26
+ # @param object [String] file path which are need to open
23
27
  # @return [String] base64 data of binary file
24
28
  def construct(object)
25
29
  Base64.encode64(open(object).read)
26
30
  end
27
31
 
28
32
  # Helper method.
29
- # Detect current kind such as (application, image, document) and so on of selected file
33
+ # Detect current kind such as (application, image, document)
34
+ #
30
35
  # @return [String] current kind of file
31
36
  def kind
32
37
  @mime.media_type.to_sym
@@ -34,6 +39,7 @@ module Iterm2
34
39
 
35
40
  # Helper method.
36
41
  # Detect current type such as (.png, .pdf, .txt) and so on of se
42
+ #
37
43
  # @return [String] current type of file
38
44
  def type
39
45
  @mime.sub_type
@@ -4,9 +4,9 @@ module Iterm2
4
4
  # @param object [Iterm2::Viewer::Entity]
5
5
  class Render
6
6
  def initialize(object)
7
- raise ArgumentError, "incorrect media file" unless object.is_a? Iterm2::Viewer::Media
7
+ fail ArgumentError, 'incorrect media file' unless object.is_a? Iterm2::Viewer::Media
8
8
  # @see http://iterm2.com/images.html
9
- # @note based on https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat
9
+ # @note https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat
10
10
  puts "\033]1337;File=;inline=1:#{object.data}\a\n"
11
11
  end
12
12
  end
@@ -1,5 +1,7 @@
1
1
  module Iterm2
2
+ # Display media files in command line
2
3
  module Viewer
3
- VERSION = '0.0.5'
4
+ # Current version of application
5
+ VERSION = '0.0.6'
4
6
  end
5
7
  end
@@ -1,13 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
+ # Testing media object
3
4
  class Media < Minitest::Test
4
-
5
5
  def object_will_not_created_with_unsupported_type
6
- skip "this test will pass later"
6
+ skip 'this test will pass later'
7
7
  end
8
8
 
9
9
  def object_will_be_rendered_with_supported_type
10
- skip "this test will pass later"
10
+ skip 'this test will pass later'
11
11
  end
12
-
13
12
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
+ # Testing render class
3
4
  class Render < Minitest::Test
4
-
5
5
  def test_that_object_will_not_render_until_argument_isnt_set
6
6
  assert_raises ArgumentError do
7
7
  Render.new
@@ -9,13 +9,10 @@ class Render < Minitest::Test
9
9
  end
10
10
 
11
11
  def test_that_object_will_not_rendered_with_wrong_type_of_object
12
- assert_raises ArgumentError do
13
- Render.new "wrong type of object"
14
- end
12
+ skip 'this test will pass later'
15
13
  end
16
14
 
17
15
  def test_that_object_will_render_with_correct_type_of_object
18
- skip "this test will pass later"
16
+ skip 'this test will pass later'
19
17
  end
20
-
21
18
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  describe Iterm2::Viewer do
4
- it "must be defined" do
5
- Iterm2::Viewer::VERSION.wont_be_nil
6
- end
4
+ it 'must be defined' do
5
+ Iterm2::Viewer::VERSION.wont_be_nil
6
+ end
7
7
  end
Binary file
@@ -0,0 +1 @@
1
+ plain text
data/test/test_helper.rb CHANGED
@@ -1,8 +1,9 @@
1
+ if ENV['CODECLIMATE_REPO_TOKEN']
2
+ require 'codeclimate-test-reporter'
3
+ CodeClimate::TestReporter.start
4
+ end
5
+
1
6
  require 'minitest/autorun'
2
7
  require 'minitest/unit'
3
8
  require 'minitest/pride'
4
9
  require File.expand_path('../../lib/iterm2/viewer.rb', __FILE__)
5
-
6
- require 'codeclimate-test-reporter'
7
-
8
- CodeClimate::TestReporter.start
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iterm2-viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
- - Andrey
7
+ - Andrey Antipov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -248,16 +248,21 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
- description: Display media files in terminal. iTerm2 is required
251
+ description: Utility for view images in the terminal. iTerm2-nightly is required
252
252
  email:
253
253
  - andrey@antipov.me
254
254
  executables:
255
255
  - iterm2-viewer
256
256
  extensions: []
257
- extra_rdoc_files: []
257
+ extra_rdoc_files:
258
+ - LICENSE.txt
259
+ - README.md
258
260
  files:
261
+ - ".cfg.reek"
259
262
  - ".gitignore"
263
+ - ".rubocop.yml"
260
264
  - ".travis.yml"
265
+ - ".yardopts"
261
266
  - Gemfile
262
267
  - Guardfile
263
268
  - LICENSE.txt
@@ -269,12 +274,11 @@ files:
269
274
  - lib/iterm2/viewer/media.rb
270
275
  - lib/iterm2/viewer/render.rb
271
276
  - lib/iterm2/viewer/version.rb
272
- - test/coverage/.last_run.json
273
- - test/coverage/.resultset.json
274
- - test/coverage/.resultset.json.lock
275
277
  - test/lib/iterm2/viewer/test_media.rb
276
278
  - test/lib/iterm2/viewer/test_render.rb
277
279
  - test/lib/iterm2/viewer/test_version.rb
280
+ - test/media/supported
281
+ - test/media/unsupported
278
282
  - test/test_helper.rb
279
283
  homepage: https://github.com/AndreyAntipov/iterm2-viewer
280
284
  licenses:
@@ -299,13 +303,12 @@ rubyforge_project:
299
303
  rubygems_version: 2.2.2
300
304
  signing_key:
301
305
  specification_version: 4
302
- summary: Display media files in iTerm2.
306
+ summary: Utility for view images in the terminal
303
307
  test_files:
304
- - test/coverage/.last_run.json
305
- - test/coverage/.resultset.json
306
- - test/coverage/.resultset.json.lock
307
308
  - test/lib/iterm2/viewer/test_media.rb
308
309
  - test/lib/iterm2/viewer/test_render.rb
309
310
  - test/lib/iterm2/viewer/test_version.rb
311
+ - test/media/supported
312
+ - test/media/unsupported
310
313
  - test/test_helper.rb
311
314
  has_rdoc:
@@ -1,5 +0,0 @@
1
- {
2
- "result": {
3
- "covered_percent": 100.0
4
- }
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "MiniTest": {
3
- "coverage": {
4
- },
5
- "timestamp": 1416492861
6
- }
7
- }
File without changes