pronto-stylelint 0.8.2 → 0.9.0
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 +3 -1
- data/lib/pronto/stylelint.rb +16 -9
- data/lib/pronto/stylelint/version.rb +1 -1
- metadata +26 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8b7000369e44f8bc34585cea9054ce56d2746d5a
         | 
| 4 | 
            +
              data.tar.gz: 0d8fe296f200987b86227aad86d8df676b46f5ac
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c17a004c2e693d6b79d0686d8654d53f493594a580ce7a72b3361e82cf834376fdf87658e18cdd6c1d63abd824b9e254885ef4ee66a96a544c20bb6d32b16cfb
         | 
| 7 | 
            +
              data.tar.gz: 21a22658f1f6075282e35ba1cc7a0619a398434997e1bdf56c9cab24617c4156648c4ce97b642aa28d2566563a31a289388405084a311239973272cc4dba7b09
         | 
    
        data/README.md
    CHANGED
    
    | @@ -29,10 +29,12 @@ Following options are available: | |
| 29 29 | 
             
            | Option               | Meaning                                                                   | Default                                   |
         | 
| 30 30 | 
             
            | -------------------- | ------------------------------------------------------------------------- | ----------------------------------------- |
         | 
| 31 31 | 
             
            | stylelint_executable | stylelint executable to call.                                             | `stylelint` (calls `stylelint` in `PATH`) |
         | 
| 32 | 
            +
            | cli_options          | Options to pass to the CLI.                                               | `-f json`                                     |
         | 
| 32 33 |  | 
| 33 | 
            -
            Example configuration to call custom stylelint executable:
         | 
| 34 | 
            +
            Example configuration to call custom stylelint executable and specify custom options:
         | 
| 34 35 |  | 
| 35 36 | 
             
            ```yaml
         | 
| 36 37 | 
             
            # .pronto_stylelint.yml
         | 
| 37 38 | 
             
            stylelint_executable: '/my/custom/node/path/.bin/stylelint'
         | 
| 39 | 
            +
            cli_options: '--config /custom/stylelintrc'
         | 
| 38 40 | 
             
            ```
         | 
    
        data/lib/pronto/stylelint.rb
    CHANGED
    
    | @@ -4,20 +4,29 @@ require 'shellwords' | |
| 4 4 | 
             
            module Pronto
         | 
| 5 5 | 
             
              class Stylelint < Runner
         | 
| 6 6 | 
             
                CONFIG_FILE = '.pronto_stylelint.yml'.freeze
         | 
| 7 | 
            -
                CONFIG_KEYS = %w(stylelint_executable).freeze
         | 
| 7 | 
            +
                CONFIG_KEYS = %w(stylelint_executable cli_options).freeze
         | 
| 8 8 |  | 
| 9 | 
            -
                attr_writer :stylelint_executable
         | 
| 9 | 
            +
                attr_writer :stylelint_executable, :cli_options
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def initialize(patches, commit = nil)
         | 
| 12 | 
            +
                  super(patches, commit)
         | 
| 13 | 
            +
                  read_config
         | 
| 14 | 
            +
                end
         | 
| 10 15 |  | 
| 11 16 | 
             
                def stylelint_executable
         | 
| 12 17 | 
             
                  @stylelint_executable || 'stylelint'.freeze
         | 
| 13 18 | 
             
                end
         | 
| 14 19 |  | 
| 20 | 
            +
                def cli_options
         | 
| 21 | 
            +
                  "#{@cli_options} -f json".strip
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 15 24 | 
             
                def files_to_lint
         | 
| 16 25 | 
             
                  /\.(c|sc|sa|le)ss$/.freeze
         | 
| 17 26 | 
             
                end
         | 
| 18 27 |  | 
| 19 28 | 
             
                def read_config
         | 
| 20 | 
            -
                  config_file = File.join( | 
| 29 | 
            +
                  config_file = File.join(git_repo_path, CONFIG_FILE)
         | 
| 21 30 | 
             
                  return unless File.exist?(config_file)
         | 
| 22 31 | 
             
                  config = YAML.load_file(config_file)
         | 
| 23 32 |  | 
| @@ -30,8 +39,6 @@ module Pronto | |
| 30 39 | 
             
                def run
         | 
| 31 40 | 
             
                  return [] if !@patches || @patches.count.zero?
         | 
| 32 41 |  | 
| 33 | 
            -
                  read_config
         | 
| 34 | 
            -
             | 
| 35 42 | 
             
                  @patches
         | 
| 36 43 | 
             
                    .select { |patch| patch.additions > 0 }
         | 
| 37 44 | 
             
                    .select { |patch| style_file?(patch.new_file_full_path) }
         | 
| @@ -41,8 +48,8 @@ module Pronto | |
| 41 48 |  | 
| 42 49 | 
             
                private
         | 
| 43 50 |  | 
| 44 | 
            -
                def  | 
| 45 | 
            -
                  @ | 
| 51 | 
            +
                def git_repo_path
         | 
| 52 | 
            +
                  @git_repo_path ||= Rugged::Repository.discover(File.expand_path(Dir.pwd)).workdir
         | 
| 46 53 | 
             
                end
         | 
| 47 54 |  | 
| 48 55 | 
             
                def inspect(patch)
         | 
| @@ -68,10 +75,10 @@ module Pronto | |
| 68 75 | 
             
                end
         | 
| 69 76 |  | 
| 70 77 | 
             
                def run_stylelint(patch)
         | 
| 71 | 
            -
                  Dir.chdir( | 
| 78 | 
            +
                  Dir.chdir(git_repo_path) do
         | 
| 72 79 | 
             
                    escaped_file_path = Shellwords.escape(patch.new_file_full_path.to_s)
         | 
| 73 80 | 
             
                    JSON.parse(
         | 
| 74 | 
            -
                      `#{stylelint_executable} #{escaped_file_path}  | 
| 81 | 
            +
                      `#{stylelint_executable} #{escaped_file_path} #{cli_options}`
         | 
| 75 82 | 
             
                    )
         | 
| 76 83 | 
             
                  end
         | 
| 77 84 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pronto-stylelint
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kevin Jalbert
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-04- | 
| 11 | 
            +
            date: 2017-04-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: pronto
         | 
| @@ -16,28 +16,48 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 0. | 
| 19 | 
            +
                    version: 0.9.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 0. | 
| 26 | 
            +
                    version: 0.9.0
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rugged
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0.24'
         | 
| 34 | 
            +
                - - ">="
         | 
| 35 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 36 | 
            +
                    version: 0.23.0
         | 
| 37 | 
            +
              type: :runtime
         | 
| 38 | 
            +
              prerelease: false
         | 
| 39 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 40 | 
            +
                requirements:
         | 
| 41 | 
            +
                - - "~>"
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 43 | 
            +
                    version: '0.24'
         | 
| 44 | 
            +
                - - ">="
         | 
| 45 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            +
                    version: 0.23.0
         | 
| 27 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 48 | 
             
              name: rake
         | 
| 29 49 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 50 | 
             
                requirements:
         | 
| 31 51 | 
             
                - - "~>"
         | 
| 32 52 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: ' | 
| 53 | 
            +
                    version: '12.0'
         | 
| 34 54 | 
             
              type: :development
         | 
| 35 55 | 
             
              prerelease: false
         | 
| 36 56 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 57 | 
             
                requirements:
         | 
| 38 58 | 
             
                - - "~>"
         | 
| 39 59 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: ' | 
| 60 | 
            +
                    version: '12.0'
         | 
| 41 61 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 62 | 
             
              name: rspec
         | 
| 43 63 | 
             
              requirement: !ruby/object:Gem::Requirement
         |