gloss 0.1.4 → 0.1.5

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: 0cb01614c6e4395edaf5600dd39e958b2ca86ae6c2650c2028519659c813ff64
4
- data.tar.gz: a1ee0171851a7463113c4e12dff9dd81bb2c003e080896171060dfc439a18499
3
+ metadata.gz: 622926d0bd44e5bd9b93cfa75ea54dc67d976a63c91a5a60f17c859987ee2fce
4
+ data.tar.gz: 789917be6b264be0108cb03371b797c4ebc865e01fcb7218589808ccd68bdf83
5
5
  SHA512:
6
- metadata.gz: 781f7dc53f12231f843947aa619521fbd99deca1bf15a7a5263a279e7a030683c4da2d72722beb30d4a35beba8e98e86085eabd3046d1567be1c37c7d577c6d7
7
- data.tar.gz: b3a63fbcb5c81a8c0d4336dcfdb64d46a2ebf624fd804942ba8243c04b43fab05a881ba6386e6f6a5c7fb76b416ca8677212e7993ea8ea22cdca981bff2645fd
6
+ metadata.gz: c5fe3cf7f37aa5eec834b806c1f80083dde5be4b15000f18ae4807cb0d2ee5e3f378eaa271ffe3cb4d61b58feb98c3ac0586ab65da5ef2bb3df5dad1e4a02b2e
7
+ data.tar.gz: b2f55defed2e6ba5d3dec55dd7b6795a3f3ff54fa1e94532bc0bda6d91f099200d5ec40926c6c3b001a27809477016bdd8a59d24a6472419b0958647df6b5c00
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloss (0.1.4)
4
+ gloss (0.1.5)
5
5
  fast_blank
6
6
  listen
7
- rbs (~> 1.0.4)
8
- steep (~> 0.41.0)
7
+ rbs (= 1.0.4)
8
+ steep (= 0.41.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
@@ -49,7 +49,7 @@ GEM
49
49
  rb-fsevent (0.10.4)
50
50
  rb-inotify (0.10.1)
51
51
  ffi (~> 1.0)
52
- rbs (1.0.6)
52
+ rbs (1.0.4)
53
53
  regexp_parser (2.0.3)
54
54
  rexml (3.2.4)
55
55
  rspec (3.10.0)
@@ -77,6 +77,7 @@ GEM
77
77
  rubocop-ast (1.4.0)
78
78
  parser (>= 2.7.1.5)
79
79
  ruby-progressbar (1.11.0)
80
+ rufo (0.12.0)
80
81
  steep (0.41.0)
81
82
  activesupport (>= 5.1)
82
83
  ast_utils (>= 0.4.0)
@@ -99,6 +100,7 @@ DEPENDENCIES
99
100
  rake-compiler
100
101
  rspec
101
102
  rubocop
103
+ rufo
102
104
 
103
105
  BUNDLED WITH
104
106
  2.2.3
data/gloss.gemspec CHANGED
@@ -17,11 +17,12 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_runtime_dependency "fast_blank"
19
19
  s.add_runtime_dependency "listen"
20
- s.add_runtime_dependency "rbs", "~>1.0.4"
21
- s.add_runtime_dependency "steep", "~>0.41.0"
20
+ s.add_runtime_dependency "rbs", "1.0.4"
21
+ s.add_runtime_dependency "steep", "0.41.0"
22
22
 
23
23
  s.add_development_dependency "pry-byebug"
24
24
  s.add_development_dependency "rake-compiler"
25
25
  s.add_development_dependency "rspec"
26
26
  s.add_development_dependency "rubocop"
27
+ s.add_development_dependency "rufo"
27
28
  end
data/lib/gloss/config.rb CHANGED
@@ -11,7 +11,8 @@ module Gloss
11
11
  :src_dir => "src",
12
12
  :entrypoint => nil,
13
13
  :strict_require => false,
14
- :type_checking_strictness => "strict"}.freeze)
14
+ :type_checking_strictness => "strict",
15
+ :prettify_output_executable_path => nil}.freeze)
15
16
  def self.load_config()
16
17
  user_config = (if File.exist?(File.absolute_path(File.join(Dir.pwd, CONFIG_PATH)))
17
18
  YAML.safe_load(File.read(CONFIG_PATH))
@@ -19,27 +19,31 @@ module Gloss
19
19
  end
20
20
  def run()
21
21
  @files_to_process.each() { |path_string|
22
- unless @processed_files.member?(path_string) || OUTPUT_BY_PATH.[](path_string)
23
- Gloss.logger
22
+ (if path_string.end_with?(".rbs")
23
+ @type_checker.load_sig_path(path_string)
24
+ else
25
+ (if !@processed_files.member?(path_string) || !OUTPUT_BY_PATH.[](path_string)
26
+ Gloss.logger
24
27
  .debug("Loading #{path_string}")
25
- path = Utils.absolute_path(path_string)
26
- file_contents = File.open(path)
28
+ path = Utils.absolute_path(path_string)
29
+ file_contents = File.open(path)
27
30
  .read
28
- contents_tree = Parser.new(file_contents)
31
+ contents_tree = Parser.new(file_contents)
29
32
  .run
30
- on_new_file_referenced = proc() { |ps, relative|
31
- ps.each() { |pa|
32
- (if relative
33
- handle_require_relative(pa, path_string)
34
- else
35
- handle_require(pa)
36
- end)
33
+ on_new_file_referenced = proc() { |ps, relative|
34
+ ps.each() { |pa|
35
+ (if relative
36
+ handle_require_relative(pa, path_string)
37
+ else
38
+ handle_require(pa)
39
+ end)
40
+ }
37
41
  }
38
- }
39
- OUTPUT_BY_PATH.[]=(path_string, Visitor.new(contents_tree, @type_checker, on_new_file_referenced)
42
+ OUTPUT_BY_PATH.[]=(path_string, Visitor.new(contents_tree, @type_checker, on_new_file_referenced)
40
43
  .run)
41
- @processed_files.add(path_string)
42
- end
44
+ @processed_files.add(path_string)
45
+ end)
46
+ end)
43
47
  }
44
48
  @type_checker
45
49
  end
data/lib/gloss/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  ##### See src/ to make changes
5
5
 
6
6
  module Gloss
7
- VERSION = "0.1.4"
7
+ VERSION = "0.1.5"
8
8
  end
data/lib/gloss/writer.rb CHANGED
@@ -24,6 +24,9 @@ module Gloss
24
24
  end)
25
25
  file.puts(@content)
26
26
  }
27
+ (if Config.prettify_output_executable_path
28
+ system(Config.prettify_output_executable_path, @output_path.to_s)
29
+ end)
27
30
  end
28
31
  private def shebang()
29
32
  (if @output_path.executable?
@@ -9,7 +9,8 @@ module Gloss
9
9
  src_dir: "src",
10
10
  entrypoint: nil,
11
11
  strict_require: false,
12
- type_checking_strictness: "strict"
12
+ type_checking_strictness: "strict",
13
+ prettify_output_executable_path: nil
13
14
  }
14
15
  )
15
16
 
@@ -23,7 +23,9 @@ module Gloss
23
23
  def run
24
24
  @files_to_process.each do |path_string|
25
25
  # currently steep would give an `unexpected jump` if next was used
26
- unless @processed_files.member?(path_string) || OUTPUT_BY_PATH.[](path_string)
26
+ if path_string.end_with? ".rbs"
27
+ @type_checker.load_sig_path path_string
28
+ elsif !@processed_files.member?(path_string) || !OUTPUT_BY_PATH.[](path_string)
27
29
  Gloss.logger.debug "Loading #{path_string}"
28
30
  path = Utils.absolute_path(path_string)
29
31
  file_contents = File.open(path).read
@@ -1,3 +1,3 @@
1
1
  module Gloss
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -21,6 +21,9 @@ module Gloss
21
21
  file.puts sb if sb
22
22
  file.puts @content
23
23
  end
24
+ if Config.prettify_output_executable_path
25
+ system Config.prettify_output_executable_path, @output_path.to_s
26
+ end
24
27
  end
25
28
 
26
29
  private def shebang
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - johansenja
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_blank
@@ -42,28 +42,28 @@ dependencies:
42
42
  name: rbs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: steep
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.41.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.41.0
69
69
  - !ruby/object:Gem::Dependency
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rufo
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: A rich language which compiles to ruby. Including type annotations, type
126
140
  checking, macros, annotations, enums and more
127
141
  email:
@@ -217,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
231
  - !ruby/object:Gem::Version
218
232
  version: '0'
219
233
  requirements: []
220
- rubygems_version: 3.1.2
234
+ rubygems_version: 3.2.3
221
235
  signing_key:
222
236
  specification_version: 4
223
237
  summary: A superset of ruby