partially_useful 0.0.3 → 0.1.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
  SHA1:
3
- metadata.gz: db0acb9e7170ecf76a2213e54eefd5cfed8757d4
4
- data.tar.gz: 875aa5b5f1697f7b724437cf2b533109cd4bdccc
3
+ metadata.gz: c946ba0664ecb0b799fa878beb56ae454aac2840
4
+ data.tar.gz: 376bba8c028629234928b5283a5094d233b4b23b
5
5
  SHA512:
6
- metadata.gz: a6304798312b259f8cb05c8af760c54d29dde1c7c457e97850e784f28d6d4218931ee003b8bd0b6bd6acf4cfb3f725a4742aa6a9c0e246094a1855432b7b26df
7
- data.tar.gz: 544a40ae37f3b85d031c1bcf3540ec5e62342c9d5ce1f7df88242574f9fa65836a69edcfe155f93c40d55ed3c6c76de272bd2f5589a40fced7e4dbf6b8924e04
6
+ metadata.gz: 8edaaa45a616ee17fc2921a1778bfdd852efc9827cda85a130fc716cbfdb6e075acfcc0896340903b42740b0a41270ee59a16f9bff4ee376b663b0ba7303e724
7
+ data.tar.gz: 8b4d25a75fc210cfa8903c9a1673cff20170a2c5070a5f78da2042a13cb931c5e90de872ce8b881c729d0ca3ea1313dbe433cb8bb50d2d21d758df4a2c4097b4
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  script: "bundle exec rake"
2
2
  rvm:
3
+ - jruby-19mode
4
+ - 1.9.3
3
5
  - 2.0.0
4
6
  - 2.1.0
5
7
  - 2.1.1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.0
2
+
3
+ * support for 1.9.3 and jruby (no more Module#prepend)
4
+
1
5
  # 0.0.3
2
6
 
3
7
  * clarification for ruby version
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- partially_useful (0.0.2)
4
+ partially_useful (0.0.3)
5
5
  railties (~> 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (4.1.0)
11
- actionview (= 4.1.0)
12
- activesupport (= 4.1.0)
10
+ actionpack (4.1.1)
11
+ actionview (= 4.1.1)
12
+ activesupport (= 4.1.1)
13
13
  rack (~> 1.5.2)
14
14
  rack-test (~> 0.6.2)
15
- actionview (4.1.0)
16
- activesupport (= 4.1.0)
15
+ actionview (4.1.1)
16
+ activesupport (= 4.1.1)
17
17
  builder (~> 3.1)
18
18
  erubis (~> 2.7.0)
19
- activesupport (4.1.0)
19
+ activesupport (4.1.1)
20
20
  i18n (~> 0.6, >= 0.6.9)
21
21
  json (~> 1.7, >= 1.7.7)
22
22
  minitest (~> 5.1)
@@ -26,22 +26,25 @@ GEM
26
26
  erubis (2.7.0)
27
27
  i18n (0.6.9)
28
28
  json (1.8.1)
29
+ json (1.8.1-java)
29
30
  minitest (5.3.3)
30
31
  rack (1.5.2)
31
32
  rack-test (0.6.2)
32
33
  rack (>= 1.0)
33
- railties (4.1.0)
34
- actionpack (= 4.1.0)
35
- activesupport (= 4.1.0)
34
+ railties (4.1.1)
35
+ actionpack (= 4.1.1)
36
+ activesupport (= 4.1.1)
36
37
  rake (>= 0.8.7)
37
38
  thor (>= 0.18.1, < 2.0)
38
39
  rake (10.3.1)
39
40
  thor (0.19.1)
40
41
  thread_safe (0.3.3)
42
+ thread_safe (0.3.3-java)
41
43
  tzinfo (1.1.0)
42
44
  thread_safe (~> 0.1)
43
45
 
44
46
  PLATFORMS
47
+ java
45
48
  ruby
46
49
 
47
50
  DEPENDENCIES
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # PartiallyUseful
2
2
 
3
- [![Build Status](https://img.shields.io/travis/phoet/partially_useful/master.svg)](https://travis-ci.org/phoet/asin)
3
+ [![Build Status](https://img.shields.io/travis/phoet/partially_useful/master.svg)](https://travis-ci.org/phoet/partially_useful)
4
4
 
5
- When looking at a rendered html page, it's often hard to tell where the code of a partial lives inside the views directory.
5
+ HTML source code is very verbose and can be a pain in the ass to find a specific part on big pages.
6
6
 
7
- Surrounds rendered partials with html-comments in order to simplify the process of finding the proper file.
7
+ Finding the origin of a piece of HTML in the Rails `app/views` directory can be tedious and error prone.
8
+
9
+ Adding this gem to your Rails application adds HTML comments at development time, so it's easy to find the right partials.
8
10
 
9
11
  ```html
10
12
  <!-- start rendering 'some_partial' with locals '[:all, :assigned, :locals]'-->
@@ -26,13 +28,19 @@ gem 'partially_useful', group: 'development'
26
28
 
27
29
  ## Usage
28
30
 
29
- The plugin is enabled by default, buy you can disable it in your rails configuration:
31
+ The plugin is enabled by default, but you can disable it in your Rails configuration:
30
32
 
31
33
  ```ruby
32
34
  # config/environments/development.rb
33
35
  config.partially_useful = false
34
36
  ```
35
37
 
38
+ ## Caveats
39
+
40
+ HTML comments might subtly break your application when partials are used out of the usual HTML rendering context (JS, CSS etc).
41
+
42
+ If you run into any problems, make sure to disable the gem and restart your Rails server.
43
+
36
44
  ## Supported Ruby versions
37
45
 
38
46
  See .travis.yml
@@ -1,8 +1,13 @@
1
1
  module PartiallyUseful
2
2
  module PartialRenderer
3
+ def self.included(klass)
4
+ klass.send :alias_method, :original_rails_render, :render
5
+ klass.send :remove_method, :render
6
+ end
7
+
3
8
  def render(context, options, block)
4
9
  msg = "rendering '#{options[:partial]}' with locals '#{(options[:locals] || {}).keys}'"
5
- "<!-- start #{msg}-->\n#{super(context, options, block)}\n<!-- end #{msg}-->\n".html_safe
10
+ "<!-- start #{msg}-->\n#{original_rails_render(context, options, block)}\n<!-- end #{msg}-->\n".html_safe
6
11
  end
7
12
  end
8
13
  end
@@ -4,7 +4,7 @@ module PartiallyUseful
4
4
 
5
5
  initializer :partially_useful do |app|
6
6
  if app.config.partially_useful
7
- ActionView::PartialRenderer.send(:prepend, PartiallyUseful::PartialRenderer)
7
+ ActionView::PartialRenderer.send(:include, PartiallyUseful::PartialRenderer)
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module PartiallyUseful
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partially_useful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - phoet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-16 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -146,4 +146,3 @@ test_files:
146
146
  - test/dummy/public/favicon.ico
147
147
  - test/partially_useful_test.rb
148
148
  - test/test_helper.rb
149
- has_rdoc: