ru2 2.3.0 → 2.3.1

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: d0536fe1c8900ffd299e5f3666f8ecfc195d49be
4
- data.tar.gz: bc6f5b8e13b5e04ddfa70f64991b94ce7954cc0e
3
+ metadata.gz: 2bf8b7e55213af2a3730866b3d572d3268eab750
4
+ data.tar.gz: c858b907bfceb9f97a705eee4c572a764bd7ee55
5
5
  SHA512:
6
- metadata.gz: 8d0ef79e16ba11a219d495497d41bf48977d206182cd6e26f91790f98c012f61cb59a9055d5b7b149ebfe420b76165b082f78c715fef0159a6dc2a0ee514c412
7
- data.tar.gz: b43bb28b93d67d31879a35ad6046b93176690e852aafd721a8015e49a40e669055ca73bd16e2ca8da20e1b7574b81c210dca92e5586690315ce3834736ffcad1
6
+ metadata.gz: dd8136cbc35266aeee002efb7728e9ff4b62a00e987c08550540f1677f3500c1b3ae10aa27ce6d5128836cc1b9bc1fbadf7d2f13c894f7e8bdf24c3f39f6d595
7
+ data.tar.gz: 7776259585c4a6a54b484711649d92327dd9761dcfd663a2930a44924a11583cb58344ee7640071f81bbbdb9d14555e768229dd1e4489089d12c6c8b02bd9da7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- ru2 (2.3.0)
4
+ ru2 (2.3.1)
5
5
  activesupport (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- ru2 (2.3.0)
4
+ ru2 (2.3.1)
5
5
  activesupport (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- ru2 (2.3.0)
4
+ ru2 (2.3.1)
5
5
  activesupport (>= 3.2.0)
6
6
 
7
7
  GEM
data/lib/ru.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'active_support/all'
2
-
3
1
  directory = File.dirname(File.absolute_path(__FILE__))
4
2
  Dir.glob("#{directory}/ru/*.rb") { |file| require file }
5
3
 
@@ -1,9 +1,10 @@
1
1
  require 'erb'
2
+ require 'ostruct'
2
3
 
3
4
  module Ru
4
5
  class OptionPrinter
5
6
  def exists?(option_key)
6
- options[option_key].present?
7
+ ! (options[option_key].nil? || options[option_key].empty?)
7
8
  end
8
9
 
9
10
  def run(option_key, option_value=nil)
data/lib/ru/process.rb CHANGED
@@ -14,7 +14,7 @@ module Ru
14
14
  args = ARGV.dup
15
15
  @code = args.shift
16
16
 
17
- if @code.blank?
17
+ if @code.empty?
18
18
  $stderr.puts @option_printer.run(:help)
19
19
  return
20
20
  end
@@ -43,7 +43,13 @@ module Ru
43
43
  end
44
44
  end
45
45
 
46
- output = context.instance_eval(@parsed[:code])
46
+ begin
47
+ output = context.instance_eval(@parsed[:code])
48
+ rescue NoMethodError
49
+ require 'active_support/all'
50
+
51
+ output = context.instance_eval(@parsed[:code])
52
+ end
47
53
  output = @stdin if output == nil
48
54
 
49
55
  prepare_output(output)
@@ -58,6 +64,7 @@ module Ru
58
64
  elsif code.start_with?('=')
59
65
  { code: code[1..-1], get_stdin: false }
60
66
  elsif code.start_with?('!')
67
+ require 'active_support/deprecation'
61
68
  ActiveSupport::Deprecation.warn %('!1+2' syntax is going to be replaced with '=1+2')
62
69
  { code: code[1..-1], get_stdin: false }
63
70
  else
@@ -108,7 +115,7 @@ module Ru
108
115
  end
109
116
 
110
117
  def get_stdin(paths, stream)
111
- if paths.present?
118
+ if ! paths.empty?
112
119
  if stream
113
120
  ::File.open(paths[0])
114
121
  else
data/lib/ru/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ru
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Benner