gloss 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed8cc1e615a2df1545467719ac63f8e2667a6e80c0e8fb3e05bf2e11d657779c
4
- data.tar.gz: 59ecbb8e9f8327d8ffc86ffcb7254526b8dc2874d9c72b9fcd5f316f8c02334d
3
+ metadata.gz: 0cb01614c6e4395edaf5600dd39e958b2ca86ae6c2650c2028519659c813ff64
4
+ data.tar.gz: a1ee0171851a7463113c4e12dff9dd81bb2c003e080896171060dfc439a18499
5
5
  SHA512:
6
- metadata.gz: 91a18fc32f3a8dd27e14e9206c623fa3c608b0c6215ed8f239ae4f23a5ffa1f529b6b0cf4ddb6beeeb103b0d522c3a7bfdf5dc1d4462df0ba8a9da6598cb7c79
7
- data.tar.gz: 8c42f4e1c6b92b5823835684d932ce686c6c517558d8e0061dc5633d7aa8eb11f8c652bf6aadca0bd5748731fdc51ae09543354de505da57640c89f5b457f5b4
6
+ metadata.gz: 781f7dc53f12231f843947aa619521fbd99deca1bf15a7a5263a279e7a030683c4da2d72722beb30d4a35beba8e98e86085eabd3046d1567be1c37c7d577c6d7
7
+ data.tar.gz: b3a63fbcb5c81a8c0d4336dcfdb64d46a2ebf624fd804942ba8243c04b43fab05a881ba6386e6f6a5c7fb76b416ca8677212e7993ea8ea22cdca981bff2645fd
@@ -0,0 +1,41 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ env:
9
+ ImageOS: ubuntu18
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ container:
14
+ image: johansenja/gloss:latest
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v2
18
+ - uses: actions/cache@v2
19
+ id: gems-cache
20
+ with:
21
+ path: vendor/bundle
22
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
23
+ restore-keys: |
24
+ ${{ runner.os }}-gems-
25
+ - name: install Bundler
26
+ run: gem install bundler:2.2.3
27
+ - name: install gems
28
+ run: bundle install --jobs 4 --retry 3
29
+ - name: Compile extension
30
+ run: make
31
+ working-directory: ext/gloss
32
+ - name: Run tests
33
+ run: rake
34
+ - name: Install dependencies
35
+ run: shards install
36
+ working-directory: ext/gloss
37
+ - name: Run tests
38
+ run: crystal spec
39
+ working-directory: ext/gloss
40
+ - name: Build self with current state
41
+ run: exe/gloss build
data/.gloss.yml CHANGED
@@ -2,3 +2,4 @@
2
2
  frozen_string_literals: true
3
3
  src_dir: src
4
4
  entrypoint: src/exe/gloss
5
+ type_checking_strictness: lenient
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloss (0.1.3)
4
+ gloss (0.1.4)
5
5
  fast_blank
6
6
  listen
7
- rbs
8
- steep
7
+ rbs (~> 1.0.4)
8
+ steep (~> 0.41.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.1)
13
+ activesupport (6.1.3)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
18
  zeitwerk (~> 2.3)
19
- ast (2.4.1)
19
+ ast (2.4.2)
20
20
  ast_utils (0.4.0)
21
21
  parser (>= 2.7.0)
22
22
  byebug (11.1.3)
@@ -24,15 +24,15 @@ GEM
24
24
  concurrent-ruby (1.1.8)
25
25
  diff-lcs (1.4.4)
26
26
  fast_blank (1.0.0)
27
- ffi (1.14.2)
28
- i18n (1.8.8)
27
+ ffi (1.15.0)
28
+ i18n (1.8.9)
29
29
  concurrent-ruby (~> 1.0)
30
30
  language_server-protocol (3.15.0.1)
31
31
  listen (3.4.1)
32
32
  rb-fsevent (~> 0.10, >= 0.10.3)
33
33
  rb-inotify (~> 0.9, >= 0.9.10)
34
34
  method_source (1.0.0)
35
- minitest (5.14.3)
35
+ minitest (5.14.4)
36
36
  parallel (1.20.1)
37
37
  parser (2.7.2.0)
38
38
  ast (~> 2.4.1)
@@ -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.4)
52
+ rbs (1.0.6)
53
53
  regexp_parser (2.0.3)
54
54
  rexml (3.2.4)
55
55
  rspec (3.10.0)
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
- # Gloss
1
+ # ![Gloss](./logo.svg "Gloss")
2
2
  [![Gem Version](https://badge.fury.io/rb/gloss.svg)](https://rubygems.org/gems/gloss)
3
- [![Ruby Specs](https://github.com/johansenja/gloss/workflows/Ruby%20Specs/badge.svg)](https://github.com/johansenja/gloss/actions?query=workflow%3A%22Ruby+Specs%22)
4
- [![Crystal Specs](https://github.com/johansenja/gloss/workflows/Crystal%20Specs/badge.svg)](https://github.com/johansenja/gloss/actions?query=workflow%3A%22Crystal+Specs%22)
5
- [![Total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/gloss?type=total&color=green&metric=true&label=downloads%20(total)&total_label=)](https://rubygems.org/gems/gloss)
3
+ [![Tests](https://github.com/johansenja/gloss/workflows/Tests/badge.svg)](https://github.com/johansenja/gloss/actions?query=workflow%3ATests)
4
+ [![Total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/gloss?type=total&color=green&label=downloads%20(total)&total_label=)](https://rubygems.org/gems/gloss)
6
5
  [![Current Version](http://ruby-gem-downloads-badge.herokuapp.com/gloss?color=green&label=downloads%20(current%20version)&metric=true)](https://rubygems.org/gems/gloss)
7
6
 
8
7
  [Gloss](https://en.wikipedia.org/wiki/Gloss_(annotation)) is a high-level programming language based on [Ruby](https://github.com/ruby/ruby) and [Crystal](https://github.com/crystal-lang/crystal), which compiles to ruby; its aims are on transparency,
@@ -136,7 +135,7 @@ class Language
136
135
  TS = "TypeScript"
137
136
  P = "Python"
138
137
  end
139
-
138
+
140
139
  def favourite_language(language : Lang)
141
140
  puts "my favourite language is #{language}"
142
141
  end
@@ -212,7 +211,7 @@ end
212
211
  ```crystal
213
212
  abstract class BaseClass
214
213
  attr_reader :var
215
-
214
+
216
215
  def initialize(@var); end
217
216
  end
218
217
 
data/Rakefile CHANGED
@@ -17,8 +17,10 @@ RSpec::Core::RakeTask.new :spec do |spec|
17
17
  spec.pattern = 'spec/**/*_spec.rb'
18
18
  end
19
19
 
20
- task :build do
20
+ task :build_gem do
21
21
  sh "cd", "ext/gloss", "&&", "make", "all", "&&", "cd", "-"
22
22
  end
23
23
 
24
- task :default => [:spec]
24
+ task build: [:build_gem]
25
+
26
+ task default: [:spec]
data/ext/gloss/Makefile CHANGED
@@ -3,16 +3,8 @@ PLATFORM = $(shell uname -s)
3
3
 
4
4
  ifeq "$(PLATFORM)" "Darwin"
5
5
  TARGET = ../../lib/gls.bundle
6
-
7
- clean:
8
- rm -f $(TARGET) $(TARGET).dwarf
9
- endif
10
-
11
- ifeq "$(PLATFORM)" "Linux"
6
+ else
12
7
  TARGET = ../../lib/gls.so
13
-
14
- clean:
15
- rm -f $(TARGET)
16
8
  endif
17
9
 
18
10
  install: all
@@ -23,4 +15,8 @@ shards:
23
15
  shards
24
16
 
25
17
  build: ./src/gloss.cr
26
- $(CRYSTAL) build --link-flags "-shared -dynamic -Wl,-undefined,dynamic_lookup" $< -o $(TARGET) --release
18
+ $(CRYSTAL) build --link-flags "-shared -Wl,-undefined,dynamic_lookup" $< -o $(TARGET) --release
19
+
20
+ clean:
21
+ rm -f $(TARGET)
22
+ rm -f $(TARGET).dwarf
data/gloss.gemspec CHANGED
@@ -17,11 +17,11 @@ 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"
21
- s.add_runtime_dependency "steep"
20
+ s.add_runtime_dependency "rbs", "~>1.0.4"
21
+ s.add_runtime_dependency "steep", "~>0.41.0"
22
22
 
23
+ s.add_development_dependency "pry-byebug"
23
24
  s.add_development_dependency "rake-compiler"
24
25
  s.add_development_dependency "rspec"
25
- s.add_development_dependency "pry-byebug"
26
26
  s.add_development_dependency "rubocop"
27
27
  end
data/lib/gloss/config.rb CHANGED
@@ -10,14 +10,18 @@ module Gloss
10
10
  Config = OpenStruct.new(default_config: {:frozen_string_literals => true,
11
11
  :src_dir => "src",
12
12
  :entrypoint => nil,
13
- :strict_require => false}.freeze)
14
- user_config = (if File.exist?(CONFIG_PATH)
15
- YAML.safe_load(File.read(CONFIG_PATH))
16
- else
13
+ :strict_require => false,
14
+ :type_checking_strictness => "strict"}.freeze)
15
+ def self.load_config()
16
+ user_config = (if File.exist?(File.absolute_path(File.join(Dir.pwd, CONFIG_PATH)))
17
+ YAML.safe_load(File.read(CONFIG_PATH))
18
+ else
19
+ Config.default_config
20
+ end)
17
21
  Config.default_config
18
- end)
19
- Config.default_config
20
22
  .each() { |k, v|
21
- Config.send(:"#{k}=", user_config.[](k.to_s) || v)
22
- }
23
+ Config.send(:"#{k}=", user_config.[](k.to_s) || v)
24
+ }
25
+ end
26
+ load_config
23
27
  end
data/lib/gloss/logger.rb CHANGED
@@ -24,6 +24,11 @@ nil => nil,
24
24
  else
25
25
  IO::NULL
26
26
  end))
27
+ .tap() { |l|
28
+ (if real_log_level
29
+ l.level=(real_log_level)
30
+ end)
31
+ }
27
32
  end)
28
33
  end
29
34
  end
@@ -7,6 +7,7 @@ require "rubygems/gem_runner"
7
7
  module Gloss
8
8
  OUTPUT_BY_PATH = Hash.new
9
9
  class ProgLoader
10
+ attr_reader(:"type_checker")
10
11
  def initialize()
11
12
  entrypoint = Config.entrypoint
12
13
  (if entrypoint.==(nil) || entrypoint.==("")
@@ -26,12 +27,14 @@ module Gloss
26
27
  .read
27
28
  contents_tree = Parser.new(file_contents)
28
29
  .run
29
- on_new_file_referenced = proc() { |pa, relative|
30
- (if relative
31
- handle_require_relative(pa)
32
- else
33
- handle_require(pa)
34
- end)
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)
37
+ }
35
38
  }
36
39
  OUTPUT_BY_PATH.[]=(path_string, Visitor.new(contents_tree, @type_checker, on_new_file_referenced)
37
40
  .run)
@@ -60,7 +63,7 @@ return
60
63
  pathn = Pathname.new("#{File.join(Dir.pwd, "sig", path)}.rbs")
61
64
  gem_path = Utils.gem_path_for(path)
62
65
  (if gem_path
63
- sig_files = Dir.glob(File.absolute_path(File.join(gem_path, "..", "..", "sig", "**", "*.rbs")))
66
+ sig_files = Dir.glob(File.absolute_path(File.join(gem_path, "..", "sig", "**", "*.rbs")))
64
67
  (if sig_files.length
65
68
  .positive?
66
69
  sig_files.each() { |fp|
@@ -81,7 +84,7 @@ return
81
84
  @type_checker.load_sig_path(pathn.to_s)
82
85
  @processed_files.add(pathn.to_s)
83
86
  else
84
- rbs_stdlib_dir = File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "..", "stdlib", path))
87
+ rbs_stdlib_dir = File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "stdlib", path))
85
88
  (if Pathname.new(rbs_stdlib_dir)
86
89
  .exist?
87
90
  load_rbs_from_require_path(path)
@@ -103,12 +106,12 @@ nil }
103
106
  end)
104
107
  end)
105
108
  end
106
- private def handle_require_relative(path)
107
- base = File.join(@filepath, "..", path)
109
+ private def handle_require_relative(path, source_file)
110
+ base = File.join(source_file, "..", path)
108
111
  # @type var pn: String?
109
112
  pn = nil
110
- Gem.suffixes
111
- .each() { |ext|
113
+ exts = [".gl"].concat(Gem.suffixes)
114
+ exts.each() { |ext|
112
115
  full = File.absolute_path(base.+(ext))
113
116
  (if File.exist?(full)
114
117
  pn = full
@@ -120,7 +123,7 @@ nil }
120
123
  end
121
124
  else
122
125
  (if Config.strict_require
123
- throw(:"error", "Cannot resolve require path for #{pn}")
126
+ throw(:"error", "Cannot resolve relative path for #{path}")
124
127
  else
125
128
  Gloss.logger
126
129
  .debug("No path found for #{path}")
@@ -128,7 +131,7 @@ nil }
128
131
  end)
129
132
  end
130
133
  private def rbs_stdlib_path_for(libr)
131
- File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "..", "stdlib", libr))
134
+ File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "stdlib", libr))
132
135
  end
133
136
  private def load_rbs_from_require_path(path)
134
137
  Dir.glob(File.join(rbs_stdlib_path_for(path), "**", "*.rbs"))
@@ -6,13 +6,23 @@
6
6
  require "set"
7
7
  module Gloss
8
8
  class TypeChecker
9
- Project = Struct.new(:"targets")
10
9
  attr_reader(:"steep_target", :"top_level_decls", :"env", :"rbs_gem_dir")
10
+ module Strictness
11
+ Strict = "strict"
12
+ Lenient = "lenient"
13
+ Default = "default"
14
+ end
11
15
  def initialize()
12
- @steep_target = Steep::Project::Target.new(name: "gloss", options: Steep::Project::Options.new
13
- .tap() { |o|
14
- o.allow_unknown_constant_assignment=(true)
15
- }, source_patterns: ["**/*.rb"], ignore_patterns: Array.new, signature_patterns: ["sig"])
16
+ options = Steep::Project::Options.new
17
+ case Config.type_checking_strictness
18
+ when Strictness::Strict
19
+ options.apply_strict_typing_options!
20
+ when Strictness::Lenient
21
+ options.apply_lenient_typing_options!
22
+ else
23
+ options.apply_default_typing_options!
24
+ end
25
+ @steep_target = Steep::Project::Target.new(name: "gloss", options: options, source_patterns: ["**/*.rb"], ignore_patterns: Array.new, signature_patterns: ["sig"])
16
26
  @top_level_decls = Set.new
17
27
  @rbs_gem_dir = Utils.gem_path_for("rbs")
18
28
  env_loader = RBS::EnvironmentLoader.new
@@ -51,7 +61,7 @@ case e
51
61
  when Steep::Diagnostic::Ruby::UnexpectedBlockGiven
52
62
  "Unexpected block given"
53
63
  else
54
- "#{e.header_line}\n#{e.inspect}"
64
+ "#{e.header_line}\n#{e}"
55
65
  end
56
66
  }
57
67
  .join("\n")
data/lib/gloss/utils.rb CHANGED
@@ -21,17 +21,11 @@ module Gloss
21
21
  end)
22
22
  end
23
23
  def gem_path_for(gem_name)
24
- begin
25
- Gem.ui
26
- .instance_variable_set(:"@outs", StringIO.new)
27
- Gem::GemRunner.new
28
- .run(["which", gem_name])
29
- Gem.ui
30
- .outs
31
- .string
32
- rescue SystemExit => e
33
- nil
34
- end
24
+ spec = Gem::Specification.find_by_path(gem_name)
25
+ (if spec
26
+ spec.full_require_paths
27
+ .first
28
+ end)
35
29
  end
36
30
  def with_file_header(str)
37
31
  "#{Visitor::FILE_HEADER}\n\n#{str}"
data/lib/gloss/version.rb CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
- ##### This file was generated by Gloss; any changes made here will be overwritten.
4
- ##### See src/ to make changes
3
+ ##### This file was generated by Gloss; any changes made here will be overwritten.
4
+ ##### See src/ to make changes
5
5
 
6
6
  module Gloss
7
- VERSION = "0.1.3"
7
+ VERSION = "0.1.4"
8
8
  end
data/lib/gloss/visitor.rb CHANGED
@@ -184,6 +184,7 @@ EMPTY_ARRAY }
184
184
  else
185
185
  nil
186
186
  end)
187
+ name = node.[](:"name")
187
188
  block = (if node.[](:"block")
188
189
  " #{visit_node(node.[](:"block"))}"
189
190
  else
@@ -195,14 +196,21 @@ EMPTY_ARRAY }
195
196
  else
196
197
  nil
197
198
  end)
198
- name = node.[](:"name")
199
199
  call = "#{obj}#{name}#{opening_delimiter}#{args}#{(if has_parens
200
200
  ")"
201
201
  end)}#{block}"
202
202
  case name
203
203
  when "require_relative"
204
204
  (if @on_new_file_referenced
205
- @on_new_file_referenced.call(name, true)
205
+ paths = arg_arr.map() { |a|
206
+ unless a.[](:"type")
207
+ .==("LiteralNode")
208
+ throw(:"error", "Dynamic file paths are not allowed in require_relative")
209
+ end
210
+ eval(visit_node(a, scope)
211
+ .strip)
212
+ }
213
+ @on_new_file_referenced.call(paths, true)
206
214
  end)
207
215
  when "module_function"
208
216
  @after_module_function = true
@@ -254,7 +262,7 @@ case name
254
262
  path = node.[](:"value")
255
263
  src.write_ln("require \"#{path}\"")
256
264
  (if @on_new_file_referenced
257
- @on_new_file_referenced.call(path, false)
265
+ @on_new_file_referenced.call([path], false)
258
266
  end)
259
267
  when "Assign", "OpAssign"
260
268
  src.write_ln("#{visit_node(node.[](:"target"))} #{node.[](:"op")}= #{visit_node(node.[](:"value"))
data/lib/gloss/watcher.rb CHANGED
@@ -6,6 +6,8 @@
6
6
  require "listen"
7
7
  module Gloss
8
8
  class Watcher
9
+ # @type var @listener: Listen?
10
+ @listener
9
11
  def initialize(paths)
10
12
  @paths = paths
11
13
  (if @paths.empty?
@@ -32,7 +34,7 @@ module Gloss
32
34
  def watch()
33
35
  Gloss.logger
34
36
  .info("Now listening for changes in #{@paths.join(", ")}")
35
- listener = Listen.to(*@paths, latency: 2, only: @only) { |modified, added, removed|
37
+ @listener ||= Listen.to(*@paths, latency: 2, only: @only) { |modified, added, removed|
36
38
  modified.+(added)
37
39
  .each() { |f|
38
40
  Gloss.logger
@@ -64,13 +66,18 @@ nil }
64
66
  }
65
67
  }
66
68
  begin
67
- listener.start
69
+ @listener.start
68
70
  sleep
69
71
  rescue Interrupt
70
- Gloss.logger
71
- .info("Interrupt signal received, shutting down")
72
- exit(0)
72
+ kill
73
73
  end
74
74
  end
75
+ def kill()
76
+ Gloss.logger
77
+ .info("Interrupt signal received, shutting down")
78
+ (if @listener
79
+ @listener.stop
80
+ end)
81
+ end
75
82
  end
76
83
  end
data/logo.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg width="171px" height="100px" xmlns="http://www.w3.org/2000/svg" viewBox="175 25 150 150" style="background-color: transparent;" preserveAspectRatio="xMidYMid"><defs><filter id="editing-golden" x="-100%" y="-100%" width="300%" height="300%"><feFlood flood-color="#000000" result="flood"></feFlood><feFlood flood-color="#eaa5a5" result="flood-light"></feFlood><feComposite operator="in" in="flood" in2="SourceAlpha" result="flood-comp"></feComposite><feGaussianBlur in="flood-comp" stdDeviation="3" result="blur"></feGaussianBlur><feOffset in="blur" dy="3" result="offset-blur"></feOffset><feComponentTransfer in="offset-blur" result="comp-blur"><feFuncA type="linear" slope="0.7" intercept="-0.1"></feFuncA></feComponentTransfer><feSpecularLighting surfaceScale="200" specularConstant="20" specularExponent="1" lighting-color="#fff" in="blur" result="specular"><fePointLight x="-250" y="-250" z="3500"></fePointLight></feSpecularLighting><feComponentTransfer in="specular" result="inspecular"><feFuncA type="linear" slope="-1" intercept="1"></feFuncA></feComponentTransfer><feComposite operator="in" in="flood-light" in2="inspecular" result="inspecular2"></feComposite><feComposite operator="in" in="inspecular2" in2="SourceAlpha" result="light"></feComposite><feMerge><feMergeNode in="comp-blur"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode><feMergeNode in="light"></feMergeNode></feMerge></filter></defs><g filter="url(#editing-golden)"><g transform="translate(119.08499717712402, 130.10500073432922)"><path d="M27.50-50.40L27.50-50.40L27.50-50.40Q23.22-39.91 23.22-30.87L23.22-30.87L23.22-30.87Q23.22-21.83 26.91-17.55L26.91-17.55L26.91-17.55Q30.60-13.27 38.84-13.27L38.84-13.27L38.84-13.27Q43.76-13.27 47.51-16.80L47.51-16.80L47.51-16.80Q48.69-25.57 49.43-28.46L49.43-28.46L49.43-28.46Q51.25-35.52 55.00-35.52L55.00-35.52L55.00-35.52Q57.99-35.52 60.67-31.40L60.67-31.40L60.67-31.40Q63.34-27.29 63.24-24.40L63.24-24.40L63.24-24.40Q63.24-19.58 59.38-6.53L59.38-6.53L59.38-6.53Q66.88-12.20 76.61-23.33L76.61-23.33L76.61-23.33Q78.00-24.93 78.97-24.93L78.97-24.93L78.97-24.93Q80.46-24.93 80.46-21.40L80.46-21.40L80.46-21.40Q80.46-14.55 73.62-6.79L73.62-6.79L73.62-6.79Q66.77 0.96 55.43 5.56L55.43 5.56L55.43 5.56Q54.57 7.60 54.03 9.42L54.03 9.42L54.03 9.42Q53.50 11.23 52.64 13.80L52.64 13.80L52.64 13.80Q51.79 16.37 49.65 19.42L49.65 19.42L49.65 19.42Q47.51 22.47 44.30 24.61L44.30 24.61L44.30 24.61Q37.45 29.32 28.62 29.32L28.62 29.32L28.62 29.32Q19.79 29.32 13.86 25.41L13.86 25.41L13.86 25.41Q7.92 21.51 7.92 14.66L7.92 14.66L7.92 14.66Q7.92 11.34 11.13 9.20L11.13 9.20L11.13 9.20Q14.34 7.06 19.47 5.51L19.47 5.51L19.47 5.51Q24.61 3.96 31.03 2.78L31.03 2.78L31.03 2.78Q37.45 1.60 43.87 0.11L43.87 0.11L43.87 0.11Q44.73-2.35 45.15-4.49L45.15-4.49L45.15-4.49Q40.98-1.28 34.88-1.28L34.88-1.28L34.88-1.28Q22.15-1.28 14.87-6.53L14.87-6.53L14.87-6.53Q6.42-12.63 6.42-25.57L6.42-25.57L6.42-25.57Q6.42-42.48 14.98-57.67L14.98-57.67L14.98-57.67Q12.41-60.67 10.81-63.93L10.81-63.93L10.81-63.93Q9.20-67.20 9.20-68.91L9.20-68.91L9.20-68.91Q9.20-71.90 11.34-71.80L11.34-71.80L11.34-71.80Q12.73-71.80 14.55-70.08L14.55-70.08L14.55-70.08Q16.37-68.37 17.49-67.20L17.49-67.20L17.49-67.20Q18.62-66.02 19.90-65.06L19.90-65.06L19.90-65.06Q25.47-72.12 32.96-76.50L32.96-76.50L32.96-76.50Q40.45-80.89 49.43-80.89L49.43-80.89L49.43-80.89Q58.42-80.89 63.45-77.58L63.45-77.58L63.45-77.58Q68.48-74.26 68.48-66.02L68.48-66.02L68.48-66.02Q68.48-57.78 62.11-52.32L62.11-52.32L62.11-52.32Q55.75-46.87 44.41-46.87L44.41-46.87L44.41-46.87Q36.59-46.87 27.50-50.40ZM31.03-57.67L31.03-57.67L31.03-57.67Q36.91-55.10 45.26-55.10L45.26-55.10L45.26-55.10Q50.40-55.10 53.50-57.89L53.50-57.89L53.50-57.89Q56.60-60.67 56.60-63.93L56.60-63.93L56.60-63.93Q56.60-67.20 54.52-68.75L54.52-68.75L54.52-68.75Q52.43-70.30 49.01-70.30L49.01-70.30L49.01-70.30Q38.73-70.30 31.03-57.67ZM27.39 21.08L27.39 21.08L27.39 21.08Q34.67 21.08 40.13 10.16L40.13 10.16L40.13 10.16Q34.24 11.66 30.17 12.52L30.17 12.52L30.17 12.52Q26.11 13.38 23.59 14.02L23.59 14.02L23.59 14.02Q21.08 14.66 19.96 15.30L19.96 15.30L19.96 15.30Q18.83 15.94 18.83 17.12L18.83 17.12L18.83 17.12Q18.83 19.15 21.56 20.06L21.56 20.06L21.56 20.06Q24.29 20.97 27.39 21.08ZM98.97 0.32L98.97 0.32L98.97 0.32Q83.67 0.43 78.11-11.13L78.11-11.13L78.11-11.13Q76.18-15.19 76.18-21.35L76.18-21.35L76.18-21.35Q76.18-27.50 77.25-34.45L77.25-34.45L77.25-34.45Q79.39-48.36 85.49-60.13L85.49-60.13L85.49-60.13Q88.60-66.13 92.45-70.41L92.45-70.41L92.45-70.41Q100.90-79.82 111.28-79.72L111.28-79.72L111.28-79.72Q115.88-79.72 118.50-77.20L118.50-77.20L118.50-77.20Q121.12-74.69 121.12-69.98L121.12-69.98L121.12-69.98Q121.12-65.27 118.34-60.51L118.34-60.51L118.34-60.51Q115.56-55.75 111.23-50.66L111.23-50.66L111.23-50.66Q106.89-45.58 101.65-40.02L101.65-40.02L101.65-40.02Q96.41-34.45 91.38-27.93L91.38-27.93L91.38-23.65L91.38-23.65Q91.38-17.66 93.95-14.87L93.95-14.87L93.95-14.87Q96.51-12.09 99.94-12.09L99.94-12.09L99.94-12.09Q109.14-12.09 116.20-21.19L116.20-21.19L116.20-21.19Q119.09-24.93 120.59-24.93L120.59-24.93L120.59-24.93Q122.09-24.93 122.09-21.29L122.09-21.29L122.09-21.29Q122.09-17.66 120.11-13.86L120.11-13.86L120.11-13.86Q118.13-10.06 114.92-6.90L114.92-6.90L114.92-6.90Q111.71-3.75 107.53-1.71L107.53-1.71L107.53-1.71Q103.36 0.32 98.97 0.32ZM104.75-57.14L104.75-57.14L104.75-57.14Q107-59.92 108.28-62.17L108.28-62.17L108.28-62.17Q109.57-64.41 109.57-66.82L109.57-66.82L109.57-66.82Q109.57-69.23 107.86-69.23L107.86-69.23L107.86-69.23Q104.11-69.23 99.56-61.52L99.56-61.52L99.56-61.52Q95.02-53.82 92.77-41.30L92.77-41.30L92.77-41.30Q96.41-46.87 99.46-50.61L99.46-50.61L99.46-50.61Q102.51-54.36 104.75-57.14ZM159.00-9.10L159.00-9.10L159.00-9.10Q150.55 0.86 138.73 0.86L138.73 0.86L138.73 0.86Q126.90 0.86 121.02-5.19L121.02-5.19L121.02-5.19Q115.13-11.23 115.24-20.22L115.24-20.22L115.24-20.22Q115.13-32.96 123.26-42.16L123.26-42.16L123.26-42.16Q131.40-51.36 144.56-51.36L144.56-51.36L144.56-51.36Q150.55-51.36 154.19-49.86L154.19-49.86L154.19-49.86Q160.50-47.29 160.50-45.05L160.50-45.05L160.50-45.05Q160.50-43.34 151.67-43.28L151.67-43.28L151.67-43.28Q142.84-43.23 136.91-37.18L136.91-37.18L136.91-37.18Q130.97-31.14 130.97-21.93L130.97-21.93L130.97-21.93Q130.97-17.12 133.80-13.86L133.80-13.86L133.80-13.86Q136.64-10.59 141.83-10.59L141.83-10.59L141.83-10.59Q147.02-10.59 150.44-12.73L150.44-12.73L150.44-12.73Q142.84-17.87 142.84-27.61L142.84-27.61L142.84-27.61Q142.74-32.74 146.54-36.97L146.54-36.97L146.54-36.97Q150.33-41.20 156.27-41.25L156.27-41.25L156.27-41.25Q162.21-41.30 164.78-37.98L164.78-37.98L164.78-37.98Q167.35-34.67 167.35-29.48L167.35-29.48L167.35-29.48Q167.35-24.29 164.89-18.51L164.89-18.51L165.53-18.51L165.53-18.51Q170.24-18.62 173.66-21.83L173.66-21.83L173.66-21.83Q174.94-23.11 175.85-24.07L175.85-24.07L175.85-24.07Q176.76-25.04 177.73-25.04L177.73-25.04L177.73-25.04Q179.22-25.04 179.22-21.51L179.22-21.51L179.22-21.51Q179.22-14.98 175.37-11.72L175.37-11.72L175.37-11.72Q171.52-8.45 166.87-8.45L166.87-8.45L166.87-8.45Q162.21-8.45 159.00-9.10ZM158.04-21.51L158.04-21.51L158.04-21.51Q159.86-25.36 159.86-29.00L159.86-29.00L159.86-29.00Q159.86-32.63 157.50-32.63L157.50-32.63L157.50-32.63Q156.54-32.63 155.90-31.24L155.90-31.24L155.90-31.24Q155.26-29.85 155.26-28.57L155.26-28.57L155.26-28.57Q155.26-24.29 158.04-21.51ZM198.27-51.84L198.27-51.84L198.27-51.84Q205.44-51.89 208.97-49.17L208.97-49.17L208.97-49.17Q212.50-46.44 212.50-41.36L212.50-41.36L212.50-41.36Q212.50-36.27 209.45-32.69L209.45-32.69L209.45-32.69Q206.40-29.10 202.02-27.61L202.02-27.61L202.02-27.61Q205.12-24.40 207.63-21.08L207.63-21.08L207.63-21.08Q210.15-17.76 210.15-14.12L210.15-14.12L210.15-14.12Q210.15-6.96 204.48-3.05L204.48-3.05L204.48-3.05Q198.81 0.86 188.69 0.86L188.69 0.86L188.69 0.86Q178.58 0.86 173.55-3.16L173.55-3.16L173.55-3.16Q168.53-7.17 168.53-12.25L168.53-12.25L168.53-12.25Q168.53-17.33 171.04-21.51L171.04-21.51L171.04-21.51Q173.55-25.68 176.44-25.68L176.44-25.68L176.44-25.68Q178.16-25.68 178.90-24.45L178.90-24.45L178.90-24.45Q179.65-23.22 181.69-17.33L181.69-17.33L181.69-17.33Q182.44-15.19 184.15-13.27L184.15-13.27L184.15-13.27Q188.11-8.88 196.67-8.88L196.67-8.88L196.67-8.88Q195.38-12.95 192.55-15.89L192.55-15.89L192.55-15.89Q189.71-18.83 186.93-21.61L186.93-21.61L186.93-21.61Q184.15-24.40 182.01-27.55L182.01-27.55L182.01-27.55Q179.87-30.71 179.87-34.99L179.87-34.99L179.87-34.99Q179.87-42.69 185.64-47.51L185.64-47.51L185.64-47.51Q191.10-51.79 198.27-51.84ZM197.84-31.99L197.84-31.99L197.84-31.99Q202.12-36.59 202.12-39.38L202.12-39.38L202.12-39.38Q202.12-40.66 201.21-41.68L201.21-41.68L201.21-41.68Q200.30-42.69 198.59-42.69L198.59-42.69L198.59-42.69Q196.88-42.69 195.33-42.27L195.33-42.27L195.33-42.27Q193.78-41.84 192.81-41.62L192.81-41.62L192.81-41.62Q192.81-37.56 197.84-31.99ZM241.18-51.84L241.18-51.84L241.18-51.84Q248.35-51.89 251.88-49.17L251.88-49.17L251.88-49.17Q255.41-46.44 255.41-41.36L255.41-41.36L255.41-41.36Q255.41-36.27 252.36-32.69L252.36-32.69L252.36-32.69Q249.31-29.10 244.92-27.61L244.92-27.61L244.92-27.61Q248.03-24.40 250.54-21.08L250.54-21.08L250.54-21.08Q253.06-17.76 253.06-14.12L253.06-14.12L253.06-14.12Q253.06-6.96 247.38-3.05L247.38-3.05L247.38-3.05Q241.71 0.86 231.60 0.86L231.60 0.86L231.60 0.86Q221.49 0.86 216.46-3.16L216.46-3.16L216.46-3.16Q211.43-7.17 211.43-12.25L211.43-12.25L211.43-12.25Q211.43-17.33 213.95-21.51L213.95-21.51L213.95-21.51Q216.46-25.68 219.35-25.68L219.35-25.68L219.35-25.68Q221.06-25.68 221.81-24.45L221.81-24.45L221.81-24.45Q222.56-23.22 224.59-17.33L224.59-17.33L224.59-17.33Q225.34-15.19 227.05-13.27L227.05-13.27L227.05-13.27Q231.01-8.88 239.57-8.88L239.57-8.88L239.57-8.88Q238.29-12.95 235.45-15.89L235.45-15.89L235.45-15.89Q232.62-18.83 229.84-21.61L229.84-21.61L229.84-21.61Q227.05-24.40 224.91-27.55L224.91-27.55L224.91-27.55Q222.77-30.71 222.77-34.99L222.77-34.99L222.77-34.99Q222.77-42.69 228.55-47.51L228.55-47.51L228.55-47.51Q234.01-51.79 241.18-51.84ZM240.75-31.99L240.75-31.99L240.75-31.99Q245.03-36.59 245.03-39.38L245.03-39.38L245.03-39.38Q245.03-40.66 244.12-41.68L244.12-41.68L244.12-41.68Q243.21-42.69 241.50-42.69L241.50-42.69L241.50-42.69Q239.79-42.69 238.24-42.27L238.24-42.27L238.24-42.27Q236.68-41.84 235.72-41.62L235.72-41.62L235.72-41.62Q235.72-37.56 240.75-31.99Z" fill="#ae0606"></path></g></g><style>text {
2
+ font-size: 64px;
3
+ font-family: Arial Black;
4
+ dominant-baseline: central;
5
+ text-anchor: middle;
6
+ }</style></svg>
@@ -8,14 +8,19 @@ module Gloss
8
8
  frozen_string_literals: true,
9
9
  src_dir: "src",
10
10
  entrypoint: nil,
11
- strict_require: false
11
+ strict_require: false,
12
+ type_checking_strictness: "strict"
12
13
  }
13
14
  )
14
15
 
15
- user_config = if File.exist?(CONFIG_PATH)
16
- YAML.safe_load(File.read(CONFIG_PATH))
17
- else
18
- Config.default_config
19
- end
20
- Config.default_config.each { |k, v| Config.send(:"#{k}=", user_config[k.to_s] || v) }
16
+ def self.load_config
17
+ user_config = if File.exist?(File.absolute_path(File.join(Dir.pwd, CONFIG_PATH)))
18
+ YAML.safe_load(File.read(CONFIG_PATH))
19
+ else
20
+ Config.default_config
21
+ end
22
+ Config.default_config.each { |k, v| Config.send(:"#{k}=", user_config[k.to_s] || v) }
23
+ end
24
+
25
+ load_config
21
26
  end
@@ -15,7 +15,9 @@ module Gloss
15
15
  nil => nil,
16
16
  "" => nil
17
17
  }.fetch env_log_level
18
- @logger = Logger.new(real_log_level ? STDOUT : IO::NULL)
18
+ @logger = Logger.new(real_log_level ? STDOUT : IO::NULL).tap do |l|
19
+ l.level = real_log_level if real_log_level
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -4,6 +4,8 @@ module Gloss
4
4
  OUTPUT_BY_PATH = Hash.new
5
5
 
6
6
  class ProgLoader
7
+ attr_reader :type_checker
8
+
7
9
  def initialize
8
10
  entrypoint = Config.entrypoint
9
11
  if entrypoint == nil || entrypoint == ""
@@ -26,11 +28,13 @@ module Gloss
26
28
  path = Utils.absolute_path(path_string)
27
29
  file_contents = File.open(path).read
28
30
  contents_tree = Parser.new(file_contents).run
29
- on_new_file_referenced = proc do |pa, relative|
30
- if relative
31
- handle_require_relative pa
32
- else
33
- handle_require pa
31
+ on_new_file_referenced = proc do |ps, relative|
32
+ ps.each do |pa|
33
+ if relative
34
+ handle_require_relative pa, path_string
35
+ else
36
+ handle_require pa
37
+ end
34
38
  end
35
39
  end
36
40
  OUTPUT_BY_PATH.[](path_string) = Visitor.new(contents_tree, @type_checker, on_new_file_referenced).run
@@ -68,7 +72,7 @@ module Gloss
68
72
  pathn = Pathname.new("#{File.join(Dir.pwd, "sig", path)}.rbs")
69
73
  gem_path = Utils.gem_path_for(path)
70
74
  if gem_path
71
- sig_files = Dir.glob(File.absolute_path(File.join(gem_path, "..", "..", "sig", "**", "*.rbs")))
75
+ sig_files = Dir.glob(File.absolute_path(File.join(gem_path, "..", "sig", "**", "*.rbs")))
72
76
  if sig_files.length.positive?
73
77
  sig_files.each do |fp|
74
78
  @type_checker.load_sig_path fp
@@ -86,7 +90,7 @@ module Gloss
86
90
  @type_checker.load_sig_path(pathn.to_s)
87
91
  @processed_files.add pathn.to_s
88
92
  else
89
- rbs_stdlib_dir = File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "..", "stdlib", path))
93
+ rbs_stdlib_dir = File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "stdlib", path))
90
94
  if Pathname.new(rbs_stdlib_dir).exist?
91
95
  load_rbs_from_require_path(path)
92
96
  rbs_type_deps = STDLIB_TYPE_DEPENDENCIES.fetch(path) { nil }
@@ -102,10 +106,11 @@ module Gloss
102
106
  end
103
107
  end
104
108
 
105
- private def handle_require_relative(path)
106
- base = File.join(@filepath, "..", path)
109
+ private def handle_require_relative(path, source_file)
110
+ base = File.join(source_file, "..", path)
107
111
  pn : String? = nil
108
- Gem.suffixes.each do |ext|
112
+ exts = %w[.gl].concat(Gem.suffixes)
113
+ exts.each do |ext|
109
114
  full = File.absolute_path(base + ext)
110
115
  pn = full if File.exist?(full)
111
116
  end
@@ -113,14 +118,14 @@ module Gloss
113
118
  if pn
114
119
  @files_to_process << pn unless @files_to_process.include? pn
115
120
  elsif Config.strict_require
116
- throw :error, "Cannot resolve require path for #{pn}"
121
+ throw :error, "Cannot resolve relative path for #{path}"
117
122
  else
118
123
  Gloss.logger.debug "No path found for #{path}"
119
124
  end
120
125
  end
121
126
 
122
127
  private def rbs_stdlib_path_for(libr)
123
- File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "..", "stdlib", libr))
128
+ File.absolute_path(File.join(@type_checker.rbs_gem_dir, "..", "stdlib", libr))
124
129
  end
125
130
 
126
131
  private def load_rbs_from_require_path(path)
@@ -2,16 +2,27 @@ require "set"
2
2
 
3
3
  module Gloss
4
4
  class TypeChecker
5
- Project = Struct.new :targets
6
-
7
5
  attr_reader :steep_target, :top_level_decls, :env, :rbs_gem_dir
8
6
 
7
+ enum Strictness
8
+ Strict = "strict"
9
+ Lenient = "lenient"
10
+ Default = "default"
11
+ end
12
+
9
13
  def initialize
14
+ options = Steep::Project::Options.new
15
+ case Config.type_checking_strictness
16
+ when Strictness::Strict
17
+ options.apply_strict_typing_options!
18
+ when Strictness::Lenient
19
+ options.apply_lenient_typing_options!
20
+ else
21
+ options.apply_default_typing_options!
22
+ end
10
23
  @steep_target = Steep::Project::Target.new(
11
24
  name: "gloss",
12
- options: Steep::Project::Options.new.tap do |o|
13
- o.allow_unknown_constant_assignment = true
14
- end,
25
+ options: options,
15
26
  source_patterns: ["**/*.rb"],
16
27
  ignore_patterns: Array.new,
17
28
  signature_patterns: ["sig"]
@@ -54,7 +65,7 @@ module Gloss
54
65
  when Steep::Diagnostic::Ruby::UnexpectedBlockGiven
55
66
  "Unexpected block given"
56
67
  else
57
- "#{e.header_line}\n#{e.inspect}"
68
+ "#{e.header_line}\n#{e}"
58
69
  end
59
70
  }.join("\n")
60
71
  throw :error, errors
@@ -19,11 +19,8 @@ module Gloss
19
19
  end
20
20
 
21
21
  def gem_path_for(gem_name)
22
- Gem.ui.instance_variable_set :"@outs", StringIO.new
23
- Gem::GemRunner.new.run(["which", gem_name])
24
- Gem.ui.outs.string
25
- rescue SystemExit => e
26
- nil
22
+ spec = Gem::Specification.find_by_path(gem_name)
23
+ spec.full_require_paths.first if spec
27
24
  end
28
25
 
29
26
  def with_file_header(str)
@@ -1,3 +1,3 @@
1
1
  module Gloss
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -102,7 +102,7 @@ module Gloss
102
102
  members: Array.new, # TODO
103
103
  annotations: Array.new, # TODO
104
104
  location: build_location(node),
105
- comment: node[:comment]
105
+ comment: node[:comment],
106
106
  )
107
107
  old_parent_scope = @current_scope
108
108
  @current_scope = module_type
@@ -202,6 +202,7 @@ module Gloss
202
202
  else
203
203
  nil
204
204
  end
205
+ name = node[:name]
205
206
  block = node[:block] ? " #{visit_node(node[:block])}" : nil
206
207
  has_parens = !!(node[:has_parentheses] || args || block)
207
208
  opening_delimiter = if has_parens
@@ -209,11 +210,18 @@ module Gloss
209
210
  else
210
211
  nil
211
212
  end
212
- name = node[:name]
213
213
  call = "#{obj}#{name}#{opening_delimiter}#{args}#{")" if has_parens}#{block}"
214
214
  case name
215
215
  when "require_relative"
216
- @on_new_file_referenced.call(name, true) if @on_new_file_referenced
216
+ if @on_new_file_referenced
217
+ paths = arg_arr.map do |a|
218
+ unless a[:type] == "LiteralNode"
219
+ throw :error, "Dynamic file paths are not allowed in require_relative"
220
+ end
221
+ eval(visit_node(a, scope).strip)
222
+ end
223
+ @on_new_file_referenced.call(paths, true)
224
+ end
217
225
  when "module_function"
218
226
  @after_module_function = true
219
227
  end
@@ -264,7 +272,7 @@ module Gloss
264
272
  path = node[:value]
265
273
  src.write_ln %(require "#{path}")
266
274
 
267
- @on_new_file_referenced.call(path, false) if @on_new_file_referenced
275
+ @on_new_file_referenced.call([path], false) if @on_new_file_referenced
268
276
  when "Assign", "OpAssign"
269
277
 
270
278
  src.write_ln "#{visit_node(node[:target])} #{node[:op]}= #{visit_node(node[:value]).strip}"
@@ -2,6 +2,8 @@ require "listen"
2
2
 
3
3
  module Gloss
4
4
  class Watcher
5
+ @listener: Listen?
6
+
5
7
  def initialize(@paths : Array[String])
6
8
  if @paths.empty?
7
9
  @paths = [File.join(Dir.pwd, Config.src_dir)]
@@ -22,7 +24,7 @@ module Gloss
22
24
 
23
25
  def watch
24
26
  Gloss.logger.info "Now listening for changes in #{@paths.join(', ')}"
25
- listener = Listen.to(
27
+ @listener ||= Listen.to(
26
28
  *@paths,
27
29
  latency: 2,
28
30
  only: @only
@@ -55,12 +57,16 @@ module Gloss
55
57
  end
56
58
  end
57
59
  begin
58
- listener.start
60
+ @listener.start
59
61
  sleep
60
62
  rescue Interrupt
61
- Gloss.logger.info "Interrupt signal received, shutting down"
62
- exit 0
63
+ kill
63
64
  end
64
65
  end
66
+
67
+ def kill
68
+ Gloss.logger.info "Interrupt signal received, shutting down"
69
+ @listener.stop if @listener
70
+ end
65
71
  end
66
72
  end
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.3
4
+ version: 0.1.4
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-06 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_blank
@@ -42,32 +42,32 @@ dependencies:
42
42
  name: rbs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
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
- version: '0'
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
- version: '0'
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
- version: '0'
68
+ version: 0.41.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake-compiler
70
+ name: pry-byebug
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: rake-compiler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: pry-byebug
98
+ name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -132,9 +132,7 @@ extensions:
132
132
  extra_rdoc_files: []
133
133
  files:
134
134
  - ".gitattributes"
135
- - ".github/workflows/crystal_specs.yml"
136
- - ".github/workflows/ruby_specs.yml"
137
- - ".github/workflows/self_build.yml"
135
+ - ".github/workflows/tests.yml"
138
136
  - ".gitignore"
139
137
  - ".gloss.yml"
140
138
  - ".rspec"
@@ -175,6 +173,7 @@ files:
175
173
  - lib/gloss/visitor.rb
176
174
  - lib/gloss/watcher.rb
177
175
  - lib/gloss/writer.rb
176
+ - logo.svg
178
177
  - sig/core.rbs
179
178
  - sig/fast_blank.rbs
180
179
  - sig/gls.rbs
@@ -1,26 +0,0 @@
1
- name: Crystal Specs
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- defaults:
10
- run:
11
- working-directory: ext/gloss
12
-
13
- jobs:
14
- build:
15
-
16
- runs-on: ubuntu-latest
17
-
18
- container:
19
- image: crystallang/crystal
20
-
21
- steps:
22
- - uses: actions/checkout@v2
23
- - name: Install dependencies
24
- run: shards install
25
- - name: Run tests
26
- run: crystal spec
@@ -1,33 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby Specs
9
-
10
- on:
11
- push:
12
- branches: [ master ]
13
- pull_request:
14
- branches: [ master ]
15
-
16
- jobs:
17
- test:
18
-
19
- runs-on: ubuntu-20.04
20
-
21
- steps:
22
- - uses: actions/checkout@v2
23
- - name: Set up Ruby
24
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
- # uses: ruby/setup-ruby@v1
27
- uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
28
- with:
29
- ruby-version: 2.7
30
- - name: Install dependencies
31
- run: bundle install
32
- - name: Run tests
33
- run: bundle exec rake build && bundle exec rake spec
@@ -1,45 +0,0 @@
1
- name: Self Build
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
- env:
9
- ImageOS: ubuntu18
10
- jobs:
11
- build:
12
-
13
- runs-on: ubuntu-latest
14
-
15
- container:
16
- image: crystallang/crystal
17
-
18
- steps:
19
- - uses: actions/checkout@v2
20
- - name: Set up Ruby
21
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
22
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
23
- # uses: ruby/setup-ruby@v1
24
- uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
25
- with:
26
- ruby-version: 2.7
27
- - name: Install ruby-dev
28
- run: apt-get update -y && apt-get install -y ruby-dev
29
- - uses: actions/cache@v2
30
- id: gems-cache
31
- with:
32
- path: vendor/bundle
33
- key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
34
- restore-keys: |
35
- ${{ runner.os }}-gems-
36
- - name: install Bundler
37
- run: gem install bundler:2.2.3
38
- - name: install gems
39
- run: bundle install --jobs 4 --retry 3
40
- - name: build native extensions
41
- run: cd ext/gloss && make && cd -
42
- - name: Build self with current state
43
- run: ls lib/ && exe/gloss build
44
- - name: check installation from rubygems
45
- run: gem install gloss