peeky 0.0.31 → 0.0.42

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.
@@ -14,28 +14,40 @@ module Peeky
14
14
  # MethodInfo delegates to the underlying ruby method object
15
15
  attr_reader :focal_method
16
16
 
17
+ attr_reader :access_control
18
+
17
19
  def_delegators :focal_method, :name, :receiver, :arity, :super_method
18
20
 
19
- # Stage 2 is the method likely to be an attribute reader or writer
21
+ ## Stage 2 is the method likely to be an attribute reader or writer
22
+ #
20
23
 
21
24
  # Implementation type indicates the probable representation of this
22
25
  # method in ruby, was it `def method` or `attr_reader` / `attr_writer`
23
26
  attr_reader :implementation_type
24
27
 
25
- # TODO: target_instance is required...
26
- def initialize(method, target_instance = nil)
28
+ def initialize(method, target_instance, access_control: :public)
27
29
  @focal_method = method
30
+ @target_instance = target_instance
31
+ @access_control = access_control
28
32
  @parameters = ParameterInfo.from_method(method)
29
33
  # stage 1
30
34
  # @implementation_type = :method
31
35
 
32
36
  # stage 2
33
- @implementation_type = infer_implementation_type(target_instance)
37
+ infer_implementation_type
38
+
39
+ # stage 3
40
+ infer_default_paramaters
34
41
  end
35
42
 
36
43
  # Stage 2 (working out) attr_accessor
44
+ #
45
+
37
46
  # Name of method minus writer annotations
38
- # Example :writable_attribute= becomes :writable_attribute
47
+ # Example
48
+ # :writable_attribute=
49
+ # # becomes
50
+ # :writable_attribute
39
51
  def clean_name
40
52
  @clean_name ||= begin
41
53
  n = name.to_s
@@ -43,43 +55,113 @@ module Peeky
43
55
  end
44
56
  end
45
57
 
46
- def infer_implementation_type(target_instance)
47
- if target_instance.nil?
48
- :method
49
- elsif match(target_instance, Peeky::Predicates::AttrReaderPredicate)
50
- :attr_reader
51
- elsif match(target_instance, Peeky::Predicates::AttrWriterPredicate)
52
- :attr_writer
53
- else
54
- :method
58
+ # Infer implementation type [:method, :attr_reader or :attr_writer]
59
+ # rubocop:disable Lint/DuplicateBranch
60
+ def infer_implementation_type
61
+ @implementation_type = if @target_instance.nil?
62
+ :method
63
+ elsif match(Peeky::Predicates::AttrReaderPredicate)
64
+ :attr_reader
65
+ elsif match(Peeky::Predicates::AttrWriterPredicate)
66
+ :attr_writer
67
+ else
68
+ :method
69
+ end
70
+ end
71
+ # rubocop:enable Lint/DuplicateBranch
72
+
73
+ # Get parameter by name
74
+ #
75
+ # @param name [String] name (required)
76
+ def get_parameter(name)
77
+ name = name.to_s
78
+ parameters.find { |p| p.name == name }
79
+ end
80
+
81
+ # Has any optional paramaters?
82
+
83
+ # @return [Boolean] true when any parameter is optional?
84
+ def optional?
85
+ parameters.any?(&:optional?)
86
+ end
87
+
88
+ # Infer default paramater values
89
+ #
90
+ # WARNING: Unit test coverage went from .1 seconds to 30-40 seconds
91
+ # when I first introduced this method.
92
+ #
93
+ # I now only call TracePoint if I have optional parameters to be inferred.
94
+ #
95
+ # The tests are now down to 5 seconds, but it highlights the cost of use
96
+ # TracePoint.
97
+ def infer_default_paramaters
98
+ minimalist_method = Peeky::Renderer::MethodCallMinimumParamsRender.new(self).render
99
+
100
+ return if minimalist_method.end_with?('=')
101
+ return unless optional?
102
+
103
+ tracer.enable do
104
+ @target_instance.instance_eval(minimalist_method)
105
+ rescue StandardError => e
106
+ # just print the error for now, we are only attempting to capture the
107
+ # first call, any errors inside the call cannot be dealt with and should
108
+ # not be re-raised
109
+ puts e.message
55
110
  end
56
111
  end
57
112
 
58
- def match(target_instance, predicate)
59
- predicate.new.match(target_instance, self)
113
+ def tracer
114
+ TracePoint.trace(:call, :c_call) do |tp|
115
+ next unless tp.self.is_a?(@target_instance.class)
116
+ next unless tp.method_id == name
117
+
118
+ tp.parameters.each do |_type, param_name|
119
+ method_paramater = get_parameter(param_name)
120
+
121
+ if method_paramater.optional?
122
+ value = tp.binding.local_variable_get(param_name)
123
+ method_paramater.default_value = value
124
+ end
125
+ end
126
+ end
60
127
  end
61
128
 
129
+ # Match
130
+ #
131
+ # @param predicate [String] use a predicate object with the signature match(instance, method_info)
132
+ def match(predicate)
133
+ predicate.new.match(@target_instance, self)
134
+ end
135
+
136
+ # Method?
137
+
138
+ # @return [Boolean] true when implementation type is method?
62
139
  def method?
63
140
  @implementation_type == :method
64
141
  end
65
142
 
66
- # https://github.com/rubyide/vscode-ruby/issues/454
67
- # if I prefix these methods with attr_ then will get an issue
68
- # in the language server.
69
- # Cannot read property 'namedChildren' of undefined
143
+ # Readable?
144
+ #
145
+ # @return [Boolean] true when readable?
70
146
  def readable?
147
+ # Method naming issue: VSCode Ruby Language Server
148
+ #
149
+ # If this method is renamed to attr_readable, same for attr_writable.
150
+ #
151
+ # https://github.com/rubyide/vscode-ruby/issues/454
152
+ # if I prefix these methods with attr_ then will get an issue
153
+ # in the language server.
154
+ #
155
+ # Cannot read property 'namedChildren' of undefined
156
+
71
157
  @implementation_type == :attr_reader
72
158
  end
73
159
 
160
+ # Writable?
161
+
162
+ # @return [Boolean] true when implementation_type writable?
74
163
  def writable?
75
164
  @implementation_type == :attr_writer
76
165
  end
77
-
78
- def debug
79
- puts '-' * 70
80
- puts name
81
- puts '-' * 70
82
- parameters.each(&:debug)
83
- end
84
166
  end
85
167
  end
@@ -48,13 +48,6 @@ module Peeky
48
48
  ruby_method.parameters.map { |ruby_paramater| from_parameter(ruby_paramater) }
49
49
  end
50
50
 
51
- def debug
52
- puts "name : #{name}"
53
- puts "type : #{type}"
54
- puts "signature_format : #{signature_format}"
55
- puts "minimal_call_format : #{minimal_call_format}"
56
- end
57
-
58
51
  # ruby code formatted for use in a method signature
59
52
  def signature_format
60
53
  @_signature_format ||= begin
@@ -79,6 +72,34 @@ module Peeky
79
72
  end
80
73
  end
81
74
 
75
+ # Optional?
76
+
77
+ # @return [Boolean] true when parameter is one of the optional types?
78
+ def optional?
79
+ @_optional |= (@type == :param_optional || @type == :key_optional)
80
+ end
81
+
82
+ # Default value type will look at the default value and try to
83
+ # infer the class behind it. Will default to 'Object' fi nil
84
+ def default_value_type
85
+ if @default_value.nil?
86
+ 'Object'
87
+ else
88
+ @default_value.class
89
+ end
90
+ end
91
+
92
+ # Wrap default value in quotes if string, or no wrapping otherwise
93
+ #
94
+ # @param value_for_nil [String] value for nil, generally '' or 'nil' (required)
95
+ def wrap_default_value(value_for_nil)
96
+ if @default_value.is_a?(String)
97
+ "'#{@default_value}'"
98
+ else
99
+ @default_value.nil? ? value_for_nil : @default_value
100
+ end
101
+ end
102
+
82
103
  private
83
104
 
84
105
  # Convert the limited information provided by ruby method.parameters
@@ -118,7 +139,7 @@ module Peeky
118
139
  end
119
140
 
120
141
  def signature_format_param_optional
121
- "#{name} = nil" # signature format needs to be moved to a method
142
+ "#{name} = #{wrap_default_value('nil')}" # signature format needs to be moved to a method
122
143
  end
123
144
 
124
145
  def signature_format_splat
@@ -130,7 +151,7 @@ module Peeky
130
151
  end
131
152
 
132
153
  def signature_format_key_optional
133
- "#{name}: nil"
154
+ "#{name}: #{wrap_default_value('')}"
134
155
  end
135
156
 
136
157
  def signature_format_double_splat
@@ -152,28 +173,8 @@ module Peeky
152
173
  "'#{@name}'"
153
174
  end
154
175
 
155
- # def minimal_call_format_param_optional
156
- # ''
157
- # end
158
-
159
- # def minimal_call_format_splat
160
- # ''
161
- # end
162
-
163
176
  def minimal_call_format_key_required
164
177
  "#{@name}: '#{@name}'"
165
178
  end
166
-
167
- # def minimal_call_format_key_optional
168
- # ''
169
- # end
170
-
171
- # def minimal_call_format_double_splat
172
- # ''
173
- # end
174
-
175
- # def minimal_call_format_block
176
- # ''
177
- # end
178
179
  end
179
180
  end
@@ -32,7 +32,12 @@ module Peeky
32
32
  cloned = instance.clone
33
33
 
34
34
  cloned.instance_eval(code)
35
- current_value = cloned.send(method_name)
35
+ begin
36
+ current_value = cloned.send(method_name)
37
+ rescue StandardError #=> exception
38
+ current_value = nil
39
+ end
40
+
36
41
  current_value == new_value
37
42
  end
38
43
 
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Peeky
4
+ module Renderer
5
+ # Class Debug Render
6
+ class ClassDebugRender
7
+ attr_reader :class_info
8
+
9
+ def initialize(class_info)
10
+ @key_width = 30
11
+ @class_info = class_info
12
+ end
13
+
14
+ # Render the class interface
15
+ # rubocop:disable Metrics/AbcSize
16
+ def render
17
+ output = []
18
+ output.push class_details
19
+ attributes = render_accessors + render_readers + render_writers
20
+
21
+ if attributes.length.positive?
22
+ output.push("-- Attributes #{'-' * 86}")
23
+ output.push(*attributes)
24
+ output.push('')
25
+ end
26
+
27
+ methods = render_methods(@class_info.public_methods)
28
+
29
+ if methods.length.positive?
30
+ output.push("-- Public Methods #{'-' * 82}")
31
+ output.push(*methods)
32
+ output.push('')
33
+ end
34
+
35
+ methods = render_methods(@class_info.private_methods)
36
+
37
+ if methods.length.positive?
38
+ output.push("-- Private Methods #{'-' * 82}")
39
+ output.push(*methods)
40
+ output.push('')
41
+ end
42
+
43
+ output.pop if output.last == ''
44
+
45
+ output.join("\n")
46
+ end
47
+ # rubocop:enable Metrics/AbcSize
48
+
49
+ private
50
+
51
+ def lj(value, size = 24)
52
+ value.to_s.ljust(size)
53
+ end
54
+
55
+ def kv(key, value)
56
+ "#{key.to_s.ljust(@key_width)}: #{value}"
57
+ end
58
+
59
+ def class_details
60
+ [
61
+ '-' * 100,
62
+ kv('class name', @class_info.class_name),
63
+ kv('module name', @class_info.module_name),
64
+ kv('class full name', @class_info.class_full_name),
65
+ ''
66
+ ]
67
+ end
68
+
69
+ def render_accessors
70
+ @class_info.accessors.map { |attr| kv('attr_accessor', attr.name) }
71
+ end
72
+
73
+ def render_readers
74
+ @class_info.readers.map { |attr| kv('attr_reader', attr.name) }
75
+ end
76
+
77
+ def render_writers
78
+ @class_info.writers.map { |attr| kv('attr_writer', attr.name) }
79
+ end
80
+
81
+ def render_methods(method_list)
82
+ method_list.flat_map do |method|
83
+ [
84
+ "[ #{method.name} ]",
85
+ *render_paramaters(method.parameters),
86
+ ''
87
+ ]
88
+ end
89
+ end
90
+
91
+ def render_paramaters(parameters)
92
+ result = [
93
+ "#{lj('name')} #{lj('param format')} #{lj('type')} #{lj('default')}",
94
+ '-' * 100
95
+ ]
96
+
97
+ result + parameters.map do |param|
98
+ "#{lj(param.name)} #{lj(param.signature_format)} #{lj(param.type)} #{lj(param.default_value)}"
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -38,15 +38,20 @@ module Peeky
38
38
  end
39
39
 
40
40
  # Render the class interface
41
+ # rubocop:disable Metrics/AbcSize
41
42
  def render
42
43
  @indent = ''
43
- output = []
44
+ output = []
44
45
  output.push render_start
45
46
  @indent = ' '
46
47
  output += render_accessors
47
48
  output += render_readers
48
49
  output += render_writers
49
- output += render_methods
50
+ output += render_methods(@class_info.public_methods)
51
+ unless @class_info.private_methods.length.zero?
52
+ output += ["#{@indent}private", '']
53
+ output += render_methods(@class_info.private_methods)
54
+ end
50
55
  output.pop if output.last == ''
51
56
 
52
57
  @indent = ''
@@ -54,6 +59,7 @@ module Peeky
54
59
 
55
60
  output.join("\n")
56
61
  end
62
+ # rubocop:enable Metrics/AbcSize
57
63
 
58
64
  private
59
65
 
@@ -79,8 +85,8 @@ module Peeky
79
85
  result
80
86
  end
81
87
 
82
- def render_methods
83
- result = @class_info.methods.map do |method_signature|
88
+ def render_methods(method_list)
89
+ result = method_list.map do |method_signature|
84
90
  render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
85
91
  "#{@indent}#{render_signature.render}"
86
92
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # require 'active_support/core_ext'
4
3
  require 'active_support/core_ext/string'
5
4
 
6
5
  module Peeky
@@ -37,10 +36,7 @@ module Peeky
37
36
  output = []
38
37
  output.push render_start
39
38
  @indent += ' '
40
- output += render_accessors
41
- output += render_readers
42
- output += render_writers
43
- output += render_methods
39
+ output += (render_accessors + render_readers + render_writers + render_methods)
44
40
  output.pop if output.last == ''
45
41
 
46
42
  @indent = @indent[0..-3]
@@ -92,50 +88,61 @@ module Peeky
92
88
  result
93
89
  end
94
90
 
95
- # rubocop:disable Metrics/AbcSize, Metrics/BlockLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/MethodLength
91
+ # rubocop:disable Metics/AbcSize
96
92
  def render_methods
97
93
  result = []
98
- class_info.methods.map.with_index do |method_signature, index|
99
- result.push '' if index.positive?
100
- result.push "#{@indent}# #{method_signature.name.to_s.humanize}"
101
-
102
- method_signature.parameters.each_with_index do |parameter, param_index|
103
- result.push "#{@indent}#" if param_index.zero?
104
-
105
- case parameter.type
106
- when :splat
107
- result.push "#{@indent}# @param #{parameter.name} [Array<#{default_splat_param_type}>] *#{parameter.name} - list of #{parameter.name.to_s.humanize.downcase}"
108
- when :double_splat
109
- result.push "#{@indent}# @param #{parameter.name} [<key: value>...] **#{parameter.name} - list of key/values"
110
- when :block
111
- result.push "#{@indent}# @param #{parameter.name} [Block] &#{parameter.name}"
112
- when :key_required
113
- result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name}: <value for #{parameter.name.to_s.humanize.downcase}> (required)"
114
- when :key_optional
115
- result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name}: <value for #{parameter.name.to_s.humanize.downcase}> (optional)"
116
- when :param_required
117
- result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (required)"
118
- when :param_optional
119
- result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (optional)"
120
- else
121
- result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase}"
122
- end
123
- end
124
-
125
- if method_signature.name.to_s.end_with?('?')
126
- result.push ''
127
- result.push "#{@indent}# @return [Boolean] true when #{method_signature.name.to_s.humanize.downcase}"
128
- end
129
-
130
- render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
131
- render_signature.indent = @indent
132
- render_signature.style = :default
133
- result.push render_signature.render
94
+ class_info.public_methods.map.with_index do |method_signature, index|
95
+ render_method(result, method_signature, index)
96
+ end
97
+ class_info.private_methods.map.with_index do |method_signature, index|
98
+ result.push "\n#{indent}private\n" if index.zero?
99
+ render_method(result, method_signature, index)
134
100
  end
135
101
  result.push '' unless result.length.zero?
136
102
  result
137
103
  end
138
- # rubocop:enable Metrics/AbcSize, Metrics/BlockLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/MethodLength
104
+ # rubocop:enable Metics/AbcSize
105
+
106
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
107
+ def render_method(result, method_signature, index)
108
+ result.push '' if index.positive?
109
+ result.push "#{@indent}# #{method_signature.name.to_s.humanize}"
110
+
111
+ method_signature.parameters.each_with_index do |parameter, param_index|
112
+ result.push "#{@indent}#" if param_index.zero?
113
+
114
+ case parameter.type
115
+ when :splat
116
+ result.push "#{@indent}# @param #{parameter.name} [Array<#{default_splat_param_type}>] *#{parameter.name} - list of #{parameter.name.to_s.humanize.downcase}"
117
+ when :double_splat
118
+ result.push "#{@indent}# @param #{parameter.name} [<key: value>...] **#{parameter.name} - list of key/values"
119
+ when :block
120
+ result.push "#{@indent}# @param #{parameter.name} [Block] &#{parameter.name}"
121
+ when :key_required
122
+ result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name}: <value for #{parameter.name.to_s.humanize.downcase}> (required)"
123
+ when :key_optional
124
+ result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name}: is optional, defaults to #{parameter.wrap_default_value('nil')}"
125
+ when :param_required
126
+ result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (required)"
127
+ when :param_optional
128
+ result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name} is optional, defaults to #{parameter.wrap_default_value('nil')}"
129
+ # result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (optional)"
130
+ else
131
+ result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase}"
132
+ end
133
+ end
134
+
135
+ if method_signature.name.to_s.end_with?('?')
136
+ result.push ''
137
+ result.push "#{@indent}# @return [Boolean] true when #{method_signature.name.to_s.humanize.downcase}"
138
+ end
139
+
140
+ render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
141
+ render_signature.indent = @indent
142
+ render_signature.style = :default
143
+ result.push render_signature.render
144
+ end
145
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
139
146
 
140
147
  def render_end
141
148
  "#{@indent}end"
@@ -12,8 +12,8 @@ module Peeky
12
12
  attr_reader :method_signature
13
13
 
14
14
  def initialize(method_signature, **opts)
15
- instance_name = opts[:instance_name] || 'instance'
16
- @instance_name = instance_name
15
+ # instance_name = opts[:instance_name] || 'instance'
16
+ @instance_name = opts[:instance_name]
17
17
  @method_signature = method_signature
18
18
  end
19
19
 
@@ -29,7 +29,11 @@ module Peeky
29
29
 
30
30
  params = minimal_call_parameters.length.zero? ? '' : "(#{minimal_call_parameters})"
31
31
 
32
- "#{@instance_name}.#{name}#{params}"
32
+ if @instance_name.nil?
33
+ "#{name}#{params}"
34
+ else
35
+ "#{@instance_name}.#{name}#{params}"
36
+ end
33
37
  end
34
38
  end
35
39
  end
data/lib/peeky/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peeky
4
- VERSION = '0.0.31'
4
+ VERSION = '0.0.42'
5
5
  end
data/lib/peeky.rb CHANGED
@@ -12,6 +12,7 @@ require 'peeky/parameter_info'
12
12
  require 'peeky/predicates/attr_reader_predicate'
13
13
  require 'peeky/predicates/attr_writer_predicate'
14
14
 
15
+ require 'peeky/renderer/class_debug_render'
15
16
  require 'peeky/renderer/class_interface_render'
16
17
  require 'peeky/renderer/class_interface_yard_render'
17
18
  require 'peeky/renderer/method_call_minimum_params_render'
@@ -22,3 +23,10 @@ module Peeky
22
23
  class Error < StandardError; end
23
24
  # Your code goes here...
24
25
  end
26
+
27
+ if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
28
+ namespace = 'Peeky::Version'
29
+ file_path = $LOADED_FEATURES.find { |f| f.include?('peeky/version') }
30
+ version = Peeky::VERSION.ljust(9)
31
+ puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
32
+ end
data/peeky.gemspec CHANGED
@@ -3,26 +3,16 @@
3
3
  require_relative 'lib/peeky/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- # https://piotrmurach.com/articles/writing-a-ruby-gem-specification/
7
- spec.required_ruby_version = '>= 2.5'
8
6
  spec.name = 'peeky'
9
7
  spec.version = Peeky::VERSION
10
8
  spec.authors = ['David Cruwys']
11
9
  spec.email = ['david@ideasmen.com.au']
12
10
 
13
11
  spec.summary = 'Take a peek into your ruby classes and extract useful meta data'
14
- spec.description = <<-TEXT
15
- Peeky is a Ruby GEM for peaking into ruby classes and extracting meta data.
16
- You can use this meta data to recreate classes, interfaces, documentation etc.
17
- or use it just to understand the internals of a class.
18
- TEXT
19
-
12
+ spec.description = 'peeky'
20
13
  spec.homepage = 'http://appydave.com/gems/peeky'
21
14
  spec.license = 'MIT'
22
-
23
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
24
- # to allow pushing to a single host or delete this section to allow pushing to any host.
25
- raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
26
16
 
27
17
  # spec.metadata['allowed_push_host'] = "Set to 'http://mygemserver.com'"
28
18
 
@@ -37,15 +27,14 @@ Gem::Specification.new do |spec|
37
27
  # Specify which files should be added to the gem when it is released.
38
28
  # The `git ls-files -z` loads the RubyGem files that have been added into git.
39
29
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
40
- `git ls-files -z`.split("\x0").reject do |f|
41
- f.match(%r{^(test|spec|features)/})
42
- end
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
43
31
  end
44
32
  spec.bindir = 'exe'
45
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
46
34
  spec.require_paths = ['lib']
35
+
47
36
  # spec.extensions = ['ext/peeky/extconf.rb']
48
- spec.extra_rdoc_files = ['README.md', 'STORIES.md']
37
+ spec.extra_rdoc_files = ['README.md', 'STORIES.md', 'USAGE.md']
49
38
  spec.rdoc_options += [
50
39
  '--title', 'peeky by appydave.com',
51
40
  '--main', 'README.md',
@@ -53,5 +42,4 @@ Gem::Specification.new do |spec|
53
42
  ]
54
43
 
55
44
  spec.add_dependency 'activesupport'
56
- # spec.add_dependency 'tty-box', '~> 0.5.0'
57
45
  end