partially_useful 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +50 -0
  6. data/README.md +47 -0
  7. data/Rakefile +29 -0
  8. data/lib/partially_useful.rb +3 -0
  9. data/lib/partially_useful/engine.rb +11 -0
  10. data/lib/partially_useful/partial_renderer.rb +8 -0
  11. data/lib/partially_useful/version.rb +3 -0
  12. data/partially_useful.gemspec +24 -0
  13. data/test/dummy/Rakefile +6 -0
  14. data/test/dummy/app/controllers/application_controller.rb +3 -0
  15. data/test/dummy/app/controllers/welcome_controller.rb +2 -0
  16. data/test/dummy/app/views/application/_footer.html.erb +3 -0
  17. data/test/dummy/app/views/application/_header.html.erb +3 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +16 -0
  19. data/test/dummy/app/views/welcome/_welcome.html.erb +1 -0
  20. data/test/dummy/app/views/welcome/index.html.erb +5 -0
  21. data/test/dummy/bin/bundle +3 -0
  22. data/test/dummy/bin/rails +4 -0
  23. data/test/dummy/bin/rake +4 -0
  24. data/test/dummy/config.ru +4 -0
  25. data/test/dummy/config/application.rb +13 -0
  26. data/test/dummy/config/boot.rb +5 -0
  27. data/test/dummy/config/environment.rb +5 -0
  28. data/test/dummy/config/environments/development.rb +7 -0
  29. data/test/dummy/config/environments/test.rb +9 -0
  30. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  31. data/test/dummy/config/initializers/secret_token.rb +1 -0
  32. data/test/dummy/config/initializers/session_store.rb +3 -0
  33. data/test/dummy/config/routes.rb +3 -0
  34. data/test/dummy/log/.keep +0 -0
  35. data/test/dummy/public/favicon.ico +0 -0
  36. data/test/partially_useful_test.rb +10 -0
  37. data/test/test_helper.rb +7 -0
  38. metadata +148 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4984329239fd5a85108938655401c329977ceb8e
4
+ data.tar.gz: abd37c9937630d613140a3143ab9cc13bfd14f88
5
+ SHA512:
6
+ metadata.gz: 4f6f880cc74e312e10e73c38f0695bcab871526f7061be02adfa52c72d1aebe4db82f88c60510b8d3908c84f96bc2864b7cca77d76a675da89db6605e2479415
7
+ data.tar.gz: f8ec63080e1ff8efc7316665c6a3d6335636b7d8ab3419f214220496f680d0b348823adc1977573ef620679aa54449bccdc17b2e9cef9c59bcb219bf9c92f3e7
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle/
2
+ log/*.log
3
+ *.gem
4
+ pkg/
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ script: "bundle exec rake"
2
+ rvm:
3
+ - 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ partially_useful (0.0.1)
5
+ railties (>= 4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (4.1.1)
11
+ actionview (= 4.1.1)
12
+ activesupport (= 4.1.1)
13
+ rack (~> 1.5.2)
14
+ rack-test (~> 0.6.2)
15
+ actionview (4.1.1)
16
+ activesupport (= 4.1.1)
17
+ builder (~> 3.1)
18
+ erubis (~> 2.7.0)
19
+ activesupport (4.1.1)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ json (~> 1.7, >= 1.7.7)
22
+ minitest (~> 5.1)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 1.1)
25
+ builder (3.2.2)
26
+ erubis (2.7.0)
27
+ i18n (0.6.9)
28
+ json (1.8.1)
29
+ minitest (5.3.3)
30
+ rack (1.5.2)
31
+ rack-test (0.6.2)
32
+ rack (>= 1.0)
33
+ railties (4.1.1)
34
+ actionpack (= 4.1.1)
35
+ activesupport (= 4.1.1)
36
+ rake (>= 0.8.7)
37
+ thor (>= 0.18.1, < 2.0)
38
+ rake (10.3.1)
39
+ thor (0.19.1)
40
+ thread_safe (0.3.3)
41
+ tzinfo (1.1.0)
42
+ thread_safe (~> 0.1)
43
+
44
+ PLATFORMS
45
+ ruby
46
+
47
+ DEPENDENCIES
48
+ bundler (~> 1.6)
49
+ partially_useful!
50
+ rake
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # PartiallyUseful
2
+
3
+ When looking at a rendered html page, it's often hard to tell where the code of a partial lives inside the views directory.
4
+
5
+ Surrounds rendered partials with html-comments in order to simplify the process of finding the proper file.
6
+
7
+ ```html
8
+ <!-- start rendering 'some_partial' with locals '[:all, :assigned, :locals]'-->
9
+ <div class="hello">
10
+ <div class="world">
11
+ [...]
12
+ </div>
13
+ </div>
14
+ <!-- end rendering 'some_partial' with locals '[:all, :assigned, :locals]'-->
15
+ ```
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ ```ruby
22
+ gem 'partially_useful', group: 'development'
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ The plugin is enabled by default, buy you can disable it in your rails configuration:
28
+
29
+ ```ruby
30
+ # config/environments/development.rb
31
+ config.partially_useful = false
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it ( https://github.com/[my-github-username]/partially_useful/fork )
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create a new Pull Request
41
+
42
+ ## License
43
+
44
+ "THE (extended) BEER-WARE LICENSE" (Revision 42.0815): [phoet](mailto:ps@nofail.de) contributed to this project.
45
+
46
+ As long as you retain this notice you can do whatever you want with this stuff.
47
+ If we meet some day, and you think this stuff is worth it, you can buy me some beers in return.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'PartiallyUseful'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ Bundler::GemHelper.install_tasks
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'lib'
23
+ t.libs << 'test'
24
+ t.pattern = 'test/**/*_test.rb'
25
+ t.verbose = false
26
+ end
27
+
28
+
29
+ task default: :test
@@ -0,0 +1,3 @@
1
+ require "partially_useful/version"
2
+ require "partially_useful/partial_renderer"
3
+ require "partially_useful/engine"
@@ -0,0 +1,11 @@
1
+ module PartiallyUseful
2
+ class Engine < Rails::Engine
3
+ config.partially_useful = true
4
+
5
+ initializer :partially_useful do |app|
6
+ if app.config.partially_useful
7
+ ActionView::PartialRenderer.prepend PartiallyUseful::PartialRenderer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module PartiallyUseful
2
+ module PartialRenderer
3
+ def render(context, options, block)
4
+ msg = "rendering '#{options[:partial]}' with locals '#{(options[:locals] || {}).keys}'"
5
+ "<!-- start #{msg}-->\n#{super(context, options, block)}\n<!-- end #{msg}-->\n".html_safe
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module PartiallyUseful
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'partially_useful/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "partially_useful"
8
+ spec.version = PartiallyUseful::VERSION
9
+ spec.authors = ["phoet"]
10
+ spec.email = ["phoetmail@googlemail.com"]
11
+ spec.homepage = "https://github.com/phoet/partially_useful"
12
+ spec.license = "extended beerware license"
13
+ spec.summary = spec.description = "Helps finding partials in large html pages"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'railties', '~> 4.0'
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,2 @@
1
+ class WelcomeController < ApplicationController
2
+ end
@@ -0,0 +1,3 @@
1
+ <footer>
2
+ (c)(r) <%= link_to '@phoet', 'http://github/phoet' %>
3
+ </footer>
@@ -0,0 +1,3 @@
1
+ <header>
2
+ <h1>Hellooooo</h1>
3
+ </header>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ </head>
7
+ <body>
8
+
9
+ <%= render 'header' %>
10
+
11
+ <%= yield %>
12
+
13
+ <%= render 'footer' %>
14
+
15
+ </body>
16
+ </html>
@@ -0,0 +1 @@
1
+ <h3><%= message %></h3>
@@ -0,0 +1,5 @@
1
+ <h1>Whutup?</h1>
2
+
3
+ <%= render 'welcome', message: 'döpdöpdöp' %>
4
+
5
+ <p>lorem ipsum</p>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'action_controller/railtie'
4
+ require 'action_view/railtie'
5
+
6
+ Bundler.require(*Rails.groups)
7
+ require "partially_useful"
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ config.partially_useful = true
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,7 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.active_support.deprecation = :log
7
+ end
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.action_dispatch.show_exceptions = false
7
+ config.action_controller.allow_forgery_protection = false
8
+ config.active_support.deprecation = :stderr
9
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1 @@
1
+ Rails.application.config.secret_key_base = '_dummy_secret'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ root 'welcome#index'
3
+ end
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class PartiallyUsefulTest < ActionController::TestCase
4
+ tests WelcomeController
5
+
6
+ test "should get index" do
7
+ get :index
8
+ assert_match "<!-- start rendering 'header' with locals '[]'-->", @response.body
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: partially_useful
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - phoet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
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
+ description: Helps finding partials in large html pages
56
+ email:
57
+ - phoetmail@googlemail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - README.md
67
+ - Rakefile
68
+ - lib/partially_useful.rb
69
+ - lib/partially_useful/engine.rb
70
+ - lib/partially_useful/partial_renderer.rb
71
+ - lib/partially_useful/version.rb
72
+ - partially_useful.gemspec
73
+ - test/dummy/Rakefile
74
+ - test/dummy/app/controllers/application_controller.rb
75
+ - test/dummy/app/controllers/welcome_controller.rb
76
+ - test/dummy/app/views/application/_footer.html.erb
77
+ - test/dummy/app/views/application/_header.html.erb
78
+ - test/dummy/app/views/layouts/application.html.erb
79
+ - test/dummy/app/views/welcome/_welcome.html.erb
80
+ - test/dummy/app/views/welcome/index.html.erb
81
+ - test/dummy/bin/bundle
82
+ - test/dummy/bin/rails
83
+ - test/dummy/bin/rake
84
+ - test/dummy/config.ru
85
+ - test/dummy/config/application.rb
86
+ - test/dummy/config/boot.rb
87
+ - test/dummy/config/environment.rb
88
+ - test/dummy/config/environments/development.rb
89
+ - test/dummy/config/environments/test.rb
90
+ - test/dummy/config/initializers/filter_parameter_logging.rb
91
+ - test/dummy/config/initializers/secret_token.rb
92
+ - test/dummy/config/initializers/session_store.rb
93
+ - test/dummy/config/routes.rb
94
+ - test/dummy/log/.keep
95
+ - test/dummy/public/favicon.ico
96
+ - test/partially_useful_test.rb
97
+ - test/test_helper.rb
98
+ homepage: https://github.com/phoet/partially_useful
99
+ licenses:
100
+ - extended beerware license
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.2.2
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Helps finding partials in large html pages
122
+ test_files:
123
+ - test/dummy/Rakefile
124
+ - test/dummy/app/controllers/application_controller.rb
125
+ - test/dummy/app/controllers/welcome_controller.rb
126
+ - test/dummy/app/views/application/_footer.html.erb
127
+ - test/dummy/app/views/application/_header.html.erb
128
+ - test/dummy/app/views/layouts/application.html.erb
129
+ - test/dummy/app/views/welcome/_welcome.html.erb
130
+ - test/dummy/app/views/welcome/index.html.erb
131
+ - test/dummy/bin/bundle
132
+ - test/dummy/bin/rails
133
+ - test/dummy/bin/rake
134
+ - test/dummy/config.ru
135
+ - test/dummy/config/application.rb
136
+ - test/dummy/config/boot.rb
137
+ - test/dummy/config/environment.rb
138
+ - test/dummy/config/environments/development.rb
139
+ - test/dummy/config/environments/test.rb
140
+ - test/dummy/config/initializers/filter_parameter_logging.rb
141
+ - test/dummy/config/initializers/secret_token.rb
142
+ - test/dummy/config/initializers/session_store.rb
143
+ - test/dummy/config/routes.rb
144
+ - test/dummy/log/.keep
145
+ - test/dummy/public/favicon.ico
146
+ - test/partially_useful_test.rb
147
+ - test/test_helper.rb
148
+ has_rdoc: