chusaku 0.4.1 → 0.5.0

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: ed6577989b6ceef5334bd9217f5128b9178792f9b633c7ec7f284263f64cd415
4
- data.tar.gz: a50d72e4e772fc7848606ef5d6772ce434c881d71fe6dc3a4cff928cceb188db
3
+ metadata.gz: 006eca0c4d1c3b87363edd35f9070dd48bc0693e1b56b01fd3900696fa50387d
4
+ data.tar.gz: d5d3816c84eaba7c36d4e06e30eb7b8783b1dbb69f3c42190a278bf82fd01619
5
5
  SHA512:
6
- metadata.gz: da939ea2a2d76601994dee78c46ece98f2b03d2f7740f93b0d990972693a97a2125910c8a3b9bd035410088fd29ad13f65010afb7b37c1bafc48329601812294
7
- data.tar.gz: c73cbde3d26058fb72795513d081159e5d5e43beecd8903ebf2c19b40b71b06b76ac3c381ab26485ae08d7ac9fca30f4246c51ee9d3b0cc445baa54d08511403
6
+ metadata.gz: b103a27205545c18aba9e7570e0f0c63aafa558b0cb6b870520e8a25d60cbb73cdfceccc7937c09c3de5090cc304b08c1151a29ba16602802b0fdf685f8fe360
7
+ data.tar.gz: ff6eb6258eea5a27f0422d633975251827c114af744f229ab3f4eca101a6ce840b39c4bf47300f16813944b055502f78d1a88d89725d827edf90649003b43b22
data/lib/chusaku.rb CHANGED
@@ -154,12 +154,34 @@ module Chusaku
154
154
  #
155
155
  # @return [Integer] 0 for success, 1 for error
156
156
  def output_results
157
- if @annotated_paths.any?
158
- puts("Annotated #{@annotated_paths.join(', ')}")
159
- @flags.include?(:error_on_annotation) ? 1 : 0
157
+ puts(output_copy)
158
+ exit_code = 0
159
+ exit_code = 1 if @annotated_paths.any? && @flags.include?(:error_on_annotation)
160
+ exit_code
161
+ end
162
+
163
+ # Determines the copy to be used in the program output.
164
+ #
165
+ # @return [String] Copy to be outputted to user
166
+ def output_copy
167
+ return 'Nothing to annotate.' if @annotated_paths.empty?
168
+
169
+ annotated_paths = @annotated_paths.join(', ')
170
+ dry_run = @flags.include?(:dry)
171
+ error_on_annotation = @flags.include?(:error_on_annotation)
172
+
173
+ if dry_run && error_on_annotation
174
+ <<~COPY
175
+ Annotations missing in the following files: #{annotated_paths}
176
+
177
+ Run `chusaku` to annotate them. Exiting with status code 1.
178
+ COPY
179
+ elsif dry_run
180
+ "The following files would be annotated without `--dry-run`: #{annotated_paths}"
181
+ elsif error_on_annotation
182
+ "Annotated #{annotated_paths}.\n\nExiting with status code 1."
160
183
  else
161
- puts('Nothing to annotate')
162
- 0
184
+ "Annotated #{annotated_paths}."
163
185
  end
164
186
  end
165
187
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chusaku
4
- VERSION = '0.4.1'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chusaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nishiki Liu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.2.3
145
+ rubygems_version: 3.2.15
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Annotate your Rails controllers with route info.