plug_demo 0.2.0

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.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/config/plug_demo_manifest.js +2 -0
  6. data/app/assets/javascripts/plug_demo/application.js +13 -0
  7. data/app/assets/javascripts/plug_demo/plugins.js +2 -0
  8. data/app/assets/javascripts/plug_demo/plugs.js +2 -0
  9. data/app/assets/stylesheets/plug_demo/application.css +15 -0
  10. data/app/assets/stylesheets/plug_demo/plugins.css +4 -0
  11. data/app/assets/stylesheets/plug_demo/plugs.css +4 -0
  12. data/app/assets/stylesheets/scaffold.css +80 -0
  13. data/app/controllers/plug_demo/application_controller.rb +5 -0
  14. data/app/controllers/plug_demo/plugins_controller.rb +62 -0
  15. data/app/controllers/plug_demo/plugs_controller.rb +9 -0
  16. data/app/helpers/plug_demo/application_helper.rb +4 -0
  17. data/app/helpers/plug_demo/plugins_helper.rb +4 -0
  18. data/app/helpers/plug_demo/plugs_helper.rb +4 -0
  19. data/app/jobs/plug_demo/application_job.rb +4 -0
  20. data/app/mailers/plug_demo/application_mailer.rb +6 -0
  21. data/app/models/plug_demo/application_record.rb +5 -0
  22. data/app/models/plug_demo/plug.rb +4 -0
  23. data/app/models/plug_demo/plugin.rb +4 -0
  24. data/app/views/layouts/plug_demo/application.html.erb +14 -0
  25. data/app/views/plug_demo/plugins/_form.html.erb +27 -0
  26. data/app/views/plug_demo/plugins/edit.html.erb +6 -0
  27. data/app/views/plug_demo/plugins/index.html.erb +29 -0
  28. data/app/views/plug_demo/plugins/new.html.erb +5 -0
  29. data/app/views/plug_demo/plugins/show.html.erb +14 -0
  30. data/config/routes.rb +4 -0
  31. data/db/migrate/20170602115915_create_plug_demo_plugs.rb +10 -0
  32. data/db/migrate/20170602120122_create_plug_demo_plugins.rb +10 -0
  33. data/lib/plug_demo.rb +5 -0
  34. data/lib/plug_demo/engine.rb +5 -0
  35. data/lib/plug_demo/version.rb +3 -0
  36. data/lib/tasks/plug_demo_tasks.rake +4 -0
  37. metadata +107 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 69afe4ea26aa37275acf9c2680756642aa5f57bd
4
+ data.tar.gz: 61f4ea214785b82f1980b8f93cc94388d6ebe8c5
5
+ SHA512:
6
+ metadata.gz: eb35800d09770ff47c1a0fc5ba9af82aae06d4ee56cfdb444b61e0d86aac2e488f52542462e36f02e2b0f957c3969efea6f9520ef3c26dd1b802c79664ebe412
7
+ data.tar.gz: aa427fc2fd06a7417416ea2ef947b1cd98f5e5f79fd7cd079dc1b425385cc0aed4a4f67e3e24bbf7ba471375f5d4a2bae5a75d97a51d9d1be7e88aabafa558d5
@@ -0,0 +1,20 @@
1
+ Copyright 2017 balambf
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.
@@ -0,0 +1,28 @@
1
+ # PlugDemo
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'plug_demo'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install plug_demo
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,36 @@
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 = 'PlugDemo'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'test'
31
+ t.pattern = 'test/**/*_test.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+
36
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/plug_demo .js
2
+ //= link_directory ../stylesheets/plug_demo .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,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -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,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,80 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ margin: 33px;
5
+ }
6
+
7
+ body, p, ol, ul, td {
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a {
20
+ color: #000;
21
+ }
22
+
23
+ a:visited {
24
+ color: #666;
25
+ }
26
+
27
+ a:hover {
28
+ color: #fff;
29
+ background-color: #000;
30
+ }
31
+
32
+ th {
33
+ padding-bottom: 5px;
34
+ }
35
+
36
+ td {
37
+ padding: 0 5px 7px;
38
+ }
39
+
40
+ div.field,
41
+ div.actions {
42
+ margin-bottom: 10px;
43
+ }
44
+
45
+ #notice {
46
+ color: green;
47
+ }
48
+
49
+ .field_with_errors {
50
+ padding: 2px;
51
+ background-color: red;
52
+ display: table;
53
+ }
54
+
55
+ #error_explanation {
56
+ width: 450px;
57
+ border: 2px solid red;
58
+ padding: 7px 7px 0;
59
+ margin-bottom: 20px;
60
+ background-color: #f0f0f0;
61
+ }
62
+
63
+ #error_explanation h2 {
64
+ text-align: left;
65
+ font-weight: bold;
66
+ padding: 5px 5px 5px 15px;
67
+ font-size: 12px;
68
+ margin: -7px -7px 0;
69
+ background-color: #c00;
70
+ color: #fff;
71
+ }
72
+
73
+ #error_explanation ul li {
74
+ font-size: 12px;
75
+ list-style: square;
76
+ }
77
+
78
+ label {
79
+ display: block;
80
+ }
@@ -0,0 +1,5 @@
1
+ module PlugDemo
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "plug_demo/application_controller"
2
+
3
+ module PlugDemo
4
+ class PluginsController < ApplicationController
5
+ before_action :set_plugin, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /plugins
8
+ def index
9
+ @plugins = Plugin.all
10
+ end
11
+
12
+ # GET /plugins/1
13
+ def show
14
+ end
15
+
16
+ # GET /plugins/new
17
+ def new
18
+ @plugin = Plugin.new
19
+ end
20
+
21
+ # GET /plugins/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /plugins
26
+ def create
27
+ @plugin = Plugin.new(plugin_params)
28
+
29
+ if @plugin.save
30
+ redirect_to @plugin, notice: 'Plugin was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /plugins/1
37
+ def update
38
+ if @plugin.update(plugin_params)
39
+ redirect_to @plugin, notice: 'Plugin was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /plugins/1
46
+ def destroy
47
+ @plugin.destroy
48
+ redirect_to plugins_url, notice: 'Plugin was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_plugin
54
+ @plugin = Plugin.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def plugin_params
59
+ params.require(:plugin).permit(:name, :comments)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,9 @@
1
+ require_dependency "plug_demo/application_controller"
2
+
3
+ module PlugDemo
4
+ class PlugsController < ApplicationController
5
+ def index
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ module PluginsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ module PlugsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module PlugDemo
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module PlugDemo
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ class Plug < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PlugDemo
2
+ class Plugin < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Plug demo</title>
5
+ <%= stylesheet_link_tag "plug_demo/application", media: "all" %>
6
+ <%= javascript_include_tag "plug_demo/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: plugin, local: true) do |form| %>
2
+ <% if plugin.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(plugin.errors.count, "error") %> prohibited this plugin from being saved:</h2>
5
+
6
+ <ul>
7
+ <% plugin.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= form.label :name %>
16
+ <%= form.text_field :name, id: :plugin_name %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= form.label :comments %>
21
+ <%= form.text_area :comments, id: :plugin_comments %>
22
+ </div>
23
+
24
+ <div class="actions">
25
+ <%= form.submit %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Plugin</h1>
2
+
3
+ <%= render 'form', plugin: @plugin %>
4
+
5
+ <%= link_to 'Show', @plugin %> |
6
+ <%= link_to 'Back', plugins_path %>
@@ -0,0 +1,29 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Plugins</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Name</th>
9
+ <th>Comments</th>
10
+ <th colspan="3"></th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <% @plugins.each do |plugin| %>
16
+ <tr>
17
+ <td><%= plugin.name %></td>
18
+ <td><%= plugin.comments %></td>
19
+ <td><%= link_to 'Show', plugin %></td>
20
+ <td><%= link_to 'Edit', edit_plugin_path(plugin) %></td>
21
+ <td><%= link_to 'Destroy', plugin, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
+ </tr>
23
+ <% end %>
24
+ </tbody>
25
+ </table>
26
+
27
+ <br>
28
+
29
+ <%= link_to 'New Plugin', new_plugin_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New Plugin</h1>
2
+
3
+ <%= render 'form', plugin: @plugin %>
4
+
5
+ <%= link_to 'Back', plugins_path %>
@@ -0,0 +1,14 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Name:</strong>
5
+ <%= @plugin.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Comments:</strong>
10
+ <%= @plugin.comments %>
11
+ </p>
12
+
13
+ <%= link_to 'Edit', edit_plugin_path(@plugin) %> |
14
+ <%= link_to 'Back', plugins_path %>
@@ -0,0 +1,4 @@
1
+ PlugDemo::Engine.routes.draw do
2
+ resources :plugins
3
+ resources :plugs
4
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePlugDemoPlugs < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :plug_demo_plugs do |t|
4
+ t.string :name
5
+ t.text :comments
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePlugDemoPlugins < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :plug_demo_plugins do |t|
4
+ t.string :name
5
+ t.text :comments
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ require "plug_demo/engine"
2
+
3
+ module PlugDemo
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,5 @@
1
+ module PlugDemo
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace PlugDemo
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module PlugDemo
2
+ VERSION = '0.2.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :plug_demo do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plug_demo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - balambf
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-02 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.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.1.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: testing theplugin
42
+ email:
43
+ - balaji.d@madebyfire.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - app/assets/config/plug_demo_manifest.js
52
+ - app/assets/javascripts/plug_demo/application.js
53
+ - app/assets/javascripts/plug_demo/plugins.js
54
+ - app/assets/javascripts/plug_demo/plugs.js
55
+ - app/assets/stylesheets/plug_demo/application.css
56
+ - app/assets/stylesheets/plug_demo/plugins.css
57
+ - app/assets/stylesheets/plug_demo/plugs.css
58
+ - app/assets/stylesheets/scaffold.css
59
+ - app/controllers/plug_demo/application_controller.rb
60
+ - app/controllers/plug_demo/plugins_controller.rb
61
+ - app/controllers/plug_demo/plugs_controller.rb
62
+ - app/helpers/plug_demo/application_helper.rb
63
+ - app/helpers/plug_demo/plugins_helper.rb
64
+ - app/helpers/plug_demo/plugs_helper.rb
65
+ - app/jobs/plug_demo/application_job.rb
66
+ - app/mailers/plug_demo/application_mailer.rb
67
+ - app/models/plug_demo/application_record.rb
68
+ - app/models/plug_demo/plug.rb
69
+ - app/models/plug_demo/plugin.rb
70
+ - app/views/layouts/plug_demo/application.html.erb
71
+ - app/views/plug_demo/plugins/_form.html.erb
72
+ - app/views/plug_demo/plugins/edit.html.erb
73
+ - app/views/plug_demo/plugins/index.html.erb
74
+ - app/views/plug_demo/plugins/new.html.erb
75
+ - app/views/plug_demo/plugins/show.html.erb
76
+ - config/routes.rb
77
+ - db/migrate/20170602115915_create_plug_demo_plugs.rb
78
+ - db/migrate/20170602120122_create_plug_demo_plugins.rb
79
+ - lib/plug_demo.rb
80
+ - lib/plug_demo/engine.rb
81
+ - lib/plug_demo/version.rb
82
+ - lib/tasks/plug_demo_tasks.rake
83
+ homepage: http://madebyfire.com
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.6.12
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: testing plug option in rails 5
107
+ test_files: []