baseapi 0.1.16 → 0.1.17
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/README.md +8 -3
- data/lib/baseapi/cli.rb +20 -16
- data/lib/baseapi/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4e9f185316292e93a8d5049926c7320dd52fb510
         | 
| 4 | 
            +
              data.tar.gz: fdfe47036f032b62ee6f47186e58d4018a15ee1f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: eff2568e7d77ef73b0cdb1f1bb7c777a94bed409328f5b81e5a69b02b1c2202aaf5198ec3a32a4466fcd518455e2c9c83a128d7008f9e074f4e9e4d7d426a4ec
         | 
| 7 | 
            +
              data.tar.gz: fb139caa35aee2e316b0b6ddb3bd74de12a74d4aeb1afbdf84d623592ff45d4b0b53610df1195b1dcdb0c1c6790b7b6dbc01e03f0e316060e0178e88b32d0f28
         | 
    
        data/README.md
    CHANGED
    
    | @@ -21,8 +21,9 @@ Or install it yourself as: | |
| 21 21 |  | 
| 22 22 | 
             
            ## Usage
         | 
| 23 23 |  | 
| 24 | 
            -
            Introduction create a BaseApiController & JBuilder of view:
         | 
| 25 | 
            -
             | 
| 24 | 
            +
            Introduction create a BaseApiController & default JBuilder of view:
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            BaseApiController are now loaded with automatic(0.1.16~)
         | 
| 26 27 |  | 
| 27 28 | 
             
                $ bundle exec baseapi setup
         | 
| 28 29 |  | 
| @@ -434,7 +435,11 @@ And if not sent the name to api in the above example, it returns an error in the | |
| 434 435 |  | 
| 435 436 | 
             
            ### jbuilder
         | 
| 436 437 |  | 
| 437 | 
            -
             | 
| 438 | 
            +
            create JBuilder of view (0.1.17)
         | 
| 439 | 
            +
             | 
| 440 | 
            +
                $ bundle exec baseapi setup users companies ...
         | 
| 441 | 
            +
             | 
| 442 | 
            +
            Used by default
         | 
| 438 443 |  | 
| 439 444 | 
             
                /app/views/baseapi/ooo.json.jbuilder
         | 
| 440 445 |  | 
    
        data/lib/baseapi/cli.rb
    CHANGED
    
    | @@ -7,25 +7,29 @@ module Baseapi | |
| 7 7 | 
             
              class CLI < Thor
         | 
| 8 8 |  | 
| 9 9 | 
             
                desc "Base API setup", "create jbuilder view."
         | 
| 10 | 
            -
                def setup
         | 
| 11 | 
            -
                   | 
| 12 | 
            -
             | 
| 13 | 
            -
                   | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 10 | 
            +
                def setup(*controllers)
         | 
| 11 | 
            +
                  controllers.push 'base_api'
         | 
| 12 | 
            +
                  controllers.uniq!
         | 
| 13 | 
            +
                  controllers.each do |controller|
         | 
| 14 | 
            +
                    dir = [
         | 
| 15 | 
            +
                      "app/views/#{controller}"
         | 
| 16 | 
            +
                    ]
         | 
| 17 | 
            +
                    dir.each do |path|
         | 
| 18 | 
            +
                      if !Dir.exists?(path)
         | 
| 19 | 
            +
                        Dir.mkdir(path)
         | 
| 20 | 
            +
                      end
         | 
| 17 21 | 
             
                    end
         | 
| 18 | 
            -
                  end
         | 
| 19 22 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 23 | 
            +
                    files = [
         | 
| 24 | 
            +
                      'error.json.jbuilder',
         | 
| 25 | 
            +
                      'model.json.jbuilder',
         | 
| 26 | 
            +
                      'models.json.jbuilder',
         | 
| 27 | 
            +
                    ]
         | 
| 25 28 |  | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            +
                    files.each do |file|
         | 
| 30 | 
            +
                      src = File.expand_path("../app/views/base_api/#{file}", __FILE__)
         | 
| 31 | 
            +
                      FileUtils.cp(src, "app/views/#{controller}/#{file}")
         | 
| 32 | 
            +
                    end
         | 
| 29 33 | 
             
                  end
         | 
| 30 34 | 
             
                end
         | 
| 31 35 | 
             
              end
         | 
    
        data/lib/baseapi/version.rb
    CHANGED