kitno 0.2.1 → 0.2.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kitno/version.rb +1 -1
- data/lib/kitno.rb +10 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab085b539426621ac48086d58caa69f25329ba76
|
4
|
+
data.tar.gz: 290782c86dd862c6ce3dc0895a7ba9dfe9c05f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b301798c4f59f421a715f75bf094bea72fb89700e347e71aa45a058fceab0475a579c1ff1d0b9eb97b3f523a8e84b457e1d2c176aabbb6c800c0cfa5c6915b46
|
7
|
+
data.tar.gz: 1ce1902d3d129607ed8daf62b1da08512dc80d702de27884ba270cc0a024264e0417a67b80e67c58771b37546b34cc4df60ef259a93e87139de44c29bc65e1b8
|
data/Gemfile.lock
CHANGED
data/lib/kitno/version.rb
CHANGED
data/lib/kitno.rb
CHANGED
@@ -3,6 +3,7 @@ require 'kitno/cli'
|
|
3
3
|
|
4
4
|
require 'find'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'pathname'
|
6
7
|
|
7
8
|
module Kitno
|
8
9
|
class KillingInTheNamespaceOf
|
@@ -21,10 +22,10 @@ module Kitno
|
|
21
22
|
@class_map = {}
|
22
23
|
@files = []
|
23
24
|
|
24
|
-
@globals =
|
25
|
-
@externals =
|
25
|
+
@globals = globals && globals.length > 0 ? parse_mappings(globals) : {}
|
26
|
+
@externals = externals && externals.length > 0 ? parse_mappings(externals) : {}
|
26
27
|
|
27
|
-
@dependency_expression = /^(?!(\s\*|#)).*(?:new|extends)\s(#{Regexp.escape(@namespace)}[\w\.]*)/
|
28
|
+
@dependency_expression = /^(?!(\s\*|#)).*(?:new|extends|=|\:)\s(#{Regexp.escape(@namespace)}[\w\.]*)/
|
28
29
|
end
|
29
30
|
|
30
31
|
def run
|
@@ -67,7 +68,7 @@ module Kitno
|
|
67
68
|
class_name = parse_class_name contents
|
68
69
|
dependencies = parse_dependencies contents
|
69
70
|
|
70
|
-
unless class_name.nil?
|
71
|
+
unless class_name.nil? && dependencies.nil?
|
71
72
|
@class_map[path] = {
|
72
73
|
path: path,
|
73
74
|
class_name: class_name,
|
@@ -106,7 +107,7 @@ module Kitno
|
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
109
|
-
|
110
|
+
dependencies += contents.scan(@dependency_expression).flatten.uniq.compact
|
110
111
|
end
|
111
112
|
|
112
113
|
def get_dependency_expression(search)
|
@@ -145,6 +146,8 @@ module Kitno
|
|
145
146
|
if is_external_or_global(dependency)
|
146
147
|
path = dependency
|
147
148
|
short_name = @globals.invert[dependency] || @externals.invert[dependency]
|
149
|
+
elsif get_descriptor(dependency).nil?
|
150
|
+
next
|
148
151
|
else
|
149
152
|
path, short_name = get_module_mappings(filename, get_descriptor(dependency))
|
150
153
|
end
|
@@ -154,7 +157,7 @@ module Kitno
|
|
154
157
|
|
155
158
|
file.puts "\n"
|
156
159
|
|
157
|
-
short_class_name = @class_map[filename][:class_name]
|
160
|
+
short_class_name = @class_map[filename][:class_name]&.split('.')&.last
|
158
161
|
|
159
162
|
File.foreach(filename) do |line|
|
160
163
|
line.gsub!(CLASS_EXPRESSION, "class #{short_class_name}")
|
@@ -172,7 +175,7 @@ module Kitno
|
|
172
175
|
file.puts line
|
173
176
|
end
|
174
177
|
|
175
|
-
file.puts "\nmodule.exports = #{short_class_name}\n"
|
178
|
+
file.puts "\nmodule.exports = #{short_class_name}\n" if !short_class_name.nil?
|
176
179
|
end
|
177
180
|
end
|
178
181
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitno
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Rolfs
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-06-
|
13
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|