chusaku 0.1.2 → 0.1.3

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: cb896064bc711881c0b3efec1513838ec219d4a98f69643aa7a50214d092a942
4
- data.tar.gz: b3409d3ce1b736b6290d8a122c4edeaceb88d9caa51c845fae0ad6d31d5401ee
3
+ metadata.gz: f7fd38001d891049886a95d54019ce4636dee3762e19f50e83bf7b0d53732cd6
4
+ data.tar.gz: a55e1bd009ad426e9258a6d6098d029d45bfb043a6736d9dda492a64b83d6ddf
5
5
  SHA512:
6
- metadata.gz: 759e9b4aaa8087e652248f349dc41fd340a117234d25be941c223a112e4a7080c122c268c77da37f098f7d53ec19e7e7a27c502abed0496fd758874a40366101
7
- data.tar.gz: b527142c5b3e8dd08ea919ef8b90dfa3703c9580b2c9efcfd12cbedd56131975dd7473f0d5bfe612b007bb7f03ca07926f54ade8ae4ac58e12ce37de8c0db932
6
+ metadata.gz: f135d7d2979a67bf3b9f883f5775511a78088b9c8468676da7d028551d4bfbc80ba89b44c182c88da98bd3adbed2deed425a97f2d5fe7b46fe6ebdbac85dc966
7
+ data.tar.gz: 7efc39dbd3e86b1f4672900535d1f3556b907d7c6f5220a61182a4aa3b44685a333d41c67fa78fc923e41df33b39ba49bc520743a3e9b5186179b86eb78cdbf7
@@ -46,4 +46,5 @@ Gem::Specification.new do |spec|
46
46
  spec.add_development_dependency 'rake', '~> 10.0'
47
47
 
48
48
  spec.add_dependency 'rails', '> 4.2'
49
+ spec.add_dependency 'ruby-progressbar', '~> 1.10.1'
49
50
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ruby-progressbar'
3
4
  require 'chusaku/version'
4
5
  require 'chusaku/parser'
5
6
  require 'chusaku/routes'
@@ -8,17 +9,23 @@ module Chusaku
8
9
  # The main method to run Chusaku. Annotate all actions in your Rails project
9
10
  # as follows:
10
11
  #
11
- # # @route GET /waterlilies/:id (waterlilies)
12
+ # # @route [GET] /waterlilies/:id (waterlilies)
12
13
  # def show
13
14
  # # ...
14
15
  # end
15
16
  def self.call
16
- puts 'Chusaku starting...'
17
17
  routes = Chusaku::Routes.call
18
- controllers = 'app/controllers/**/*_controller.rb'
18
+ controller_pattern = 'app/controllers/**/*_controller.rb'
19
+ controller_paths = Dir.glob(Rails.root.join(controller_pattern))
20
+
21
+ # Start progress bar.
22
+ progressbar = ProgressBar.create \
23
+ title: 'Chusaku',
24
+ total: controller_paths.count
19
25
 
20
26
  # Loop over all controller file paths.
21
- Dir.glob(Rails.root.join(controllers)).each do |path|
27
+ controller_paths.each do |path|
28
+ progressbar.increment
22
29
  controller = /controllers\/(.*)_controller\.rb/.match(path)[1]
23
30
  actions = routes[controller]
24
31
  next if actions.nil?
@@ -46,10 +53,7 @@ module Chusaku
46
53
  # Write to file.
47
54
  parsed_content = parsed_file.map { |pf| pf[:body] }
48
55
  write(path, parsed_content.join)
49
- puts "Annotated #{controller}"
50
56
  end
51
-
52
- puts 'Chusaku finished!'
53
57
  end
54
58
 
55
59
  # Write given content to a file. If we're using an overridden version of File,
@@ -70,7 +74,7 @@ module Chusaku
70
74
 
71
75
  # Given a hash describing an action, generate an annotation in the form:
72
76
  #
73
- # @route GET /waterlilies/:id (waterlilies)
77
+ # @route [GET] /waterlilies/:id (waterlilies)
74
78
  #
75
79
  # @param {Hash} action_info
76
80
  # @return {String}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chusaku
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chusaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nishiki Liu
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ruby-progressbar
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.10.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.10.1
69
83
  description: Annotate your Rails controllers with route info.
70
84
  email:
71
85
  - nishiki.liu@gmail.com