active_path-path_hints 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 36933136f01edeaa30ec85a9aa7b0cb229d0ede4
4
+ data.tar.gz: b90b0deb6b9059c03cd26227d20c7c276a815c4c
5
+ SHA512:
6
+ metadata.gz: 4595a284a6515c113211b4312169b54f2ea05be011cea823fbb6199f3ed236aba0d295e84162872e5ef103f7f4fbd97063b53078167fed07c67949d26b91eb0e
7
+ data.tar.gz: 02e6272651e62e401f2053783d5b5be41143c00c4cc3122e59adba37c91deebe5d22e97f8b8d75fe5a8618ef58382c3bbd52f06cff71453963c1e890f6956d53
@@ -0,0 +1 @@
1
+ .idea
@@ -0,0 +1,45 @@
1
+ # ActivePath Path Hints:
2
+
3
+ Path hints for your Rails 5 partials.
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'active_path-path_hints'
11
+ ```
12
+
13
+ Add the initializer `config/initializers/active_path.rb` and enable `ActivePath`:
14
+
15
+ ```ruby
16
+
17
+ ActivePath.configure do |config|
18
+
19
+ config.enabled = true
20
+
21
+ end
22
+
23
+ ```
24
+
25
+ **Path hints:** (use in development only)
26
+
27
+
28
+ ```ruby
29
+
30
+ config.path_hints = true
31
+
32
+ ```
33
+
34
+ HTML comments are added before and after each partial. Here is sample output:
35
+
36
+ ```html
37
+ <!-- start pages/content -->
38
+ <p>page content</p>
39
+ <!-- end pages/content -->
40
+ <!-- start example/test -->
41
+ <p>example content</p>
42
+ <!-- end example/test -->
43
+
44
+ ```
45
+ Feel free to [submit issues](https://github.com/active-path/path-hints/issues) or [help make it better](https://github.com/active-path/path-hints/pulls).
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env rake
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require 'active_path/path_hints/version'
5
+
6
+ desc "Release version #{ActivePath::PathHints::VERSION} of the gem"
7
+ task :release do
8
+
9
+ system "git tag -a v#{ActivePath::PathHints::VERSION} -m 'Tagging #{ActivePath::PathHints::VERSION}'"
10
+ system 'git push --tags'
11
+
12
+ system "gem build active_path-path_hints.gemspec"
13
+ system "gem push active_path-path_hints-#{ActivePath::PathHints::VERSION}.gem"
14
+ system "rm active_path-path_hints-#{ActivePath::PathHints::VERSION}.gem"
15
+ end
@@ -0,0 +1,17 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+ require 'active_path/path_hints/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'active_path-path_hints'
6
+ s.version = ActivePath::PathHints::VERSION
7
+ s.date = '2018-04-28'
8
+ s.summary = "ActivePath Path Hints"
9
+ s.description = "Path hints for your Rails 5 partials"
10
+ s.authors = ["Ryan Tulino"]
11
+ s.email = 'rtulino@gmail.com'
12
+ s.files = `git ls-files`.split("\n")
13
+ s.homepage = 'http://rubygems.org/gems/active_path-path_hints'
14
+ s.required_ruby_version = '>= 2.2.0'
15
+ s.add_dependency 'rails', '~> 5'
16
+ s.add_dependency 'active_path', '~> 0.1.0'
17
+ end
@@ -0,0 +1 @@
1
+ require 'active_path/path_hints/engine'
@@ -0,0 +1,14 @@
1
+ require 'active_path/path_hints/subscriber'
2
+ module ActivePath
3
+ module PathHints
4
+ class Engine < Rails::Engine
5
+ isolate_namespace ActivePath::PathHints
6
+
7
+ config.after_initialize do
8
+ if ActivePath.config.path_hints
9
+ ActiveSupport::Notifications.subscribe(:render_partial, Subscriber.new)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'active_path/subscribers/subscriber'
2
+ module ActivePath
3
+ module PathHints
4
+ class Subscriber < Subscribers::Subscriber
5
+ def perform
6
+ buffer.prepend("<!-- start #{partial}#{with_local_variables.to_s} --!>".html_safe)
7
+ buffer.concat("<!-- end #{partial} --!>".html_safe)
8
+ end
9
+
10
+ private
11
+
12
+ def with_local_variables
13
+ if options.is_a?(Hash)
14
+ variables = options[:locals].map do |k,v|
15
+ count = (" (#{v.count})" if v.is_a?(Array)).to_s
16
+ "#{k} => #{v.class}#{count}"
17
+ end
18
+ "\nwith local variables: #{JSON.pretty_generate(variables)}"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module ActivePath
2
+ module PathHints
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_path-path_hints
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Tulino
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_path
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.0
41
+ description: Path hints for your Rails 5 partials
42
+ email: rtulino@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ".gitignore"
48
+ - README.md
49
+ - Rakefile
50
+ - active_path-path_hints.gemspec
51
+ - lib/active_path/path_hints.rb
52
+ - lib/active_path/path_hints/engine.rb
53
+ - lib/active_path/path_hints/subscriber.rb
54
+ - lib/active_path/path_hints/version.rb
55
+ homepage: http://rubygems.org/gems/active_path-path_hints
56
+ licenses: []
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 2.2.0
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.6.11
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: ActivePath Path Hints
78
+ test_files: []