plug 0.1.12 → 0.1.14

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: 8ff054c84075e1b2e008af464461eb7ad3610a78
4
- data.tar.gz: cde21d4902f6045df745f4d67699e09c16ba1aef
3
+ metadata.gz: 6555955e0bb24af43ac0baf3d82f1c59c36a2701
4
+ data.tar.gz: ecb6287ba37b466b037297ee40fb2f7123409eb1
5
5
  SHA512:
6
- metadata.gz: 4baea815778c86a46fcc78e001811c1c1a3bb305e035ca8d109670786bb9824e29080503ead8fe4fcd45c50d04ba7e539af9f020fe94cd71b213649786a519b9
7
- data.tar.gz: 4220069641d7cb9a1d41949c74477bde938c39543f861d98a387372280727643700db1f196a4ac64342e8e4f4e15cfba32f4c178c29790e605a45a00a4952995
6
+ metadata.gz: 2f38acfd264f4e10bf41bd3c7556b3ba23149c2b5a58f789086258320a6e3839110c08dc29499b144e33265a42390684af2f72e6317088a259d87c512a33327b
7
+ data.tar.gz: 780aebfebb76e2dfd0b20866e62765e06d6aa57e656146c560f8259ef1d5d8f3409881576da6cc55f4f42ba44c72e8a2c4f57f9560b629279d0d3616b70bfdca
data/README.md CHANGED
@@ -72,6 +72,15 @@ If you have custom HTML for notice, you can pass a block.
72
72
  <% end %>
73
73
  ```
74
74
 
75
+ #### Buttons
76
+ Add buttons to the config block to perform rake tasks from the plug dashboard
77
+
78
+ ```ruby
79
+ config.buttons = [
80
+ { label: 'Clear cache', task: 'tmp:cache:clear' }
81
+ ]
82
+ ```
83
+
75
84
  ### Running the tests
76
85
 
77
86
  ```bash
@@ -35,4 +35,6 @@
35
35
  // Blocks
36
36
  @import 'blocks/nav';
37
37
  @import 'blocks/notice';
38
+ @import 'blocks/alert';
38
39
  @import 'blocks/state';
40
+ @import 'blocks/task-button'
@@ -0,0 +1,5 @@
1
+ .alert {
2
+ background: $gallery;
3
+ border: solid 2px $lipstick;
4
+ padding: 2rem;
5
+ }
@@ -0,0 +1,3 @@
1
+ .task-button {
2
+ margin: 0 .5rem;
3
+ }
@@ -4,4 +4,5 @@ $pale-sky: #637381;
4
4
  $alabaster: #f7f7f7;
5
5
  $gallery: #ebebeb;
6
6
  $tall-poppy: #c0392b;
7
- $jungle-green: #27ae60;
7
+ $lipstick: #c70376;
8
+ $jungle-green: #27ae60;
@@ -50,6 +50,22 @@ module Plug
50
50
  redirect_to features_url, notice: 'Feature was successfully destroyed.'
51
51
  end
52
52
 
53
+ # POST /task
54
+ def task_execution
55
+ begin
56
+ require 'rake'
57
+
58
+ Rails.application.load_tasks
59
+ ::Rake::Task[params[:task]].execute
60
+ rescue StandardError => e
61
+ flash[:alert] = e.message
62
+ else
63
+ flash[:notice] = "Task: #{params[:task]} has completed"
64
+ end
65
+
66
+ redirect_to root_path
67
+ end
68
+
53
69
  private
54
70
  # Use callbacks to share common setup or constraints between actions.
55
71
  def set_feature
@@ -1,5 +1,6 @@
1
1
  !!!
2
2
  %html{ lang: 'en' }
3
+ = favicon_link_tag 'favicon.png'
3
4
  = render 'plug/shared/head'
4
5
 
5
6
  %body
@@ -7,4 +8,4 @@
7
8
  = render 'plug/shared/nav'
8
9
  = yield
9
10
 
10
- /= render 'shared/footer'
11
+ /= render 'shared/footer'
@@ -0,0 +1,4 @@
1
+ .task-button
2
+ = form_tag(task_execution_path) do
3
+ = hidden_field_tag(:task, task[:task])
4
+ = submit_tag(task[:label])
@@ -1,7 +1,14 @@
1
1
  .row
2
2
  .column
3
3
  - if notice
4
- %p.notice= notice
4
+ %p.notice= sanitize(notice)
5
+
6
+ - if alert
7
+ %p.alert= sanitize(alert)
8
+
9
+ .row
10
+ .column
11
+ = render partial: 'task', collection: Plug.buttons
5
12
 
6
13
  .clearfix
7
14
  .float-left
@@ -1,5 +1,6 @@
1
1
  Plug::Engine.routes.draw do
2
2
  root to: 'features#index'
3
3
 
4
+ post '/task', to: 'features#task_execution', as: :task_execution
4
5
  resources :features, except: :show
5
6
  end
@@ -7,7 +7,8 @@ module Plug
7
7
  VALID_OPTIONS_KEYS = [
8
8
  :auth_user,
9
9
  :auth_password,
10
- :allow_delete
10
+ :allow_delete,
11
+ :buttons
11
12
  ].freeze
12
13
 
13
14
  attr_accessor *VALID_OPTIONS_KEYS
@@ -1,3 +1,3 @@
1
1
  module Plug
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-26 00:00:00.000000000 Z
12
+ date: 2018-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -191,13 +191,16 @@ files:
191
191
  - README.md
192
192
  - Rakefile
193
193
  - app/assets/config/plug_manifest.js
194
+ - app/assets/images/favicon.png
194
195
  - app/assets/javascripts/plug/application.js
195
196
  - app/assets/javascripts/plug/features.js
196
197
  - app/assets/stylesheets/plug/_settings.scss
197
198
  - app/assets/stylesheets/plug/application.scss
199
+ - app/assets/stylesheets/plug/blocks/_alert.scss
198
200
  - app/assets/stylesheets/plug/blocks/_nav.scss
199
201
  - app/assets/stylesheets/plug/blocks/_notice.scss
200
202
  - app/assets/stylesheets/plug/blocks/_state.scss
203
+ - app/assets/stylesheets/plug/blocks/_task-button.scss
201
204
  - app/assets/stylesheets/plug/foundation_and_overrides.scss
202
205
  - app/assets/stylesheets/plug/milligram.scss
203
206
  - app/assets/stylesheets/plug/mixins/_bem.scss
@@ -214,6 +217,7 @@ files:
214
217
  - app/models/plug/feature.rb
215
218
  - app/views/layouts/plug/application.html.haml
216
219
  - app/views/plug/features/_form.html.haml
220
+ - app/views/plug/features/_task.html.haml
217
221
  - app/views/plug/features/edit.html.haml
218
222
  - app/views/plug/features/index.html.haml
219
223
  - app/views/plug/features/new.html.haml
@@ -250,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
254
  version: '0'
251
255
  requirements: []
252
256
  rubyforge_project:
253
- rubygems_version: 2.6.13
257
+ rubygems_version: 2.6.11
254
258
  signing_key:
255
259
  specification_version: 4
256
260
  summary: Rails engine that can plug/unplug features