rbs-src 0.2.0 → 0.3.0

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: 526b7814f9ba3e24e81ed85a60391b02b3410c8b2f5b729cc084aa87a51961e7
4
- data.tar.gz: 0fbcfafe7757f8dbb0a1e89e1ee92477f201a7b551de1eef9fb54a070567fee3
3
+ metadata.gz: 02f00b3f9d5db76fd52097440453dc502f298da9a4f9bd2b3c852786064c3cb4
4
+ data.tar.gz: 6094fd8f39dc65932db88c76046d934c6b30a65620d3a27033bbf879f629d084
5
5
  SHA512:
6
- metadata.gz: 58bd4e1f76f25370df256ebfb2524a3748d52ec7837c672e37a0e006ba80cbb3b125ccc4d49cb1039dc7b631400fe4176fa2be8da975cfd689f0407c29a448c0
7
- data.tar.gz: 8667efb09213631c5b3ef5ad623906410862d69abc0f2bab28ed61aa24f1c2b83eb36cc79733dd0155a32d919a30387db1b256a5b56213b2b874bea8c070c7ac
6
+ metadata.gz: 8cb34af3adfb39bb9772da48d6730dda31922a67fec6197ec630aad849b1f6c7e8b1f90f29ddd0805d83bdbd0a2304ccc3ce69118a4a4552b90d8199f4c3f270
7
+ data.tar.gz: 925593e54d59dd10de6c2275348b8bb98aa454548405a9b372fcd6b11886b530850954674718acdbac843438a63f63d90571ff4bfa8ca8c02ed0b8b4c1f363dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs-src (0.2.0)
4
+ rbs-src (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -60,6 +60,7 @@ GEM
60
60
 
61
61
  PLATFORMS
62
62
  arm64-darwin-22
63
+ x86_64-linux
63
64
 
64
65
  DEPENDENCIES
65
66
  minitest (~> 5.0)
data/README.md CHANGED
@@ -54,7 +54,8 @@ target ... do
54
54
  # Existing config...
55
55
 
56
56
  # Add `#signature` call to support loading RBS files from symlinked directory
57
- signature "sig/rbs-src/*/**/*.rbs"
57
+ signature "sig/rbs-src/*/*.rbs"
58
+ signature "sig/rbs-src/*/[^_]*/**/*.rbs"
58
59
 
59
60
  # Stop loading libraries through rbs-collection
60
61
  disable_collection()
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rake/testtask"
6
6
  Rake::TestTask.new(:test) do |t|
7
7
  t.libs << "test"
8
8
  t.libs << "lib"
9
- t.test_files = FileList["test/**/test_*.rb"]
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
10
  end
11
11
 
12
12
  task default: :test
data/Steepfile CHANGED
@@ -2,11 +2,9 @@ D = Steep::Diagnostic
2
2
 
3
3
  target :lib do
4
4
  signature "sig"
5
- signature "sig/rbs-src/*/**/*.rbs"
6
5
 
7
6
  check "lib" # Directory name
8
7
 
9
-
10
8
  configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
11
9
  # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
12
10
  # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
@@ -14,25 +12,4 @@ target :lib do
14
12
  # configure_code_diagnostics do |hash| # You can setup everything yourself
15
13
  # hash[D::Ruby::NoMethod] = :information
16
14
  # end
17
-
18
- library('abbrev')
19
- library('date')
20
- library('dbm')
21
- library('json')
22
- library('logger')
23
- library('minitest')
24
- library('monitor')
25
- library('mutex_m')
26
- library('optparse')
27
- library('pathname')
28
- library('pstore')
29
- library('rbs:3.1.2')
30
- library('rdoc')
31
- library('securerandom')
32
- library('singleton')
33
- library('time')
34
- library('tsort')
35
- library('yaml')
36
-
37
- disable_collection
38
15
  end
data/lib/rbs/src/cli.rb CHANGED
@@ -3,7 +3,7 @@ require "optparse"
3
3
  module Rbs
4
4
  module Src
5
5
  class CLI
6
- def self.start(argv)
6
+ def self.start(argv, stdout: STDOUT)
7
7
  command = argv.shift
8
8
 
9
9
  case command
@@ -45,7 +45,7 @@ module Rbs
45
45
  rbs_prefix: rbs_prefix
46
46
  )
47
47
 
48
- runner = CommandRunner.new(stdout: STDOUT)
48
+ runner = CommandRunner.new(stdout: stdout)
49
49
 
50
50
  runner.push "Setting up #{gem.name}-#{gem.version}" do
51
51
  runner.push "Cloning git repository into #{gem.repository_root}" do
@@ -104,7 +104,7 @@ module Rbs
104
104
  rbs_prefix: rbs_prefix
105
105
  )
106
106
 
107
- runner = CommandRunner.new(stdout: STDOUT)
107
+ runner = CommandRunner.new(stdout: stdout)
108
108
 
109
109
  loader.each_gem do |gem, repo, commit|
110
110
  runner.push "Setting up #{gem.name}-#{gem.version}" do
@@ -140,9 +140,9 @@ module Rbs
140
140
  other_libs.sort_by! { _1[0] }
141
141
 
142
142
  unless other_libs.empty?
143
- runner.push "Load other libraries yourself:" do
143
+ runner.push "You have to load other libraries without rbs-collection:" do
144
144
  if has_gem?("steep")
145
- runner.puts "Put the following lines in your Steepfile:"
145
+ runner.puts "Add the following lines in your Steepfile:"
146
146
 
147
147
  other_libs.each do |name, version|
148
148
  runner.puts " library('#{name}')"
@@ -37,6 +37,23 @@ module Rbs
37
37
  raise status.inspect
38
38
  end
39
39
  end
40
+
41
+ def query!(*command, chdir: Pathname.pwd)
42
+ # @type var out: String
43
+ # @type var status: Process::Status
44
+
45
+ out, status = Open3.capture2e(*command, chdir: chdir)
46
+
47
+ unless status.success?
48
+ puts "🚨 Command failed: #{command.inspect} in #{chdir}..."
49
+ out.each_line do |line|
50
+ puts "| #{line}"
51
+ end
52
+ raise status.inspect
53
+ end
54
+
55
+ out
56
+ end
40
57
  end
41
58
  end
42
59
  end
data/lib/rbs/src/gem.rb CHANGED
@@ -25,7 +25,10 @@ module Rbs
25
25
 
26
26
  def clone(runner, repository_url:, commit:)
27
27
  runner.puts "git clone..."
28
- runner.execute!("git", "clone", "--filter=blob:none", repository_url, repository_root.to_s)
28
+ runner.execute!("git", "clone", "--filter=blob:none", "--sparse", repository_url, repository_root.to_s)
29
+ dirs = runner.query!("git", "ls-tree", "-d", "--name-only", "-z", "HEAD", chdir: repository_root).split("\0")
30
+ dirs.delete(repository_dir.to_s)
31
+ runner.execute!("git", "sparse-checkout", "set", *dirs, repository_dir.join(name, version).to_s, chdir: repository_root)
29
32
  if commit
30
33
  runner.puts "git checkout..."
31
34
  runner.execute!("git", "checkout", commit, chdir: repository_root)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rbs
4
4
  module Src
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@
2
2
  sources:
3
3
  - type: git
4
4
  name: ruby/gem_rbs_collection
5
- revision: aeede7258d020bfd509541e0c8075ce833292409
5
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
6
6
  remote: https://github.com/ruby/gem_rbs_collection.git
7
7
  repo_dir: gems
8
8
  path: ".gem_rbs_collection"
@@ -11,38 +11,10 @@ gems:
11
11
  version: '0'
12
12
  source:
13
13
  type: stdlib
14
- - name: activesupport
15
- version: '6.0'
16
- source:
17
- type: git
18
- name: ruby/gem_rbs_collection
19
- revision: aeede7258d020bfd509541e0c8075ce833292409
20
- remote: https://github.com/ruby/gem_rbs_collection.git
21
- repo_dir: gems
22
- - name: concurrent-ruby
23
- version: '1.1'
24
- source:
25
- type: git
26
- name: ruby/gem_rbs_collection
27
- revision: aeede7258d020bfd509541e0c8075ce833292409
28
- remote: https://github.com/ruby/gem_rbs_collection.git
29
- repo_dir: gems
30
- - name: date
31
- version: '0'
32
- source:
33
- type: stdlib
34
14
  - name: dbm
35
15
  version: '0'
36
16
  source:
37
17
  type: stdlib
38
- - name: i18n
39
- version: '1.10'
40
- source:
41
- type: git
42
- name: ruby/gem_rbs_collection
43
- revision: aeede7258d020bfd509541e0c8075ce833292409
44
- remote: https://github.com/ruby/gem_rbs_collection.git
45
- repo_dir: gems
46
18
  - name: json
47
19
  version: '0'
48
20
  source:
@@ -83,18 +55,6 @@ gems:
83
55
  version: '0'
84
56
  source:
85
57
  type: stdlib
86
- - name: securerandom
87
- version: '0'
88
- source:
89
- type: stdlib
90
- - name: singleton
91
- version: '0'
92
- source:
93
- type: stdlib
94
- - name: time
95
- version: '0'
96
- source:
97
- type: stdlib
98
58
  - name: tsort
99
59
  version: '0'
100
60
  source:
data/rbs_collection.yaml CHANGED
@@ -16,5 +16,3 @@ path: .gem_rbs_collection
16
16
  gems:
17
17
  - name: pathname
18
18
  - name: yaml
19
- - name: activesupport
20
- version: 6.0
@@ -12,6 +12,8 @@ module Rbs
12
12
  def puts: (String) -> void
13
13
 
14
14
  def execute!: (*String, ?chdir: Pathname) -> void
15
+
16
+ def query!: (*String, ?chdir: Pathname) -> String
15
17
  end
16
18
  end
17
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs-src
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-30 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: rbs-src
14
14
  email: