unused_view 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -17,6 +17,31 @@ and execute rake task `unused_views`.
17
17
  $ bundle exec rake unused_views
18
18
  # if you want to search unused specific directory. e.g. path-to-rails-root/app/views/users
19
19
  $ bundle exec rake 'unused_views[users]'
20
+ # Loading code in search of controllers
21
+ # Unused Views
22
+ /Users/toqoz/Projects/ppp/app/views/articles/edit.html.erb
23
+ /Users/toqoz/Projects/ppp/app/views/articles/new.html.erb
24
+ /Users/toqoz/Projects/ppp/app/views/users/create.html.erb
25
+ /Users/toqoz/Projects/ppp/app/views/users/edit.html.erb
26
+
27
+ ```
28
+
29
+ or start `rails console` and excute command.
30
+
31
+ ```sh
32
+ $ bundle exec rails console
33
+ irb(main):001:0> show_unused_views
34
+ /Users/toqoz/Projects/ppp/app/views/articles/edit.html.erb
35
+ /Users/toqoz/Projects/ppp/app/views/articles/new.html.erb
36
+ /Users/toqoz/Projects/ppp/app/views/users/create.html.erb
37
+ /Users/toqoz/Projects/ppp/app/views/users/edit.html.erb
38
+
39
+ # if you use pry-rails
40
+ [1] pry(main)> show-unused-views
41
+ /Users/toqoz/Projects/ppp/app/views/articles/edit.html.erb
42
+ /Users/toqoz/Projects/ppp/app/views/articles/new.html.erb
43
+ /Users/toqoz/Projects/ppp/app/views/users/create.html.erb
44
+ /Users/toqoz/Projects/ppp/app/views/users/edit.html.erb
20
45
  ```
21
46
 
22
47
  then see list of unused views.
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ CC.define_command('show-unused-views') do |c|
4
+ c.description "Show unused views list"
5
+ c.group "UnusedView"
6
+ c.options do |opts|
7
+ opt.banner unindent <<-USAGE
8
+ Usage: show-unused-views [PATH]
9
+
10
+ Show unused views list
11
+ USAGE
12
+ end
13
+ c.process do
14
+ Rails.application.eager_load!
15
+ puts UnusedView.find_all(Rails.root.join('app').join('views'))
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'console_command'
4
+ command_glob = File.expand_path('../commands/*.rb', __FILE__)
5
+ Dir[command_glob].each do |command|
6
+ require command
7
+ end
@@ -3,5 +3,9 @@ module UnusedView
3
3
  rake_tasks do
4
4
  load "unused_view/tasks.rake"
5
5
  end
6
+
7
+ console do
8
+ require "unused_view/commands"
9
+ end
6
10
  end
7
11
  end
@@ -1,12 +1,10 @@
1
- desc "Show all unused views"
2
1
  task :load_controllers => :environment do
3
- puts "# Loading code in search of controllers"
4
2
  Rails.application.eager_load!
5
3
  end
6
4
 
5
+ desc "Show all unused views"
7
6
  task :unused_views, [ :path ] => :load_controllers do |task, args|
8
7
  base_path = Rails.root.join('app').join('views').join(args[:path] || "")
9
- puts "# Unused Views"
10
8
  unused_views = UnusedView.find_all(base_path)
11
9
  puts unused_views
12
10
  end
@@ -1,3 +1,3 @@
1
1
  module UnusedView
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: unused_view
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Takatoshi Matsumoto
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-19 00:00:00.000000000 Z
12
+ date: 2012-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ type: :runtime
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.2
38
+ name: console_command
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.2
30
46
  - !ruby/object:Gem::Dependency
31
47
  type: :development
32
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +82,8 @@ executables: []
66
82
  extensions: []
67
83
  extra_rdoc_files: []
68
84
  files:
85
+ - lib/unused_view/commands/show_unused_views.rb
86
+ - lib/unused_view/commands.rb
69
87
  - lib/unused_view/railtie.rb
70
88
  - lib/unused_view/tasks.rake
71
89
  - lib/unused_view/version.rb
@@ -86,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
104
  - !ruby/object:Gem::Version
87
105
  segments:
88
106
  - 0
89
- hash: -1427703622293713147
107
+ hash: 2644683764795231228
90
108
  version: '0'
91
109
  required_rubygems_version: !ruby/object:Gem::Requirement
92
110
  none: false
@@ -95,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
113
  - !ruby/object:Gem::Version
96
114
  segments:
97
115
  - 0
98
- hash: -1427703622293713147
116
+ hash: 2644683764795231228
99
117
  version: '0'
100
118
  requirements: []
101
119
  rubyforge_project: