yard-sketchup 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 +4 -4
- data/lib/yard-sketchup.rb +2 -0
- data/lib/yard-sketchup/patches/c_base_handler.rb +52 -0
- data/lib/yard-sketchup/stubs/autoload.rb +134 -0
- data/lib/yard-sketchup/templates/rubocop-changelog/fulldoc/text/setup.rb +75 -75
- data/lib/yard-sketchup/templates/stubs/fulldoc/text/setup.rb +34 -40
- data/lib/yard-sketchup/version.rb +1 -1
- data/lib/yard-sketchup/yard/handlers/class_constants.rb +17 -17
- data/lib/yard-sketchup/yard/handlers/class_enum_constants.rb +17 -17
- data/lib/yard-sketchup/yard/handlers/global_constants.rb +19 -19
- data/lib/yard-sketchup/yard/logger.rb +45 -45
- data/yard-sketchup.gemspec +1 -1
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7615e1907a9173b481638f3a089cda40cb26c5ccaa2091b04e3ef8d8a54a34
|
4
|
+
data.tar.gz: 06d436068af2bea4abf261e60e253f9b40fe76719156e2beae76501aa8d9ca84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e202e56edad4863b4946b13ad5a93424549fc72b43b6f10c8639d8679cd230b64a5d6a1a2e8693e495dc07e3e0be4269ebfebe9ca8fb5ee0bf56d95fa27e635e
|
7
|
+
data.tar.gz: 86d2f120abe83b983dabfd221821bf9e4b0205e1ba915b19a271f777ea078a60fa642a9114e20f784099376e76cdf03cd93477d7b302632b6e908c3701af6f4d
|
data/lib/yard-sketchup.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'yard'
|
2
2
|
require 'yard-sketchup/version'
|
3
|
+
require 'yard-sketchup/stubs/autoload'
|
3
4
|
require 'yard-sketchup/yard/logger'
|
4
5
|
require 'yard-sketchup/yard/handlers/class_constants'
|
5
6
|
require 'yard-sketchup/yard/handlers/class_enum_constants'
|
6
7
|
require 'yard-sketchup/yard/handlers/global_constants'
|
8
|
+
require 'yard-sketchup/patches/c_base_handler'
|
7
9
|
|
8
10
|
module SketchUpYARD
|
9
11
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module YARD
|
3
|
+
module Handlers
|
4
|
+
module C
|
5
|
+
class Base < Handlers::Base
|
6
|
+
|
7
|
+
# Temporary workaround until a proper fix can be applied to YARD master.
|
8
|
+
alias_method :namespace_for_variable_original, :namespace_for_variable
|
9
|
+
def namespace_for_variable(var)
|
10
|
+
patch_namespace_for_variable(var) ||
|
11
|
+
namespace_for_variable_original(var)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def patch_namespace_for_variable(var)
|
17
|
+
name = PATCH_ERROR_NAME[var]
|
18
|
+
# $stderr.puts "Mapped #{var} to #{name}" if name
|
19
|
+
name.nil? ? nil : P(name)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Generated by update_error_map.rb (Copy+past results)
|
23
|
+
PATCH_ERROR_NAME = {
|
24
|
+
'rb_eException' => 'Exception',
|
25
|
+
'rb_eSystemExit' => 'SystemExit',
|
26
|
+
'rb_eFatal' => 'fatal',
|
27
|
+
'rb_eSignal' => 'SignalException',
|
28
|
+
'rb_eInterrupt' => 'Interrupt',
|
29
|
+
'rb_eStandardError' => 'StandardError',
|
30
|
+
'rb_eTypeError' => 'TypeError',
|
31
|
+
'rb_eArgError' => 'ArgumentError',
|
32
|
+
'rb_eIndexError' => 'IndexError',
|
33
|
+
'rb_eKeyError' => 'KeyError',
|
34
|
+
'rb_eRangeError' => 'RangeError',
|
35
|
+
'rb_eScriptError' => 'ScriptError',
|
36
|
+
'rb_eSyntaxError' => 'SyntaxError',
|
37
|
+
'rb_eLoadError' => 'LoadError',
|
38
|
+
'rb_eNotImpError' => 'NotImplementedError',
|
39
|
+
'rb_eNameError' => 'NameError',
|
40
|
+
'rb_eNoMethodError' => 'NoMethodError',
|
41
|
+
'rb_eRuntimeError' => 'RuntimeError',
|
42
|
+
'rb_eFrozenError' => 'FrozenError',
|
43
|
+
'rb_eSecurityError' => 'SecurityError',
|
44
|
+
'rb_eNoMemError' => 'NoMemoryError',
|
45
|
+
'rb_eEncodingError' => 'EncodingError',
|
46
|
+
'rb_eSystemCallError' => 'SystemCallError',
|
47
|
+
}
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module SketchUpYARD
|
2
|
+
module Stubs
|
3
|
+
class AutoLoadGenerator
|
4
|
+
|
5
|
+
# @param [YARD::CodeObject::Base] namespace_objects
|
6
|
+
# @param [IO] out
|
7
|
+
def generate(namespace_objects, out)
|
8
|
+
dependencies = resolve_dependencies(namespace_objects)
|
9
|
+
out.puts "# This file is auto-generated by the `thor stubs` command."
|
10
|
+
required = Set.new
|
11
|
+
# Top level is special case.
|
12
|
+
top_level_path = File.join(sketchup_stubs_path, '_top_level.rb')
|
13
|
+
out.puts "require '#{top_level_path}'"
|
14
|
+
# The rest is resolved recursively.
|
15
|
+
dependencies.each { |object|
|
16
|
+
recurse_require(object, required, out)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
class Node
|
23
|
+
|
24
|
+
attr_reader :object
|
25
|
+
attr_reader :dependencies
|
26
|
+
|
27
|
+
def initialize(object)
|
28
|
+
@object = object
|
29
|
+
@dependencies = SortedSet.new
|
30
|
+
end
|
31
|
+
|
32
|
+
def root?
|
33
|
+
@object.namespace.root?
|
34
|
+
end
|
35
|
+
|
36
|
+
def path
|
37
|
+
@object.path
|
38
|
+
end
|
39
|
+
|
40
|
+
def namespace
|
41
|
+
@object.namespace
|
42
|
+
end
|
43
|
+
|
44
|
+
def <<(object)
|
45
|
+
@dependencies << object
|
46
|
+
end
|
47
|
+
|
48
|
+
def <=>(other)
|
49
|
+
@object.path <=> other.path
|
50
|
+
end
|
51
|
+
|
52
|
+
def hash
|
53
|
+
@object.path.hash
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
class NodeFactory
|
60
|
+
|
61
|
+
def initialize
|
62
|
+
@dependencies = {}
|
63
|
+
end
|
64
|
+
|
65
|
+
def node(yard_object)
|
66
|
+
item = @dependencies[yard_object.path]
|
67
|
+
return item if item
|
68
|
+
item = Node.new(yard_object)
|
69
|
+
@dependencies[yard_object.path] = item
|
70
|
+
item
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def resolve_dependencies(yard_objects)
|
77
|
+
factory = NodeFactory.new
|
78
|
+
dependencies = SortedSet.new
|
79
|
+
|
80
|
+
yard_objects.each { |yard_object|
|
81
|
+
object = factory.node(yard_object)
|
82
|
+
|
83
|
+
if yard_object.type == :class && yard_object.superclass.name != :Object
|
84
|
+
object << factory.node(yard_object.superclass)
|
85
|
+
end
|
86
|
+
|
87
|
+
unless yard_object.namespace.path.empty?
|
88
|
+
object << factory.node(yard_object.namespace)
|
89
|
+
end
|
90
|
+
|
91
|
+
dependencies << object
|
92
|
+
}
|
93
|
+
dependencies
|
94
|
+
end
|
95
|
+
|
96
|
+
def print_dependencies(object, indent = 0)
|
97
|
+
indent_space = ' ' * indent
|
98
|
+
puts "#{indent_space}#{object.path}"
|
99
|
+
object.dependencies.each { |dependency|
|
100
|
+
print_dependencies(dependency, indent + 1)
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
def sketchup_stubs_path
|
105
|
+
File.join('sketchup-api-stubs', 'stubs')
|
106
|
+
end
|
107
|
+
|
108
|
+
def stub_filename(object)
|
109
|
+
basename = object.path.gsub('::', '/')
|
110
|
+
basename = '_top_level' if basename.empty?
|
111
|
+
File.join(sketchup_stubs_path, "#{basename}.rb")
|
112
|
+
end
|
113
|
+
|
114
|
+
def recurse_require(object, required, out, indent = 0)
|
115
|
+
return if required.include?(object.path)
|
116
|
+
# If a class inherit from a core Ruby class we might get a Proxy code
|
117
|
+
# object here. We don't generate stubs for those and thus we don't want
|
118
|
+
# to create a require for them either.
|
119
|
+
return if object.object.is_a?(YARD::CodeObjects::Proxy)
|
120
|
+
# First require the dependencies.
|
121
|
+
object.dependencies.each { |dependency|
|
122
|
+
recurse_require(dependency, required, out, indent + 1)
|
123
|
+
}
|
124
|
+
# Then we're good to require this object.
|
125
|
+
require_path = stub_filename(object)
|
126
|
+
# indent_space = ' ' * indent
|
127
|
+
# out.puts "#{indent_space}require '#{require_path}'"
|
128
|
+
out.puts "require '#{require_path}'"
|
129
|
+
required << object.path
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -1,75 +1,75 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'set'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
include Helpers::ModuleHelper
|
6
|
-
|
7
|
-
def init
|
8
|
-
generate_changelog
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def all_objects
|
13
|
-
run_verifier(Registry.all())
|
14
|
-
end
|
15
|
-
|
16
|
-
def namespace_objects
|
17
|
-
run_verifier(Registry.all(:class, :module))
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
def changelog_filename
|
22
|
-
'Changelog SU201x.log'
|
23
|
-
end
|
24
|
-
|
25
|
-
VERSION_MATCH = /^\D+([0-9.]+)(?:\s+M(\d+))?$/
|
26
|
-
|
27
|
-
def generate_changelog
|
28
|
-
output = StringIO.new
|
29
|
-
|
30
|
-
versions = Hash.new
|
31
|
-
all_objects.each { |object|
|
32
|
-
version_tag = object.tag(:version)
|
33
|
-
next if version_tag.nil?
|
34
|
-
version = version_tag.text
|
35
|
-
|
36
|
-
# Don't list SU6 or older.
|
37
|
-
next if version.match(VERSION_MATCH).captures[0].to_i <= 6
|
38
|
-
|
39
|
-
versions[version] ||= {}
|
40
|
-
versions[version][object.type] ||= []
|
41
|
-
versions[version][object.type] << object.path
|
42
|
-
}
|
43
|
-
versions = versions.sort { |a, b|
|
44
|
-
v1, mv1 = a[0].match(VERSION_MATCH).captures
|
45
|
-
v2, mv2 = b[0].match(VERSION_MATCH).captures
|
46
|
-
if v1 == v2
|
47
|
-
(mv2 || '0').to_i <=> (mv1 || '0').to_i
|
48
|
-
else
|
49
|
-
v2.to_f <=> v1.to_f
|
50
|
-
end
|
51
|
-
}
|
52
|
-
|
53
|
-
output.puts "FEATURES = ["
|
54
|
-
versions.each { |version, features|
|
55
|
-
output.puts ""
|
56
|
-
output.puts " {"
|
57
|
-
output.puts " version: '#{version}',"
|
58
|
-
output.puts " types: {"
|
59
|
-
features.sort.each { |type, objects|
|
60
|
-
unless objects.empty?
|
61
|
-
output.puts " #{type}: ["
|
62
|
-
objects.sort.each { |object|
|
63
|
-
output.puts " '#{object}',"
|
64
|
-
}
|
65
|
-
output.puts " ],"
|
66
|
-
end
|
67
|
-
}
|
68
|
-
output.puts " },"
|
69
|
-
output.puts " },"
|
70
|
-
}
|
71
|
-
output.puts "]"
|
72
|
-
|
73
|
-
puts output.string
|
74
|
-
exit # Avoid the YARD summary
|
75
|
-
end
|
1
|
+
require 'fileutils'
|
2
|
+
require 'set'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
include Helpers::ModuleHelper
|
6
|
+
|
7
|
+
def init
|
8
|
+
generate_changelog
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def all_objects
|
13
|
+
run_verifier(Registry.all())
|
14
|
+
end
|
15
|
+
|
16
|
+
def namespace_objects
|
17
|
+
run_verifier(Registry.all(:class, :module))
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def changelog_filename
|
22
|
+
'Changelog SU201x.log'
|
23
|
+
end
|
24
|
+
|
25
|
+
VERSION_MATCH = /^\D+([0-9.]+)(?:\s+M(\d+))?$/
|
26
|
+
|
27
|
+
def generate_changelog
|
28
|
+
output = StringIO.new
|
29
|
+
|
30
|
+
versions = Hash.new
|
31
|
+
all_objects.each { |object|
|
32
|
+
version_tag = object.tag(:version)
|
33
|
+
next if version_tag.nil?
|
34
|
+
version = version_tag.text
|
35
|
+
|
36
|
+
# Don't list SU6 or older.
|
37
|
+
next if version.match(VERSION_MATCH).captures[0].to_i <= 6
|
38
|
+
|
39
|
+
versions[version] ||= {}
|
40
|
+
versions[version][object.type] ||= []
|
41
|
+
versions[version][object.type] << object.path
|
42
|
+
}
|
43
|
+
versions = versions.sort { |a, b|
|
44
|
+
v1, mv1 = a[0].match(VERSION_MATCH).captures
|
45
|
+
v2, mv2 = b[0].match(VERSION_MATCH).captures
|
46
|
+
if v1 == v2
|
47
|
+
(mv2 || '0').to_i <=> (mv1 || '0').to_i
|
48
|
+
else
|
49
|
+
v2.to_f <=> v1.to_f
|
50
|
+
end
|
51
|
+
}
|
52
|
+
|
53
|
+
output.puts "FEATURES = ["
|
54
|
+
versions.each { |version, features|
|
55
|
+
output.puts ""
|
56
|
+
output.puts " {"
|
57
|
+
output.puts " version: '#{version}',"
|
58
|
+
output.puts " types: {"
|
59
|
+
features.sort.each { |type, objects|
|
60
|
+
unless objects.empty?
|
61
|
+
output.puts " #{type}: ["
|
62
|
+
objects.sort.each { |object|
|
63
|
+
output.puts " '#{object}',"
|
64
|
+
}
|
65
|
+
output.puts " ],"
|
66
|
+
end
|
67
|
+
}
|
68
|
+
output.puts " },"
|
69
|
+
output.puts " },"
|
70
|
+
}
|
71
|
+
output.puts "]"
|
72
|
+
|
73
|
+
puts output.string
|
74
|
+
exit # Avoid the YARD summary
|
75
|
+
end
|
@@ -17,31 +17,21 @@ def namespace_objects
|
|
17
17
|
run_verifier(Registry.all(:class, :module))
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
def generate_autoload
|
22
|
-
generate_sketchup_autoload
|
23
|
-
end
|
24
|
-
|
25
|
-
def generate_sketchup_autoload
|
26
|
-
base = Pathname.new(autoload_stubs_path)
|
27
|
-
autoload_file = File.join(autoload_stubs_path, 'sketchup.rb')
|
28
|
-
File.open(autoload_file, 'w') { |file|
|
29
|
-
pattern = File.join(sketchup_stubs_path, '**/*.rb')
|
30
|
-
Dir.glob(pattern) { |filename|
|
31
|
-
pathname = Pathname.new(filename)
|
32
|
-
relative = pathname.relative_path_from(base)
|
33
|
-
file.puts "require '#{relative.to_s}'"
|
34
|
-
}
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
20
|
def generate_stubs
|
39
21
|
puts "Generating stubs..."
|
40
22
|
generate_module_stubs(Registry.root)
|
41
23
|
namespace_objects.each do |object|
|
42
24
|
generate_module_stubs(object)
|
43
25
|
end
|
44
|
-
|
26
|
+
generate_autoloader(namespace_objects)
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate_autoloader(namespace_objects)
|
30
|
+
generator = SketchUpYARD::Stubs::AutoLoadGenerator.new
|
31
|
+
autoload_file = File.join(stubs_gem_path, 'sketchup.rb')
|
32
|
+
File.open(autoload_file, 'w') do |file|
|
33
|
+
generator.generate(namespace_objects, file)
|
34
|
+
end
|
45
35
|
end
|
46
36
|
|
47
37
|
def print_section(io, title, content)
|
@@ -101,22 +91,34 @@ def output_path
|
|
101
91
|
options.serializer.options[:basepath] || File.join(Dir.pwd, 'stubs')
|
102
92
|
end
|
103
93
|
|
104
|
-
def
|
94
|
+
def stubs_root_path
|
105
95
|
ensure_exist(output_path)
|
106
96
|
end
|
107
97
|
|
108
|
-
def
|
109
|
-
ensure_exist(File.join(
|
98
|
+
def stubs_lib_path
|
99
|
+
ensure_exist(File.join(stubs_root_path, 'lib'))
|
110
100
|
end
|
111
101
|
|
112
|
-
def
|
113
|
-
ensure_exist(File.join(
|
102
|
+
def stubs_gem_path
|
103
|
+
ensure_exist(File.join(stubs_lib_path, 'sketchup-api-stubs'))
|
104
|
+
end
|
105
|
+
|
106
|
+
def stubs_path
|
107
|
+
ensure_exist(File.join(stubs_gem_path, 'stubs'))
|
114
108
|
end
|
115
109
|
|
116
110
|
def stub_filename(object)
|
117
111
|
basename = object.path.gsub('::', '/')
|
118
112
|
basename = '_top_level' if basename.empty?
|
119
|
-
File.join(
|
113
|
+
File.join(stubs_path, "#{basename}.rb")
|
114
|
+
end
|
115
|
+
|
116
|
+
# A stable sort_by method.
|
117
|
+
#
|
118
|
+
# @param [Enumerable]
|
119
|
+
# @return [Array]
|
120
|
+
def stable_sort_by(list)
|
121
|
+
list.each_with_index.sort_by { |item, i| [yield(item), i] }.map(&:first)
|
120
122
|
end
|
121
123
|
|
122
124
|
CAMELCASE_CONSTANT = /^([A-Z]+[a-z]+)/
|
@@ -150,9 +152,7 @@ def generate_constants_grouped(object)
|
|
150
152
|
grouped_output = groups.map { |group, group_constants|
|
151
153
|
output = StringIO.new
|
152
154
|
# Each group itself is sorted in order to more easily scan the list.
|
153
|
-
sorted = group_constants
|
154
|
-
a.name <=> b.name
|
155
|
-
}
|
155
|
+
sorted = stable_sort_by(group_constants, &:name)
|
156
156
|
sorted.each { |constant|
|
157
157
|
output.puts " #{constant.name} = nil # Stub value."
|
158
158
|
}
|
@@ -160,17 +160,14 @@ def generate_constants_grouped(object)
|
|
160
160
|
}
|
161
161
|
# Finally each group is also sorted, again to ease scanning for a particular
|
162
162
|
# name. We simply use the first character of each group.
|
163
|
-
grouped_output
|
164
|
-
a.lstrip[0] <=> b.lstrip[0]
|
165
|
-
}.join("\n")
|
163
|
+
stable_sort_by(grouped_output) { |item| item.lstrip[0] }.join("\n")
|
166
164
|
end
|
167
165
|
|
168
166
|
# Sort constants without grouping.
|
169
167
|
def generate_constants(object)
|
170
168
|
output = StringIO.new
|
171
|
-
constants = run_verifier(object.constants(object_options))
|
172
|
-
|
173
|
-
}
|
169
|
+
constants = run_verifier(object.constants(object_options))
|
170
|
+
constants = stable_sort_by(constants, &:name)
|
174
171
|
constants.each { |constant|
|
175
172
|
output.puts " #{constant.name} = nil # Stub value."
|
176
173
|
}
|
@@ -180,9 +177,8 @@ end
|
|
180
177
|
def generate_mixins(object, scope)
|
181
178
|
output = StringIO.new
|
182
179
|
mixin_type = (scope == :class) ? 'extend' : 'include'
|
183
|
-
mixins = run_verifier(object.mixins(scope))
|
184
|
-
|
185
|
-
}
|
180
|
+
mixins = run_verifier(object.mixins(scope))
|
181
|
+
mixins = stable_sort_by(mixins, &:path)
|
186
182
|
mixins.each { |mixin|
|
187
183
|
output.puts " #{mixin_type} #{mixin.path}"
|
188
184
|
}
|
@@ -261,9 +257,7 @@ def sort_methods(object, scope)
|
|
261
257
|
objects = methods.select { |method|
|
262
258
|
method.scope == scope
|
263
259
|
}
|
264
|
-
objects
|
265
|
-
a.name <=> b.name
|
266
|
-
}
|
260
|
+
stable_sort_by(objects, &:name)
|
267
261
|
end
|
268
262
|
|
269
263
|
def object_options
|
@@ -1,17 +1,17 @@
|
|
1
|
-
module SketchUpYARD
|
2
|
-
class ClassConstantHandler < YARD::Handlers::C::Base
|
3
|
-
|
4
|
-
MATCH = %r{\bDEFINE_RUBY_CLASS_CONSTANT\s*\(([^,]+)\s*,\s*([^,]+)\s*,\s*(\w+)\s*\)\s*;}xm
|
5
|
-
handles MATCH
|
6
|
-
statement_class BodyStatement
|
7
|
-
|
8
|
-
process do
|
9
|
-
statement.source.scan(MATCH) do |klass_name, value, const_name|
|
10
|
-
type = "const"
|
11
|
-
value = "nil"
|
12
|
-
handle_constants(type, klass_name, const_name, value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
1
|
+
module SketchUpYARD
|
2
|
+
class ClassConstantHandler < YARD::Handlers::C::Base
|
3
|
+
|
4
|
+
MATCH = %r{\bDEFINE_RUBY_CLASS_CONSTANT\s*\(([^,]+)\s*,\s*([^,]+)\s*,\s*(\w+)\s*\)\s*;}xm
|
5
|
+
handles MATCH
|
6
|
+
statement_class BodyStatement
|
7
|
+
|
8
|
+
process do
|
9
|
+
statement.source.scan(MATCH) do |klass_name, value, const_name|
|
10
|
+
type = "const"
|
11
|
+
value = "nil"
|
12
|
+
handle_constants(type, klass_name, const_name, value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
module SketchUpYARD
|
2
|
-
class ClassEnumConstantHandler < YARD::Handlers::C::Base
|
3
|
-
|
4
|
-
MATCH = %r{\bDEFINE_RUBY_CLASS_ENUM\s*\(([^,]+)\s*,\s*(\w+)\s*\)\s*;}xm
|
5
|
-
handles MATCH
|
6
|
-
statement_class BodyStatement
|
7
|
-
|
8
|
-
process do
|
9
|
-
statement.source.scan(MATCH) do |klass_name, const_name|
|
10
|
-
type = "const"
|
11
|
-
value = "nil"
|
12
|
-
handle_constants(type, klass_name, const_name, value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
1
|
+
module SketchUpYARD
|
2
|
+
class ClassEnumConstantHandler < YARD::Handlers::C::Base
|
3
|
+
|
4
|
+
MATCH = %r{\bDEFINE_RUBY_CLASS_ENUM\s*\(([^,]+)\s*,\s*(\w+)\s*\)\s*;}xm
|
5
|
+
handles MATCH
|
6
|
+
statement_class BodyStatement
|
7
|
+
|
8
|
+
process do
|
9
|
+
statement.source.scan(MATCH) do |klass_name, const_name|
|
10
|
+
type = "const"
|
11
|
+
value = "nil"
|
12
|
+
handle_constants(type, klass_name, const_name, value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module SketchUpYARD
|
2
|
-
class GlobalConstantHandler < YARD::Handlers::C::Base
|
3
|
-
|
4
|
-
MATCH = %r{\bDEFINE_RUBY_(?:(?:NAMED_)?CONSTANT|ENUM)\s*\((?:[^)]+,\s*)?(\w+)\)\s*;}xm
|
5
|
-
handles MATCH
|
6
|
-
statement_class BodyStatement
|
7
|
-
|
8
|
-
process do
|
9
|
-
statement.source.scan(MATCH) do |captures|
|
10
|
-
const_name = captures.first
|
11
|
-
type = "global_const"
|
12
|
-
var_name = nil
|
13
|
-
value = "nil"
|
14
|
-
handle_constants(type, var_name, const_name, value)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
1
|
+
module SketchUpYARD
|
2
|
+
class GlobalConstantHandler < YARD::Handlers::C::Base
|
3
|
+
|
4
|
+
MATCH = %r{\bDEFINE_RUBY_(?:(?:NAMED_)?CONSTANT|ENUM)\s*\((?:[^)]+,\s*)?(\w+)\)\s*;}xm
|
5
|
+
handles MATCH
|
6
|
+
statement_class BodyStatement
|
7
|
+
|
8
|
+
process do
|
9
|
+
statement.source.scan(MATCH) do |captures|
|
10
|
+
const_name = captures.first
|
11
|
+
type = "global_const"
|
12
|
+
var_name = nil
|
13
|
+
value = "nil"
|
14
|
+
handle_constants(type, var_name, const_name, value)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
require 'yard/logging'
|
2
|
-
|
3
|
-
# Hack to show some progress on Windows while building the docs.
|
4
|
-
# Helpful in seeing what takes most time.
|
5
|
-
# It's Copy+Paste from YARD 0.9.9 with some noted edits.
|
6
|
-
module YARD
|
7
|
-
class Logger < ::Logger
|
8
|
-
|
9
|
-
def show_progress
|
10
|
-
return false if YARD.ruby18? # threading is too ineffective for progress support
|
11
|
-
# <hack>
|
12
|
-
# return false if YARD.windows? # windows has poor ANSI support
|
13
|
-
# </hack>
|
14
|
-
return false unless io.tty? # no TTY support on IO
|
15
|
-
return false unless level > INFO # no progress in verbose/debug modes
|
16
|
-
@show_progress
|
17
|
-
end
|
18
|
-
|
19
|
-
def progress(msg, nontty_log = :debug)
|
20
|
-
send(nontty_log, msg) if nontty_log
|
21
|
-
return unless show_progress
|
22
|
-
icon = ""
|
23
|
-
if defined?(::Encoding)
|
24
|
-
icon = PROGRESS_INDICATORS[@progress_indicator] + " "
|
25
|
-
end
|
26
|
-
@mutex.synchronize do
|
27
|
-
print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r")
|
28
|
-
@progress_msg = msg
|
29
|
-
if Time.now - @progress_last_update > 0.2
|
30
|
-
@progress_indicator += 1
|
31
|
-
@progress_indicator %= PROGRESS_INDICATORS.size
|
32
|
-
@progress_last_update = Time.now
|
33
|
-
end
|
34
|
-
end
|
35
|
-
Thread.new do
|
36
|
-
sleep(0.05)
|
37
|
-
# <hack>
|
38
|
-
# progress(msg + ".", nil) if @progress_msg == msg
|
39
|
-
# </hack>
|
40
|
-
progress(msg, nil) if @progress_msg == msg
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end if true # Set to false to disable hack.
|
1
|
+
require 'yard/logging'
|
2
|
+
|
3
|
+
# Hack to show some progress on Windows while building the docs.
|
4
|
+
# Helpful in seeing what takes most time.
|
5
|
+
# It's Copy+Paste from YARD 0.9.9 with some noted edits.
|
6
|
+
module YARD
|
7
|
+
class Logger < ::Logger
|
8
|
+
|
9
|
+
def show_progress
|
10
|
+
return false if YARD.ruby18? # threading is too ineffective for progress support
|
11
|
+
# <hack>
|
12
|
+
# return false if YARD.windows? # windows has poor ANSI support
|
13
|
+
# </hack>
|
14
|
+
return false unless io.tty? # no TTY support on IO
|
15
|
+
return false unless level > INFO # no progress in verbose/debug modes
|
16
|
+
@show_progress
|
17
|
+
end
|
18
|
+
|
19
|
+
def progress(msg, nontty_log = :debug)
|
20
|
+
send(nontty_log, msg) if nontty_log
|
21
|
+
return unless show_progress
|
22
|
+
icon = ""
|
23
|
+
if defined?(::Encoding)
|
24
|
+
icon = PROGRESS_INDICATORS[@progress_indicator] + " "
|
25
|
+
end
|
26
|
+
@mutex.synchronize do
|
27
|
+
print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r")
|
28
|
+
@progress_msg = msg
|
29
|
+
if Time.now - @progress_last_update > 0.2
|
30
|
+
@progress_indicator += 1
|
31
|
+
@progress_indicator %= PROGRESS_INDICATORS.size
|
32
|
+
@progress_last_update = Time.now
|
33
|
+
end
|
34
|
+
end
|
35
|
+
Thread.new do
|
36
|
+
sleep(0.05)
|
37
|
+
# <hack>
|
38
|
+
# progress(msg + ".", nil) if @progress_msg == msg
|
39
|
+
# </hack>
|
40
|
+
progress(msg, nil) if @progress_msg == msg
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end if true # Set to false to disable hack.
|
data/yard-sketchup.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-sketchup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trimble Inc, SketchUp Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.15.0
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '3.0'
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.15.0
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '3.0'
|
41
47
|
description: SketchUp Ruby API YARD template.
|
42
48
|
email:
|
43
49
|
executables: []
|
@@ -46,6 +52,8 @@ extra_rdoc_files: []
|
|
46
52
|
files:
|
47
53
|
- Gemfile
|
48
54
|
- lib/yard-sketchup.rb
|
55
|
+
- lib/yard-sketchup/patches/c_base_handler.rb
|
56
|
+
- lib/yard-sketchup/stubs/autoload.rb
|
49
57
|
- lib/yard-sketchup/templates/changelog/fulldoc/text/setup.rb
|
50
58
|
- lib/yard-sketchup/templates/coverage/fulldoc/text/setup.rb
|
51
59
|
- lib/yard-sketchup/templates/default/fulldoc/html/css/rubyapi.css
|