haml_i18n_lint 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ecf304ef294eaedc5987943e37c82a6fae828249
4
+ data.tar.gz: ecf66fcdc35555df72196fb148151145339b1e98
5
+ SHA512:
6
+ metadata.gz: 8ea076bc580ead0b8e3a2577b0d790351e05abdb4306deac81b45460ad34389715d02269cd7a6e900754551a90a14315c5e6c44495549823850bf6bdfde74ad7
7
+ data.tar.gz: f7ff2a318c1d17c9335fe512fb99bb1ecd4bb84bc8700384665eae61359ca84ae2d5426347fe09a0b84e2afc05736bb5d7b6bc6bf45082f6d78def218e49500e
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4.1
4
+ - 2.3.4
5
+ gemfile:
6
+ - gemfiles/haml_4.gemfile
7
+ - gemfiles/haml_5.gemfile
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "haml-4" do
2
+ gem "haml", "~> 4.0.7"
3
+ end
4
+
5
+ appraise "haml-5" do
6
+ gem "haml", "~> 5.0.0"
7
+ end
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at hanachin@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Seiei Miyagi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # HamlI18nLint
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/haml_i18n_lint.svg)](http://rubygems.org/gems/haml_i18n_lint)
4
+ [![Build Status](https://travis-ci.org/okinawarb/haml_i18n_lint.svg?branch=master)](https://travis-ci.org/okinawarb/haml_i18n_lint)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/okinawarb/haml_i18n_lint.svg)](https://codeclimate.com/github/okinawarb/haml_i18n_lint)
6
+ [![Coverage Status](https://coveralls.io/repos/github/okinawarb/haml_i18n_lint/badge.svg?branch=master)](https://coveralls.io/github/okinawarb/haml_i18n_lint?branch=master)
7
+ [![Inline docs](http://inch-ci.org/github/okinawarb/haml_i18n_lint.svg?branch=master)](http://inch-ci.org/github/okinawarb/haml_i18n_lint)
8
+
9
+ find out not translated yet plain text from your Haml template.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'haml_i18n_lint'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install haml_i18n_lint
26
+
27
+ ## Usage
28
+
29
+ $ haml-i18n-lint --version
30
+ haml-i18n-lint 0.1.0
31
+ $ haml-i18n-lint --help
32
+ Usage: haml-i18n-lint [OPTION]... [FILE]...
33
+ -c, --config=FILE configuration file
34
+ -f, --files=PATTERN pattern to find Haml template files, default: -f '**/*.haml'
35
+
36
+ The configuration file sample:
37
+
38
+ # You can override Config#need_i18n? that returns the content in Haml template need i18n or not.
39
+ def need_i18n?(content)
40
+ # the default behaviours is ignore white spaces and digits
41
+ /^[\s]+$/ !~ content && /[A-Za-z]/ =~ content
42
+ end
43
+
44
+ # You can override Config#report in configuration file
45
+ # to customize output format or send result to other location.
46
+ #
47
+ # The default output format is like following:
48
+ #
49
+ # $ haml-i18n-lint
50
+ # test/fixtures/hi.html.haml:4
51
+ # 3: %head
52
+ # 4: %title Hi
53
+ # 5: %body
54
+ #
55
+ # For example, to use short format:
56
+ def report(result)
57
+ result.matched_nodes.each do |node|
58
+ puts "#{result.filename}:#{node.line}"
59
+ end
60
+ end
61
+
62
+ # You can override Config#files for complex file pattern.
63
+ def files
64
+ Dir['**/*.haml'].reject { |path| path.start_with?('app/assets/') || path.start_with?('node_modules') }
65
+ end
66
+
67
+ ## Development
68
+
69
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
70
+
71
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
72
+
73
+ ## Contributing
74
+
75
+ Bug reports and pull requests are welcome on GitHub at https://github.com/okinawarb/haml_i18n_lint. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
76
+
77
+
78
+ ## License
79
+
80
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ require "appraisal"
4
+ require "yard"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ YARD::Rake::YardocTask.new
13
+
14
+ if ENV["APPRAISAL_INITIALIZED"] || ENV["TRAVIS"]
15
+ task default: :test
16
+ else
17
+ task default: :appraisal
18
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "haml/i18n_lint"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'haml_i18n_lint'
3
+ require 'optparse'
4
+
5
+ Version = HamlI18nLint::VERSION
6
+
7
+ options = HamlI18nLint::Options.new
8
+
9
+ opt = OptionParser.new
10
+ opt.banner = 'Usage: haml-i18n-lint [OPTION]... [FILE]...'
11
+ opt.on('-c FILE', '--config=FILE', 'configuration file') do |config_path|
12
+ options.config_path = config_path
13
+ end
14
+ opt.on('-f PATTERN', '--files=PATTERN', "pattern to find Haml template files, default: -f '**/*.haml'") do |pattern|
15
+ @pattern = pattern
16
+ options.files = [@pattern]
17
+ end
18
+
19
+ opt.parse!(ARGV)
20
+
21
+ if @pattern
22
+ options.files.concat(ARGV)
23
+ elsif !ARGV.empty?
24
+ options.files = ARGV
25
+ end
26
+
27
+ runner = HamlI18nLint::Runner.new(options)
28
+ ret = runner.run
29
+ exit(ret)
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "haml", "~> 4.0.7"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "haml", "~> 5.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'haml_i18n_lint/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "haml_i18n_lint"
8
+ spec.version = HamlI18nLint::VERSION
9
+ spec.authors = ["Seiei Miyagi"]
10
+ spec.email = ["hanachin@gmail.com"]
11
+
12
+ spec.summary = "find out not translated yet plain text from your Haml template"
13
+ spec.homepage = "https://github.com/okinawarb/haml_i18n_lint"
14
+ spec.license = "MIT"
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.required_ruby_version = '>= 2.3.0'
23
+
24
+ spec.add_dependency "haml"
25
+ spec.add_development_dependency "appraisal"
26
+ spec.add_development_dependency "yard"
27
+ spec.add_development_dependency "test-unit"
28
+ spec.add_development_dependency "bundler", "~> 1.14"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "coveralls"
31
+ end
@@ -0,0 +1,54 @@
1
+ module HamlI18nLint
2
+ # Configuration for the lint
3
+ class Config
4
+ # Returns a new lint configuration by given options
5
+ #
6
+ # @param options [Options]
7
+ def initialize(options)
8
+ @options = options
9
+ if (@options.config_path)
10
+ load_config(@options.config_content)
11
+ end
12
+ end
13
+
14
+ # @return [String] the translate method name
15
+ def i18n_method
16
+ 't'
17
+ end
18
+
19
+ # @param content [String] the text content found in haml template
20
+ # @return [true, false] the content need i18n or not.
21
+ def need_i18n?(content)
22
+ /^[\s]+$/ !~ content && /[A-Za-z]/ =~ content
23
+ end
24
+
25
+ # Output the formatted result
26
+ #
27
+ # @param result [Linter::Result] the lint result
28
+ def report(result)
29
+ print '.' and return if result.success?
30
+
31
+ puts
32
+ file = File.readlines(result.filename)
33
+ result.matched_nodes.each do |node|
34
+ puts "#{result.filename}:#{node.line}"
35
+ puts "#{node.line-1}: #{file[node.line - 2]}" if file[node.line - 2]
36
+ puts "#{node.line}: #{file[node.line - 1]}"
37
+ puts "#{node.line+1}: #{file[node.line]}" if file[node.line]
38
+ puts '-' * 16
39
+ end
40
+ puts
41
+ end
42
+
43
+ # @return [Array<String>] the list of files to be linted.
44
+ def files
45
+ Dir[*@options.files]
46
+ end
47
+
48
+ private
49
+
50
+ def load_config(config_content)
51
+ singleton_class.class_eval { eval(config_content, binding) }
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,61 @@
1
+ module HamlI18nLint
2
+ class Linter
3
+ module CompilerExtension
4
+
5
+ def compile_script
6
+ super
7
+ program = Ripper.sexp(@node.value[:text]).flatten
8
+ str_num = program.flatten.count { |t| t == :string_literal }
9
+ tstr_num = program.each_with_index.count { |t, i| [t, program[i + 1], program[i + 2]] == [:fcall, :@ident, lint_config.i18n_method.to_s] }
10
+
11
+ lint_add_matched_node(@node) unless str_num == tstr_num
12
+ end
13
+
14
+ def compile_plain
15
+ super
16
+ lint_add_matched_node(@node) if lint_config.need_i18n?(@node.value[:text])
17
+ end
18
+
19
+ def lint_attributes_hashes
20
+ @node.value[:attributes_hashes]
21
+ end
22
+
23
+ def lint_attribute_need_i18n?
24
+ attributes_hashes = lint_attributes_hashes
25
+ attributes_hashes.any? do |attributes_hash|
26
+ sexp = Ripper.sexp("{#{attributes_hash}}")
27
+ program, ((hash,(assoclist_from_args,assocs)),) = sexp
28
+
29
+ unless program == :program &&
30
+ hash == :hash &&
31
+ assoclist_from_args == :assoclist_from_args &&
32
+ assocs.respond_to?(:all?) &&
33
+ assocs.all? { |assoc| assoc.first == :assoc_new }
34
+ raise AttributesParseError
35
+ end
36
+
37
+ assocs.any? do |assoc|
38
+ assoc_new, key, value = assoc
39
+ raise AttributesParseError unless assoc_new == :assoc_new
40
+ string_literal, *strings = value
41
+ next unless string_literal == :string_literal
42
+ strings.any? do |(string_content, (tstring_content,val,pos))|
43
+ string_content == :string_content &&
44
+ tstring_content == :@tstring_content &&
45
+ lint_config.need_i18n?(val)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ def compile_tag
52
+ super
53
+ lint_add_matched_node(@node) if lint_config.need_i18n?(@node.value[:value])
54
+ lint_add_matched_node(@node) if lint_config.need_i18n?(@node.value.dig(:attributes, 'placeholder') || "")
55
+ lint_add_matched_node(@node) if lint_config.need_i18n?(@node.value.dig(:attributes, 'value') || "")
56
+ lint_add_matched_node(@node) if lint_attribute_need_i18n?
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,80 @@
1
+ require 'ripper'
2
+
3
+ module HamlI18nLint
4
+ # Linter linting a Haml template
5
+ class Linter
6
+ # Raised if failed to parse the attributes hash
7
+ class AttributesParseError < StandardError; end
8
+
9
+ # The lint result of the file
10
+ class Result < Struct.new(:filename, :matched_nodes)
11
+ # @!attribute [r] matched_nodes
12
+ # @return [Array<Haml::Parser::ParseNode>] the nodes that needs i18n.
13
+
14
+ # @!attribute [r] filename
15
+ # @return [String] name of the linted file
16
+
17
+ # @return [true, false] passed lint or not.
18
+ def success?
19
+ matched_nodes.empty?
20
+ end
21
+ end
22
+
23
+ # @param config [Config] the configuration
24
+ # @return [Lint] new linter with given configuration
25
+ def initialize(config)
26
+ @config = config
27
+ end
28
+
29
+ # Linting given template
30
+ #
31
+ # @param filename [String] the filename
32
+ # @param template [String] the Haml template
33
+ # @return [Linter::Result] the result of lint
34
+ # @raise [Linter::AttributesParseError] if failed to parse attributes hash in the template.
35
+ def lint(filename:, template:)
36
+ haml_options = ::Haml::Options.new
37
+ haml_options[:filename] = filename
38
+ node = parse(haml_options, template)
39
+ compiler(haml_options).compile(node)
40
+ end
41
+
42
+
43
+ private
44
+
45
+ def parse(haml_options, template)
46
+ ::Haml::Parser.new(template, haml_options).parse
47
+ end
48
+
49
+ def compiler_extension
50
+ self.class::CompilerExtension
51
+ end
52
+
53
+ def compiler(haml_options)
54
+ config = @config
55
+ result = Result.new(haml_options[:filename], [])
56
+
57
+ ext = compiler_extension
58
+ compiler_result_extension = Module.new do
59
+ include ext
60
+
61
+ define_method(:compile) do |node|
62
+ super(node)
63
+ result
64
+ end
65
+
66
+ private
67
+
68
+ define_method(:lint_config) do
69
+ config
70
+ end
71
+
72
+ define_method(:lint_add_matched_node) do |node|
73
+ result.matched_nodes << node
74
+ end
75
+ end
76
+
77
+ ::Haml::Compiler.new(haml_options).tap { |c| c.extend(compiler_result_extension, compiler_extension) }
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,11 @@
1
+ module HamlI18nLint
2
+ class Linter5
3
+ module CompilerExtension
4
+ include ::HamlI18nLint::Linter::CompilerExtension
5
+
6
+ def lint_attributes_hashes
7
+ [@node.value[:dynamic_attributes]&.old&.gsub(/(^\{|\}$)/, '')].compact
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'ripper'
2
+
3
+ module HamlI18nLint
4
+ class Linter5 < Linter
5
+ private
6
+
7
+ def parse(haml_options, template)
8
+ ::Haml::Parser.new(haml_options).call(template)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ module HamlI18nLint
2
+ # Raised if given config file path is not exists
3
+ class LoadConfigError < StandardError; end
4
+
5
+ class Options
6
+ # @return [String] path to config file
7
+ attr_accessor :config_path
8
+ attr_writer :files
9
+
10
+ # @raise [LoadConfigError] if given config file path is not exists
11
+ # @return [String] the content of config_path
12
+ def config_content
13
+ unless config_path && File.exist?(config_path)
14
+ raise LoadConfigError, "Config not exist: #{config_path.inspect}"
15
+ end
16
+
17
+ File.read(config_path)
18
+ end
19
+
20
+ # @return [Array<String>] file patterns to list the files to be linted.
21
+ def files
22
+ @files ||= ["**/*.haml"]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,36 @@
1
+ require "haml"
2
+
3
+ module HamlI18nLint
4
+ # Run lint and report the result.
5
+ class Runner
6
+ # @param options [Options] options
7
+ # @return [Runner] new runner to run lint with given options
8
+ def initialize(options)
9
+ @options = options
10
+ @config = ::HamlI18nLint::Config.new(@options)
11
+ @linter = HamlI18nLint.linter.new(@config)
12
+ end
13
+
14
+ # Run lint and report the result
15
+ # @return [true, false] all of the files passed lint or not.
16
+ def run
17
+ @config.files.all? do |file|
18
+ result = lint(file)
19
+
20
+ if result.success?
21
+ true
22
+ else
23
+ @config.report(result)
24
+ false
25
+ end
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def lint(filename)
32
+ template = File.read(filename)
33
+ @linter.lint(filename: filename, template: template)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module HamlI18nLint
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,21 @@
1
+ require "haml_i18n_lint/version"
2
+ require "haml_i18n_lint/config"
3
+ require "haml_i18n_lint/linter"
4
+ require "haml_i18n_lint/linter/compiler_extension"
5
+ require "haml_i18n_lint/linter5"
6
+ require "haml_i18n_lint/linter5/compiler_extension"
7
+ require "haml_i18n_lint/options"
8
+ require "haml_i18n_lint/runner"
9
+
10
+ # Lint for the lines that needs i18n
11
+ module HamlI18nLint
12
+ class << self
13
+ def linter
14
+ if Haml::VERSION.start_with?('5')
15
+ ::HamlI18nLint::Linter5
16
+ else
17
+ ::HamlI18nLint::Linter
18
+ end
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: haml_i18n_lint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Seiei Miyagi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: haml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - hanachin@gmail.com
114
+ executables:
115
+ - haml-i18n-lint
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".travis.yml"
121
+ - Appraisals
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - exe/haml-i18n-lint
130
+ - gemfiles/haml_4.gemfile
131
+ - gemfiles/haml_5.gemfile
132
+ - haml_i18n_lint.gemspec
133
+ - lib/haml_i18n_lint.rb
134
+ - lib/haml_i18n_lint/config.rb
135
+ - lib/haml_i18n_lint/linter.rb
136
+ - lib/haml_i18n_lint/linter/compiler_extension.rb
137
+ - lib/haml_i18n_lint/linter5.rb
138
+ - lib/haml_i18n_lint/linter5/compiler_extension.rb
139
+ - lib/haml_i18n_lint/options.rb
140
+ - lib/haml_i18n_lint/runner.rb
141
+ - lib/haml_i18n_lint/version.rb
142
+ homepage: https://github.com/okinawarb/haml_i18n_lint
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 2.3.0
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.6.11
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: find out not translated yet plain text from your Haml template
166
+ test_files: []