tapioca 0.4.0 → 0.4.1
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 +25 -1
 - data/README.md +12 -0
 - data/Rakefile +15 -4
 - data/lib/tapioca.rb +2 -0
 - data/lib/tapioca/cli.rb +24 -2
 - data/lib/tapioca/compilers/dsl/action_controller_helpers.rb +129 -0
 - data/lib/tapioca/compilers/dsl/action_mailer.rb +65 -0
 - data/lib/tapioca/compilers/dsl/active_record_associations.rb +285 -0
 - data/lib/tapioca/compilers/dsl/active_record_columns.rb +379 -0
 - data/lib/tapioca/compilers/dsl/active_record_enum.rb +112 -0
 - data/lib/tapioca/compilers/dsl/active_record_identity_cache.rb +213 -0
 - data/lib/tapioca/compilers/dsl/active_record_scope.rb +100 -0
 - data/lib/tapioca/compilers/dsl/active_record_typed_store.rb +170 -0
 - data/lib/tapioca/compilers/dsl/active_resource.rb +140 -0
 - data/lib/tapioca/compilers/dsl/active_support_current_attributes.rb +126 -0
 - data/lib/tapioca/compilers/dsl/base.rb +163 -0
 - data/lib/tapioca/compilers/dsl/frozen_record.rb +96 -0
 - data/lib/tapioca/compilers/dsl/protobuf.rb +144 -0
 - data/lib/tapioca/compilers/dsl/smart_properties.rb +173 -0
 - data/lib/tapioca/compilers/dsl/state_machines.rb +378 -0
 - data/lib/tapioca/compilers/dsl/url_helpers.rb +83 -0
 - data/lib/tapioca/compilers/dsl_compiler.rb +121 -0
 - data/lib/tapioca/compilers/requires_compiler.rb +67 -0
 - data/lib/tapioca/compilers/symbol_table/symbol_generator.rb +141 -24
 - data/lib/tapioca/config.rb +11 -6
 - data/lib/tapioca/config_builder.rb +19 -9
 - data/lib/tapioca/constant_locator.rb +1 -0
 - data/lib/tapioca/core_ext/class.rb +23 -0
 - data/lib/tapioca/generator.rb +187 -21
 - data/lib/tapioca/loader.rb +20 -9
 - data/lib/tapioca/sorbet_config_parser.rb +77 -0
 - data/lib/tapioca/version.rb +1 -1
 - metadata +29 -51
 
| 
         @@ -0,0 +1,77 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # typed: strict
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Tapioca
         
     | 
| 
      
 5 
     | 
    
         
            +
              class SorbetConfig
         
     | 
| 
      
 6 
     | 
    
         
            +
                extend T::Sig
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                sig { returns(T::Array[String]) }
         
     | 
| 
      
 9 
     | 
    
         
            +
                attr_reader :paths, :ignore
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                sig { void }
         
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @paths = T.let([], T::Array[String])
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @ignore = T.let([], T::Array[String])
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 18 
     | 
    
         
            +
                  extend T::Sig
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  sig { params(sorbet_config_path: String).returns(SorbetConfig) }
         
     | 
| 
      
 21 
     | 
    
         
            +
                  def parse_file(sorbet_config_path)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    parse_string(File.read(sorbet_config_path))
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  sig { params(sorbet_config: String).returns(SorbetConfig) }
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def parse_string(sorbet_config)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    config = SorbetConfig.new
         
     | 
| 
      
 28 
     | 
    
         
            +
                    ignore = T.let(false, T::Boolean)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    skip = T.let(false, T::Boolean)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    sorbet_config.each_line do |line|
         
     | 
| 
      
 31 
     | 
    
         
            +
                      line = line.strip
         
     | 
| 
      
 32 
     | 
    
         
            +
                      case line
         
     | 
| 
      
 33 
     | 
    
         
            +
                      when /^--ignore$/
         
     | 
| 
      
 34 
     | 
    
         
            +
                        ignore = true
         
     | 
| 
      
 35 
     | 
    
         
            +
                        next
         
     | 
| 
      
 36 
     | 
    
         
            +
                      when /^--ignore=/
         
     | 
| 
      
 37 
     | 
    
         
            +
                        config.ignore << parse_option(line)
         
     | 
| 
      
 38 
     | 
    
         
            +
                        next
         
     | 
| 
      
 39 
     | 
    
         
            +
                      when /^--file$/
         
     | 
| 
      
 40 
     | 
    
         
            +
                        next
         
     | 
| 
      
 41 
     | 
    
         
            +
                      when /^--file=/
         
     | 
| 
      
 42 
     | 
    
         
            +
                        config.paths << parse_option(line)
         
     | 
| 
      
 43 
     | 
    
         
            +
                        next
         
     | 
| 
      
 44 
     | 
    
         
            +
                      when /^--dir$/
         
     | 
| 
      
 45 
     | 
    
         
            +
                        next
         
     | 
| 
      
 46 
     | 
    
         
            +
                      when /^--dir=/
         
     | 
| 
      
 47 
     | 
    
         
            +
                        config.paths << parse_option(line)
         
     | 
| 
      
 48 
     | 
    
         
            +
                        next
         
     | 
| 
      
 49 
     | 
    
         
            +
                      when /^--.*=/
         
     | 
| 
      
 50 
     | 
    
         
            +
                        next
         
     | 
| 
      
 51 
     | 
    
         
            +
                      when /^--/
         
     | 
| 
      
 52 
     | 
    
         
            +
                        skip = true
         
     | 
| 
      
 53 
     | 
    
         
            +
                      when /^-.*=?/
         
     | 
| 
      
 54 
     | 
    
         
            +
                        next
         
     | 
| 
      
 55 
     | 
    
         
            +
                      else
         
     | 
| 
      
 56 
     | 
    
         
            +
                        if ignore
         
     | 
| 
      
 57 
     | 
    
         
            +
                          config.ignore << line
         
     | 
| 
      
 58 
     | 
    
         
            +
                          ignore = false
         
     | 
| 
      
 59 
     | 
    
         
            +
                        elsif skip
         
     | 
| 
      
 60 
     | 
    
         
            +
                          skip = false
         
     | 
| 
      
 61 
     | 
    
         
            +
                        else
         
     | 
| 
      
 62 
     | 
    
         
            +
                          config.paths << line
         
     | 
| 
      
 63 
     | 
    
         
            +
                        end
         
     | 
| 
      
 64 
     | 
    
         
            +
                      end
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
      
 66 
     | 
    
         
            +
                    config
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                  private
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  sig { params(line: String).returns(String) }
         
     | 
| 
      
 72 
     | 
    
         
            +
                  def parse_option(line)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    T.must(line.split("=").last).strip
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
              end
         
     | 
| 
      
 77 
     | 
    
         
            +
            end
         
     | 
    
        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.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.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: 2020- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2020-07-27 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: pry
         
     | 
| 
         @@ -56,75 +56,33 @@ dependencies: 
     | 
|
| 
       56 
56 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       57 
57 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
     | 
    
         
            -
              name:  
     | 
| 
      
 59 
     | 
    
         
            +
              name: parlour
         
     | 
| 
       60 
60 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                requirements:
         
     | 
| 
       62 
62 
     | 
    
         
             
                - - ">="
         
     | 
| 
       63 
63 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       64 
     | 
    
         
            -
                    version:  
     | 
| 
      
 64 
     | 
    
         
            +
                    version: 2.1.0
         
     | 
| 
       65 
65 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       66 
66 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       67 
67 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       68 
68 
     | 
    
         
             
                requirements:
         
     | 
| 
       69 
69 
     | 
    
         
             
                - - ">="
         
     | 
| 
       70 
70 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       71 
     | 
    
         
            -
                    version:  
     | 
| 
       72 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       73 
     | 
    
         
            -
              name: bundler
         
     | 
| 
       74 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       75 
     | 
    
         
            -
                requirements:
         
     | 
| 
       76 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       77 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       78 
     | 
    
         
            -
                    version: '1.17'
         
     | 
| 
       79 
     | 
    
         
            -
              type: :development
         
     | 
| 
       80 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       81 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       82 
     | 
    
         
            -
                requirements:
         
     | 
| 
       83 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       84 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       85 
     | 
    
         
            -
                    version: '1.17'
         
     | 
| 
      
 71 
     | 
    
         
            +
                    version: 2.1.0
         
     | 
| 
       86 
72 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       87 
     | 
    
         
            -
              name:  
     | 
| 
       88 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
     | 
    
         
            -
                requirements:
         
     | 
| 
       90 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       91 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       92 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       93 
     | 
    
         
            -
              type: :development
         
     | 
| 
       94 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       95 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       96 
     | 
    
         
            -
                requirements:
         
     | 
| 
       97 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       98 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       99 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       100 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       101 
     | 
    
         
            -
              name: rspec
         
     | 
| 
       102 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       103 
     | 
    
         
            -
                requirements:
         
     | 
| 
       104 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       105 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       106 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       107 
     | 
    
         
            -
              type: :development
         
     | 
| 
       108 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       109 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       110 
     | 
    
         
            -
                requirements:
         
     | 
| 
       111 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       112 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       113 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       114 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       115 
     | 
    
         
            -
              name: sorbet
         
     | 
| 
      
 73 
     | 
    
         
            +
              name: thor
         
     | 
| 
       116 
74 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       117 
75 
     | 
    
         
             
                requirements:
         
     | 
| 
       118 
76 
     | 
    
         
             
                - - ">="
         
     | 
| 
       119 
77 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       120 
     | 
    
         
            -
                    version:  
     | 
| 
       121 
     | 
    
         
            -
              type: : 
     | 
| 
      
 78 
     | 
    
         
            +
                    version: 0.19.2
         
     | 
| 
      
 79 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       122 
80 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       123 
81 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       124 
82 
     | 
    
         
             
                requirements:
         
     | 
| 
       125 
83 
     | 
    
         
             
                - - ">="
         
     | 
| 
       126 
84 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       127 
     | 
    
         
            -
                    version:  
     | 
| 
      
 85 
     | 
    
         
            +
                    version: 0.19.2
         
     | 
| 
       128 
86 
     | 
    
         
             
            description: 
         
     | 
| 
       129 
87 
     | 
    
         
             
            email:
         
     | 
| 
       130 
88 
     | 
    
         
             
            - ruby@shopify.com
         
     | 
| 
         @@ -139,6 +97,24 @@ files: 
     | 
|
| 
       139 
97 
     | 
    
         
             
            - exe/tapioca
         
     | 
| 
       140 
98 
     | 
    
         
             
            - lib/tapioca.rb
         
     | 
| 
       141 
99 
     | 
    
         
             
            - lib/tapioca/cli.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/action_controller_helpers.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/action_mailer.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_associations.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_columns.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_enum.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_identity_cache.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_scope.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_record_typed_store.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_resource.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/active_support_current_attributes.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/base.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/frozen_record.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/protobuf.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/smart_properties.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/state_machines.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl/url_helpers.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/tapioca/compilers/dsl_compiler.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/tapioca/compilers/requires_compiler.rb
         
     | 
| 
       142 
118 
     | 
    
         
             
            - lib/tapioca/compilers/sorbet.rb
         
     | 
| 
       143 
119 
     | 
    
         
             
            - lib/tapioca/compilers/symbol_table/symbol_generator.rb
         
     | 
| 
       144 
120 
     | 
    
         
             
            - lib/tapioca/compilers/symbol_table/symbol_loader.rb
         
     | 
| 
         @@ -147,9 +123,11 @@ files: 
     | 
|
| 
       147 
123 
     | 
    
         
             
            - lib/tapioca/config.rb
         
     | 
| 
       148 
124 
     | 
    
         
             
            - lib/tapioca/config_builder.rb
         
     | 
| 
       149 
125 
     | 
    
         
             
            - lib/tapioca/constant_locator.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/tapioca/core_ext/class.rb
         
     | 
| 
       150 
127 
     | 
    
         
             
            - lib/tapioca/gemfile.rb
         
     | 
| 
       151 
128 
     | 
    
         
             
            - lib/tapioca/generator.rb
         
     | 
| 
       152 
129 
     | 
    
         
             
            - lib/tapioca/loader.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/tapioca/sorbet_config_parser.rb
         
     | 
| 
       153 
131 
     | 
    
         
             
            - lib/tapioca/version.rb
         
     | 
| 
       154 
132 
     | 
    
         
             
            homepage: https://github.com/Shopify/tapioca
         
     | 
| 
       155 
133 
     | 
    
         
             
            licenses:
         
     |