gelauto 1.0.2 → 1.1.0

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
  SHA256:
3
- metadata.gz: d97bd374e9ddac071ce062021c85586fee74d6245b6f399cbaed3557253c3b6a
4
- data.tar.gz: 83dc502a3e6d740fa33961848543f7773414f543e1748b159a4dfee88ce566e3
3
+ metadata.gz: 9f30fb13511510689896025318cf0e8ab0683858b6de8dc842ed4a208e25b707
4
+ data.tar.gz: 84a29515b428bdef7ea874bb50ab965dcaf82ad57b7b1f69cfd6925e727f70ce
5
5
  SHA512:
6
- metadata.gz: 5e32e178c8c0c19c342e1e7451ad1743f66277ac7a7598d99884d75e7bf2d1f0fce7d5b432dc0675368fe657874c8b042e4964f5f581bb129373b5f4f3e35b02
7
- data.tar.gz: 6f067dc92a2739a59f0754e9cef2cea2510cd1e61494ffbe4bdec61686d5dfcbecff4a11c9230556e774aafee62c28d618513beed297d103fa74cbc104dfb0e4
6
+ metadata.gz: 2396eeba2dc4c3249df90c1b6e5f9f7532573dd9eaaffb13e16f2e3422a6f92f4b01bfbef6c536f6130331fb35ce4853754700340c0a021253cd81bbe8c4c9e7
7
+ data.tar.gz: 8dcf58d657ddf118d8f21f0b041490168dd7df11e99e25eafc9a28d9fac6990fb5768fdfed4625c6bf9378aee4c90801c2222b458756c45de59737e887e78331
data/bin/gelauto CHANGED
@@ -15,12 +15,20 @@ module Gelauto
15
15
  subcommand_option_handling :normal
16
16
  default_command :run
17
17
 
18
+ desc 'Silence log output.'
19
+ default_value false
20
+ switch [:s, :silent]
21
+
18
22
  desc 'Run the given command with Gelauto and optionally annotate files.'
19
23
  command :run do |c|
20
24
  c.desc 'Write discovered type signatures into Ruby files.'
21
25
  c.default_value false
22
26
  c.switch [:a, :annotate]
23
27
 
28
+ c.desc 'Print type signatures to STDOUT in RBI format. Ignores --silent.'
29
+ c.default_value false
30
+ c.switch [:r, :rbi]
31
+
24
32
  c.action do |global_options, options, args|
25
33
  paths, _, cmd = args.chunk_while { |arg1, arg2| arg1 != '--' && arg2 != '--' }.to_a
26
34
  Gelauto.paths += paths
@@ -45,12 +53,22 @@ module Gelauto
45
53
  Gelauto.annotate_file(path)
46
54
  Gelauto::Logger.info("Annotated #{path}")
47
55
  end
48
- else
56
+ end
57
+
58
+ if options[:rbi]
49
59
  puts Gelauto::Rbi.new(Gelauto.method_index).to_s
50
60
  end
51
61
  end
52
62
  end
53
63
  end
64
+
65
+ pre do |global_options, _command, _options, _args|
66
+ if global_options[:silent]
67
+ Gelauto.logger = Gelauto::NullLogger.new
68
+ end
69
+
70
+ true
71
+ end
54
72
  end
55
73
  end
56
74
 
data/lib/gelauto.rb CHANGED
@@ -12,6 +12,7 @@ module Gelauto
12
12
  autoload :MethodDef, 'gelauto/method_def'
13
13
  autoload :MethodIndex, 'gelauto/method_index'
14
14
  autoload :Namespace, 'gelauto/namespace'
15
+ autoload :NullLogger, 'gelauto/null_logger'
15
16
  autoload :Rbi, 'gelauto/rbi'
16
17
  autoload :Type, 'gelauto/type'
17
18
  autoload :TypeSet, 'gelauto/type_set'
@@ -68,7 +69,7 @@ module Gelauto
68
69
  end
69
70
 
70
71
  def logger
71
- @logger ||= ::Logger.new(STDOUT)
72
+ @logger ||= ::Logger.new(STDERR)
72
73
  end
73
74
 
74
75
  private
@@ -0,0 +1,15 @@
1
+ require 'logger'
2
+
3
+ module Gelauto
4
+ class NullLogger < ::Logger
5
+ def initialize(*)
6
+ super(File.open(File::NULL, 'w'))
7
+ end
8
+
9
+ def debug(*); end
10
+ def info(*); end
11
+ def warn(*); end
12
+ def error(*); end
13
+ def fatal(*); end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Gelauto
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gelauto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
@@ -62,6 +62,7 @@ files:
62
62
  - lib/gelauto/method_def.rb
63
63
  - lib/gelauto/method_index.rb
64
64
  - lib/gelauto/namespace.rb
65
+ - lib/gelauto/null_logger.rb
65
66
  - lib/gelauto/rbi.rb
66
67
  - lib/gelauto/rspec.rb
67
68
  - lib/gelauto/type.rb