ehbrs-tools 0.3.0 → 0.3.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
  SHA256:
3
- metadata.gz: 9af2ce37dd4cc830a1e3cf86a117060b96d44c0cd9c67c32ec8b6672f506d8cf
4
- data.tar.gz: 1c90f51587a235ce9a6005f0f71cf0a7ef9a8f22bb60fec12e1d2d1d580ac16c
3
+ metadata.gz: b438bde26af678d3677255f2d39bcc65ed81c12b76ae6cf511525162ca9ac817
4
+ data.tar.gz: 73ef2123e1a77fdd3b243ff11b019410fdbd8eabf3017217cec8737b4ee7fe13
5
5
  SHA512:
6
- metadata.gz: 5f6743375b6859c817d3f30c9462d72c734fe152a1f3c2ff271c6a14c6308c71eda14edc28186a0257a7b7cdf5f4ab3a5261a139b24325d0142f35006f58c900
7
- data.tar.gz: b6086fe017cfe6cd127dbf60c8f87a7f8abfce7eb8014d6cb0e7c45a46161e3bc07b49f5c3b312d063b6fad0d528c67645b8e7bd33852961108c0c1ebd9d4ba6
6
+ metadata.gz: 1658664c94ee2c08b6357756255a25007b8e161152d0f859ac3c90c8180cdc9defc268ed00f15f2b6409dd98c25e1a2e824d9313c657d8ad7b4cf05f21c4eb42
7
+ data.tar.gz: 2c5db9ac476c19492481b080fcfd9ba883eb8aef29df3f619523071d5847d044d88cae271e1060a7c1801855e227095390278bdbcfeef55d5a9c85f944f62d69
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
@@ -80,7 +80,7 @@ module Ehbrs
80
80
  end
81
81
 
82
82
  def converted
83
- input + '.converted'
83
+ input.basename_sub { |b| "#{b}.converted" }
84
84
  end
85
85
 
86
86
  def target_extension
@@ -16,7 +16,7 @@ module Ehbrs
16
16
  SUBTITLE_SUPPORTED_CODECS = %w[ass dvd subrip].freeze
17
17
  SUBTITLE_UNSUPPORTED_CODECS = %w[mov].freeze
18
18
 
19
- OTHER_SUPPORTED_CODECS = %w[ttf].freeze
19
+ OTHER_SUPPORTED_CODECS = %w[png ttf].freeze
20
20
 
21
21
  MPEG4_EXTRA_SUPPORTED = %w[xvid].freeze
22
22
  MPEG4_EXTRA_UNSUPPORTED = %w[dx50].freeze
@@ -55,6 +55,10 @@ module EacCli
55
55
  def positional
56
56
  @positional ||= []
57
57
  end
58
+
59
+ def subcommands
60
+ positional << PositionalArgument.new('subcommand', subcommand: true)
61
+ end
58
62
  end
59
63
  end
60
64
  end
@@ -13,9 +13,14 @@ module EacCli
13
13
  OPTION_DESC_SEP = IDENT * 2
14
14
 
15
15
  def positional_argument(positional)
16
- r = "<#{positional.name}>"
17
- r += '...' if positional.repeat?
18
- r
16
+ if positional.subcommand?
17
+ ::EacRubyUtils::Console::DocoptRunner::SUBCOMMANDS_MACRO
18
+ else
19
+ r = "<#{positional.name}>"
20
+ r += '...' if positional.repeat?
21
+ r = "[#{r}]" if positional.optional?
22
+ r
23
+ end
19
24
  end
20
25
 
21
26
  def option_argument(option)
@@ -7,9 +7,17 @@ module EacCli
7
7
  class PositionalArgument
8
8
  common_constructor :name, :options, default: [{}]
9
9
 
10
+ def optional?
11
+ options[:optional]
12
+ end
13
+
10
14
  def repeat?
11
15
  options[:repeat]
12
16
  end
17
+
18
+ def subcommand?
19
+ options[:subcommand]
20
+ end
13
21
  end
14
22
  end
15
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -15,11 +15,10 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.files = Dir['{lib}/**/*', 'MIT-LICENSE', 'README.rdoc']
17
17
 
18
- s.add_dependency 'activesupport', '~> 4.0'
18
+ s.add_dependency 'activesupport', '>= 4.0'
19
19
  s.add_dependency 'addressable', '~> 2.6'
20
20
  s.add_dependency 'colorize', '~> 0.8.1'
21
21
  s.add_dependency 'docopt', '~> 0.6.1'
22
22
  s.add_dependency 'net-ssh', '~> 4.2'
23
- s.add_development_dependency 'rspec', '~> 3.8'
24
- s.add_development_dependency 'rubocop', '~> 0.80.1'
23
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1'
25
24
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EacRubyUtils
4
4
  require 'eac_ruby_utils/arguments_consumer'
5
+ require 'eac_ruby_utils/by_reference'
5
6
  require 'eac_ruby_utils/configs'
6
7
  require 'eac_ruby_utils/console'
7
8
  require 'eac_ruby_utils/contextualizable'
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ class ByReference
5
+ def initialize(&object_provider)
6
+ @object_provider = object_provider
7
+ end
8
+
9
+ def method_missing(method_name, *arguments, &block)
10
+ return object.send(method_name, *arguments) if object.respond_to?(method_name)
11
+
12
+ super
13
+ end
14
+
15
+ def object
16
+ @object_provider.call
17
+ end
18
+
19
+ def respond_to_missing?(method_name, include_private = false)
20
+ object.respond_to?(method_name, include_private)
21
+ end
22
+ end
23
+ end
@@ -3,9 +3,8 @@
3
3
  require 'colorize'
4
4
  require 'io/console'
5
5
  require 'eac_ruby_utils/patches/hash/options_consumer'
6
- require 'eac_ruby_utils/console/speaker/_class_methods'
7
- require 'eac_ruby_utils/console/speaker/list'
8
- require 'eac_ruby_utils/console/speaker/node'
6
+ require 'eac_ruby_utils/require_sub'
7
+ ::EacRubyUtils.require_sub __FILE__
9
8
 
10
9
  module EacRubyUtils
11
10
  module Console
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/by_reference'
4
+
5
+ module EacRubyUtils
6
+ module Console
7
+ # https://github.com/fazibear/colorize
8
+ module Speaker
9
+ STDERR = ::EacRubyUtils::ByReference.new { $stderr }
10
+ STDIN = ::EacRubyUtils::ByReference.new { $stdin }
11
+ STDOUT = ::EacRubyUtils::ByReference.new { $stdout }
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/patches/object/if_present'
4
+ require 'eac_ruby_utils/console/speaker/_constants'
4
5
 
5
6
  module EacRubyUtils
6
7
  module Console
@@ -9,9 +10,9 @@ module EacRubyUtils
9
10
  attr_accessor :stdin, :stdout, :stderr, :stderr_line_prefix
10
11
 
11
12
  def initialize(parent = nil)
12
- self.stdin = parent.if_present(STDIN, &:stdin)
13
- self.stdout = parent.if_present(STDOUT, &:stdout)
14
- self.stderr = parent.if_present(STDERR, &:stderr)
13
+ self.stdin = parent.if_present(::EacRubyUtils::Console::Speaker::STDIN, &:stdin)
14
+ self.stdout = parent.if_present(::EacRubyUtils::Console::Speaker::STDOUT, &:stdout)
15
+ self.stderr = parent.if_present(::EacRubyUtils::Console::Speaker::STDERR, &:stderr)
15
16
  self.stderr_line_prefix = parent.if_present('', &:stderr_line_prefix)
16
17
  end
17
18
 
@@ -9,4 +9,11 @@ class Object
9
9
 
10
10
  block_given? ? yield(self) : self
11
11
  end
12
+
13
+ # @return +yield+ if +self+ is blank.
14
+ def if_blank
15
+ return yield if blank? && block_given?
16
+
17
+ self
18
+ end
12
19
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ class Pathname
6
+ def basename_sub
7
+ parent.join(yield(basename))
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.23.0'
4
+ VERSION = '0.25.0'
5
5
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patches/pathname/basename_sub'
4
+
5
+ RSpec.describe ::Pathname do
6
+ it do
7
+ expect(::Pathname.new('/absolute/path/to/file').basename_sub { |_b| 'other_file' }).to eq(
8
+ ::Pathname.new('/absolute/path/to/other_file')
9
+ )
10
+ end
11
+
12
+ it do
13
+ expect(::Pathname.new('file').basename_sub { |b| b.to_s + '_appended' }).to eq(
14
+ ::Pathname.new('file_appended')
15
+ )
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
+
5
+ RSpec.describe ::RuboCop do
6
+ include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -102,6 +102,7 @@ files:
102
102
  - vendor/eac_ruby_utils/eac_ruby_utils.gemspec
103
103
  - vendor/eac_ruby_utils/lib/eac_ruby_utils.rb
104
104
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/arguments_consumer.rb
105
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/by_reference.rb
105
106
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb
106
107
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb
107
108
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb
@@ -114,6 +115,7 @@ files:
114
115
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb
115
116
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb
116
117
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_class_methods.rb
118
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_constants.rb
117
119
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/list.rb
118
120
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/node.rb
119
121
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb
@@ -157,6 +159,8 @@ files:
157
159
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb
158
160
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb
159
161
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb
162
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname.rb
163
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb
160
164
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb
161
165
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb
162
166
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb
@@ -189,6 +193,7 @@ files:
189
193
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
190
194
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb
191
195
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template
196
+ - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb
192
197
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb
193
198
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb
194
199
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb
@@ -200,6 +205,7 @@ files:
200
205
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file2
201
206
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path2/subdir1/file3.template
202
207
  - vendor/eac_ruby_utils/spec/locales/pt-BR.yml
208
+ - vendor/eac_ruby_utils/spec/rubocop_check_spec.rb
203
209
  - vendor/eac_ruby_utils/spec/spec_helper.rb
204
210
  homepage:
205
211
  licenses: []