tapioca 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: babdc8b0494d05cbc73176f61d385b0517f418975b16bb11f63fb05f72ac163b
|
4
|
+
data.tar.gz: f0a45346b9e40a180fc3e2fc097a6a9f6a926404338d19c7af5473b7d13ef6fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02b8eff72f55bcaace66b791450b9c22899fa25c79db169690a7a1e886de97375c9acd6129136e7e838ea90ba2afe2a029e488fb6e43a531e100768ee88317ce
|
7
|
+
data.tar.gz: d06040c411b74d96fc3256753c06531a6c6662facde2212de4856633baeacd9aa6830509dbf9cee055f3ee736b93e55849c12485dec622d6a3a751127cc8d56f
|
data/README.md
CHANGED
@@ -21,6 +21,7 @@ $ bundle exec tapioca
|
|
21
21
|
Commands:
|
22
22
|
tapioca generate [gem...] # generate RBIs from gems
|
23
23
|
tapioca help [COMMAND] # Describe available commands or one specific command
|
24
|
+
tapioca init # initializes folder structure
|
24
25
|
tapioca sync # sync RBIs to Gemfile
|
25
26
|
|
26
27
|
Options:
|
@@ -34,6 +35,12 @@ Options:
|
|
34
35
|
|
35
36
|
## Usage
|
36
37
|
|
38
|
+
### Initialize folder structure
|
39
|
+
|
40
|
+
Command: `tapioca init`
|
41
|
+
|
42
|
+
This will create the `sorbet/config` and `sorbet/tapioca/require.rb` files for you, if they don't exist. If any of the files already exist, they will not be changed.
|
43
|
+
|
37
44
|
### Generate for gems
|
38
45
|
|
39
46
|
Command: `tapioca generate [gems...]`
|
@@ -56,8 +63,8 @@ This will sync the RBIs with the gems in the Gemfile and will add, update, and r
|
|
56
63
|
|
57
64
|
## Contributing
|
58
65
|
|
59
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/tapioca. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](
|
66
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/tapioca. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://github.com/Shopify/tapioca/blob/master/CODE_OF_CONDUCT.md) code of conduct.
|
60
67
|
|
61
68
|
## License
|
62
69
|
|
63
|
-
The gem is available as open source under the terms of the [MIT License](https://
|
70
|
+
The gem is available as open source under the terms of the [MIT License](https://github.com/Shopify/tapioca/blob/master/LICENSE.txt).
|
data/lib/tapioca/cli.rb
CHANGED
@@ -5,12 +5,15 @@ require 'thor'
|
|
5
5
|
|
6
6
|
module Tapioca
|
7
7
|
class Cli < Thor
|
8
|
+
include(Thor::Actions)
|
9
|
+
|
8
10
|
class_option :prerequire,
|
9
11
|
aliases: ["--pre", "-b"],
|
10
12
|
banner: "file",
|
11
13
|
desc: "A file to be required before Bundler.require is called"
|
12
14
|
class_option :postrequire,
|
13
15
|
aliases: ["--post", "-a"],
|
16
|
+
default: Generator::DEFAULT_POSTREQUIRE,
|
14
17
|
banner: "file",
|
15
18
|
desc: "A file to be required after Bundler.require is called"
|
16
19
|
class_option :outdir,
|
@@ -29,6 +32,24 @@ module Tapioca
|
|
29
32
|
banner: "gem:level",
|
30
33
|
desc: "Overrides for typed sigils for generated gem RBIs"
|
31
34
|
|
35
|
+
desc "init", "initializes folder structure"
|
36
|
+
def init
|
37
|
+
create_file(Generator::SORBET_CONFIG, skip: true) do
|
38
|
+
<<~CONTENT
|
39
|
+
--dir
|
40
|
+
.
|
41
|
+
CONTENT
|
42
|
+
end
|
43
|
+
create_file(Generator::DEFAULT_POSTREQUIRE, skip: true) do
|
44
|
+
<<~CONTENT
|
45
|
+
# frozen_string_literal: true
|
46
|
+
# typed: false
|
47
|
+
|
48
|
+
# Add your extra requires here
|
49
|
+
CONTENT
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
32
53
|
desc "generate [gem...]", "generate RBIs from gems"
|
33
54
|
def generate(*gems)
|
34
55
|
Tapioca.silence_warnings do
|
@@ -454,8 +454,8 @@ module Tapioca
|
|
454
454
|
|
455
455
|
sig { params(constant: Module, strict: T::Boolean).returns(T::Boolean) }
|
456
456
|
def defined_in_gem?(constant, strict: true)
|
457
|
-
files = get_file_candidates(constant)
|
458
|
-
|
457
|
+
files = Set.new(get_file_candidates(constant))
|
458
|
+
.merge(Tapioca::ConstantLocator.files_for(constant))
|
459
459
|
|
460
460
|
return !strict if files.empty?
|
461
461
|
|
@@ -79,7 +79,10 @@ module Tapioca
|
|
79
79
|
|
80
80
|
next if kind.nil? || name.nil?
|
81
81
|
|
82
|
-
|
82
|
+
# TODO: CLASS is removed since v0.4.4730 of Sorbet
|
83
|
+
# but keeping here for backward compatibility. Remove
|
84
|
+
# once the minimum version is moved past that.
|
85
|
+
next unless %w[CLASS CLASS_OR_MODULE STATIC_FIELD].include?(kind)
|
83
86
|
next if name =~ /[<>()$]/
|
84
87
|
next if name =~ /^[0-9]+$/
|
85
88
|
next if name == "T::Helpers"
|
data/lib/tapioca/generator.rb
CHANGED
@@ -8,6 +8,8 @@ module Tapioca
|
|
8
8
|
class Generator < ::Thor::Shell::Color
|
9
9
|
extend(T::Sig)
|
10
10
|
|
11
|
+
SORBET_CONFIG = "sorbet/config"
|
12
|
+
DEFAULT_POSTREQUIRE = "sorbet/tapioca/require.rb"
|
11
13
|
DEFAULT_OUTDIR = "sorbet/rbi/gems"
|
12
14
|
DEFAULT_OVERRIDES = T.let({
|
13
15
|
# ActiveSupport overrides some core methods with different signatures
|
@@ -38,7 +40,7 @@ module Tapioca
|
|
38
40
|
def initialize(outdir: nil, prerequire: nil, postrequire: nil, command: nil, typed_overrides: nil)
|
39
41
|
@outdir = T.let(Pathname.new(outdir || DEFAULT_OUTDIR), Pathname)
|
40
42
|
@prerequire = T.let(prerequire, T.nilable(String))
|
41
|
-
@postrequire = T.let(postrequire, T.nilable(String))
|
43
|
+
@postrequire = T.let(postrequire || DEFAULT_POSTREQUIRE, T.nilable(String))
|
42
44
|
@command = T.let(command || default_command, String)
|
43
45
|
@typed_overrides = T.let(typed_overrides || {}, T::Hash[String, String])
|
44
46
|
@bundle = T.let(nil, T.nilable(Gemfile))
|
data/lib/tapioca/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ufuk Kayserilioglu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-09-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: pry
|
@@ -169,7 +169,7 @@ dependencies:
|
|
169
169
|
version: '2.1'
|
170
170
|
description:
|
171
171
|
email:
|
172
|
-
-
|
172
|
+
- ruby@shopify.com
|
173
173
|
executables:
|
174
174
|
- tapioca
|
175
175
|
extensions: []
|