guard-standardrb 0.2.1 → 0.2.2

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: 8f82e9fc56faf953f423f18d189996b83cadb6167fe8a2c4db3e74dbbe12dc07
4
- data.tar.gz: afc7c6d9f7597dc5f7e25abeacd71d22a4cbd85850a55aea17121cd7cc41eba0
3
+ metadata.gz: c897dc6d6aa3c984e75b17e7a987aaae0990fec0bb9cfbfc4a9f4606a835c2f1
4
+ data.tar.gz: 6ef8f151a6327681ed24ffcc340a7476baa8a0c4a069e171684dc08d1e14c64f
5
5
  SHA512:
6
- metadata.gz: 54e8bc0ccc086fc1200842379cc7a260cb656d7a7797dc79d39da237be2f26c058d808402dc0e66d8a42c86718d0dd2239bd34dad826882e23a562f59beb2e10
7
- data.tar.gz: 6344b4daa4416e184e77d88d3d4f94caa97a8155536521183284b6977e41917a7d2de7872d148220748b0a644b2bc5febc758c9a0e3d74ed14ab872513de9f9b
6
+ metadata.gz: 92426f8a40c227b7996e0157b47edab405dd54832c7eb653e90526d968917ce2f240a83f7ec78c844aaddccf6b9113d97abf9742d839d76ac7d2b8db69febd5a
7
+ data.tar.gz: 5ae20664553ebce9ae1c43aad01ea284c4e234c8675cf3bd645d40020afce4f27e429870377fb5e538500bc346c1062ad60c84ad1aff694c9a100a780291735e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- guard-standardrb (0.2.1)
4
+ guard-standardrb (0.2.2)
5
5
  guard (>= 2.0.0)
6
6
  guard-compat (~> 1.0)
7
7
  standardrb
@@ -97,4 +97,4 @@ DEPENDENCIES
97
97
  rspec (~> 3.1)
98
98
 
99
99
  BUNDLED WITH
100
- 2.1.4
100
+ 2.2.14
data/README.md CHANGED
@@ -52,11 +52,21 @@ you can choose to activate or disable it.
52
52
  After the initilisation of the guard, jump into the GuardFile and you can modify the argument fix to be `true` or `false`
53
53
 
54
54
  ```
55
- guard :standardrb fix: false do
55
+ guard :standardrb, fix: false do
56
56
  ...
57
57
  end
58
58
  ```
59
59
 
60
+ ## Other options
61
+
62
+ Pass standardrb's ```--format progress``` option using ```progress: true``` and trigger inspection on startup using ```all_on_start: true```
63
+
64
+ ```
65
+ guard :standardrb, fix: false, all_on_start: true, progress: true do
66
+ ...
67
+ end
68
+ ```
69
+
60
70
  ## Development
61
71
 
62
72
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -1,15 +1,15 @@
1
- $LOAD_PATH.unshift('./lib', __FILE__)
2
- require 'guard/standardrb/version'
1
+ $LOAD_PATH.unshift("./lib", __FILE__)
2
+ require "guard/standardrb/version"
3
3
 
4
4
  Gem::Specification.new do |spec|
5
- spec.name = "guard-standardrb"
6
- spec.version = Guard::StandardrbVersion::VERSION
7
- spec.authors = ["Jody Vandenschrick"]
8
- spec.email = ["jody.vanden@gmail.com"]
5
+ spec.name = "guard-standardrb"
6
+ spec.version = Guard::StandardrbVersion::VERSION
7
+ spec.authors = ["Jody Vandenschrick"]
8
+ spec.email = ["jody.vanden@gmail.com"]
9
9
 
10
- spec.summary = %q{add a plugin to guard to work with standardrb.}
11
- spec.homepage = "https://github.com/JodyVanden/guard-standardrb"
12
- spec.license = "MIT"
10
+ spec.summary = "add a plugin to guard to work with standardrb."
11
+ spec.homepage = "https://github.com/JodyVanden/guard-standardrb"
12
+ spec.license = "MIT"
13
13
  # spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
15
15
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
@@ -18,20 +18,20 @@ Gem::Specification.new do |spec|
18
18
  spec.metadata["source_code_uri"] = "https://github.com/JodyVanden/guard-standardrb"
19
19
  spec.metadata["changelog_uri"] = "https://github.com/JodyVanden/guard-standardrb"
20
20
 
21
- spec.add_dependency 'guard', '>= 2.0.0'
22
- spec.add_dependency 'guard-compat', '~> 1.0'
23
- spec.add_dependency 'standardrb'
21
+ spec.add_dependency "guard", ">= 2.0.0"
22
+ spec.add_dependency "guard-compat", "~> 1.0"
23
+ spec.add_dependency "standardrb"
24
24
 
25
- spec.add_development_dependency 'rake'
26
- spec.add_development_dependency 'rspec', '~> 3.1'
27
- spec.add_development_dependency 'pry-byebug'
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec", "~> 3.1"
27
+ spec.add_development_dependency "pry-byebug"
28
28
 
29
29
  # Specify which files should be added to the gem when it is released.
30
30
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
32
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
  end
34
- spec.bindir = "exe"
35
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
  end
@@ -1,33 +1,50 @@
1
- require "guard"
2
1
  require "guard/plugin"
3
2
  require "guard/standardrb/version"
4
3
 
5
4
  module Guard
6
5
  class Standardrb < Plugin
7
- attr_reader :fix
8
-
9
6
  def initialize(opts = {})
10
7
  super
11
- @fix = opts[:fix]
8
+
9
+ @options = {
10
+ fix: false,
11
+ all_on_start: false,
12
+ progress: false
13
+ }.merge(opts)
12
14
  end
13
15
 
14
16
  def start
15
- Guard::Compat::UI.info "Inspecting Ruby code style of all files with standardrb"
16
- Guard::Compat::UI.info "Standardrb --fix = #{fix}"
17
+ Guard::UI.info "Inspecting Ruby code style with standardrb"
18
+ Guard::UI.info "fix = #{@options[:fix]}," +
19
+ " all_on_start = #{@options[:all_on_start]}," +
20
+ " progress = #{@options[:progress]}"
21
+ run_all if @options[:all_on_start]
17
22
  end
18
23
 
19
- def run_on_modifications(res)
20
- Guard::Compat::UI.info "StandardRb a file was modified"
21
- inspect_with_standardrb(res)
24
+ def run_all
25
+ inspect_with_standardrb
26
+ end
22
27
 
23
- $stdout.puts res if res
28
+ def run_on_additions(paths)
29
+ Guard::UI.info "StandardRb a file was added"
30
+ inspect_with_standardrb(paths)
31
+ end
32
+
33
+ def run_on_modifications(paths)
34
+ Guard::UI.info "StandardRb a file was modified"
35
+ inspect_with_standardrb(paths)
36
+
37
+ $stdout.puts paths if paths
24
38
  end
25
39
 
26
40
  def inspect_with_standardrb(paths = [])
27
41
  args = ["bundle", "exec", "standardrb"]
28
- args << "--fix" if fix
42
+ args << "--fix" if @options[:fix]
43
+ args << ["--format", "progress"] if @options[:progress]
29
44
 
45
+ args.flatten!
30
46
  args += paths
47
+
31
48
  system(*args)
32
49
  end
33
50
  end
@@ -1,12 +1,8 @@
1
- # You can choose to pass an option to the guard-standardrb plugin
2
- # to fix easy issues
3
-
4
- # guard :standardrb, fix: true do
1
+ # guard :standardrb, fix: true, all_on_start: true do
5
2
  # UI.info 'StandardRb is initialized'
6
3
  # watch(/.+\.rb$/)
7
4
  # end
8
5
 
9
- guard :standardrb, fix: false do
10
- UI.info 'StandardRb is initialized'
6
+ guard :standardrb, fix: false, all_on_start: false, progress: false do
11
7
  watch(/.+\.rb$/)
12
8
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module StandardrbVersion
3
- VERSION = "0.2.1".freeze
3
+ VERSION = "0.2.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-standardrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jody Vandenschrick
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-01 00:00:00.000000000 Z
11
+ date: 2021-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard