current_template 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9205d3cdef37384cb5e219316a5266cecee2c50d
4
+ data.tar.gz: 4a647a29b0c93ba7c74ae515d493fb586efe8355
5
+ SHA512:
6
+ metadata.gz: 60d9c4cc07d9db794eb125e499ba8e5fb84d2c39c96824ba93c9c0c960e9cb031eb0b0cc41b9fb2dcd2843446fcde852a1d2eaf2a1a838fc8e6ce2f35fb4d02b
7
+ data.tar.gz: 42906b6dbb2f519215d7ed7427a3a75538a73d72d7f208c22dbf623b4521489f9aad2f957f816cc96aa2b1c470107430165c84343f92fba8fe5c3b152ed20ce4
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 shihokambara
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # CurrentTemplate
2
+ Display name of the current template file, including partial template.
3
+
4
+ ## Demo
5
+ ![demo](https://github.com/shihokambara/current_template/blob/master/demo.jpg)
6
+
7
+ ## Feature
8
+
9
+ This gem inspects log/development.log and gets partial name from it!
10
+ It doesn't override any method!
11
+
12
+ ```ruby
13
+ <%= "#{`tail log/development.log`}".scan(/\s[a-z]+\/\S+/) %>
14
+ ```
15
+
16
+ ## Installation
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ group :development do
21
+ gem install 'current_template'
22
+ end
23
+ ```
24
+ And then add this line to app/view/layout/application.html.erb
25
+
26
+ ```ruby
27
+ <% if Rails.env == 'development' %>
28
+ <%= show_current_template %>
29
+ <% end %>
30
+ ```
31
+ ## License
32
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
33
+
34
+ ## Author
35
+ [shiho kambara](https://github.com/shihokambara)
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ desc 'Default: run specs'
5
+ task default: :spec
6
+ Bundler::GemHelper.install_tasks
7
+
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/current_template .js
2
+ //= link_directory ../stylesheets/current_template .css
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module CurrentTemplate
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module CurrentTemplate
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module CurrentTemplate
2
+ module ViewHelper
3
+ def show_current_template
4
+ render partial: 'current_template/show_template'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module CurrentTemplate
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module CurrentTemplate
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module CurrentTemplate
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ <div class='current_template-container' >
2
+ <small>CurrentTemplateViewer</small>
3
+ <p class='current_template-inner'>
4
+ Template: <%= "#{`tail log/development.log`}".scan(/\s[a-z]+\/\S+/) %>
5
+ </p>
6
+ </div>
7
+ <style>
8
+ .current_template-container{
9
+ max-width: 400px;
10
+ position: fixed;
11
+ bottom: 10px;
12
+ background: green;
13
+ color: #fff;
14
+ right: 10px;
15
+ opacity: 0.8;
16
+ padding: 10px 40px;
17
+ border-radius: 5px;
18
+ z-index: 999999;
19
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
20
+ font-weight: 200;
21
+ }
22
+ .current_template-inner{
23
+ margin-top: 20px;
24
+ }
25
+ </style>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Current template</title>
5
+ <%= stylesheet_link_tag "current_template/application", media: "all" %>
6
+ <%= javascript_include_tag "current_template/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ CurrentTemplate::Engine.routes.draw do
2
+ end
@@ -0,0 +1,9 @@
1
+ module CurrentTemplate
2
+ class Engine < ::Rails::Engine
3
+ initializer 'current_template.action_view_helpers' do
4
+ ActiveSupport.on_load :action_view do
5
+ include ViewHelper
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module CurrentTemplate
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,5 @@
1
+ require "current_template/engine"
2
+
3
+ module CurrentTemplate
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :current_template do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: current_template
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - shiho kambara
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Get name of the current template file, including partial template.
14
+ email:
15
+ - shihokambara@icloud.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - MIT-LICENSE
21
+ - README.md
22
+ - Rakefile
23
+ - app/assets/config/current_template_manifest.js
24
+ - app/assets/javascripts/current_template/application.js
25
+ - app/assets/stylesheets/current_template/application.css
26
+ - app/controllers/current_template/application_controller.rb
27
+ - app/helpers/current_template/application_helper.rb
28
+ - app/helpers/current_template/view_helper.rb
29
+ - app/jobs/current_template/application_job.rb
30
+ - app/mailers/current_template/application_mailer.rb
31
+ - app/models/current_template/application_record.rb
32
+ - app/views/current_template/_show_template.html.erb
33
+ - app/views/layouts/current_template/application.html.erb
34
+ - config/routes.rb
35
+ - lib/current_template.rb
36
+ - lib/current_template/engine.rb
37
+ - lib/current_template/version.rb
38
+ - lib/tasks/current_template_tasks.rake
39
+ homepage: https://github.com/shihokambara/current_template
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.6.13
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Get name of the current template file
63
+ test_files: []