bard-static 2.5.0 → 3.1.1

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
- SHA1:
3
- metadata.gz: 8d3eff103b9d52769e649c7ecae01bef27515bf3
4
- data.tar.gz: 9a8f7e2a5222778d878a49bfeccae515d5c22f5e
2
+ SHA256:
3
+ metadata.gz: f5c0a15784402a02d998d165b0874b30b9f5fcd16bae4e4e42141956ecae5105
4
+ data.tar.gz: 1cddd42f5dae9577077cfeb7ab4dfb45c0baeb0bf8b651e0f1e3bfa03dcacf81
5
5
  SHA512:
6
- metadata.gz: 4da0839166fbab55d856827bd415ee91082cdae6ff0579c85664c29a7fa4ce798d2538b38923df1b61ed8c942c08bab9142303f5dab234dc0128841d61ba20ee
7
- data.tar.gz: 9d462ade5f65a72e0e6a5411f7804fa24826b6933899a590e0823c0a52d92bb340e309b4a2aaeea03a755f0a85f300bff25a8e2a140ff5c55f6d70a86215f4f4
6
+ metadata.gz: 626a7c99080a7c1a8d73b0e9ea0280fd1e9d55fa746b9a50d6f8b2c7ea8761e7971d105be39ef1d84585d3a63ad222b0843f334cf22edf995ddb08b26ac8d2aa
7
+ data.tar.gz: be8e49f33a4cca5f4a4caaf9ba06ac01cfee7ff3c11ebdc98c1d967a9410bfb4632191e048b48563e9db533e7eb182f5a5d94ab198ac4205d41b087be42d38a2
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails"
3
+ gem "rails", "~> 5.0"
4
4
  gem "rake"
5
5
  gem "capybara"
6
6
  gem "rspec-rails"
7
+ gem "byebug"
8
+ gem "appraisal"
7
9
 
data/README.md CHANGED
@@ -14,6 +14,9 @@ Bard::Static
14
14
  || ||
15
15
 
16
16
 
17
+ [![CI Status](https://github.com/botandrose/bard-static/workflows/CI/badge.svg?branch=master)](https://github.com/botandrose/bard-static/actions?query=workflow%3ACI+branch%3Amaster)
18
+ [![Code Climate](https://codeclimate.com/github/botandrose/bard-static/badges/gpa.svg)](https://codeclimate.com/github/botandrose/bard-static)
19
+
17
20
  Installation
18
21
  ------------
19
22
 
@@ -48,15 +51,12 @@ if you like.
48
51
 
49
52
  All available Rails helpers work nicely. Pure prototyping bliss!
50
53
 
54
+ Helpers
55
+ -------
51
56
 
52
- Hooks
53
- -----
54
-
55
- BardStatic let's you add a `#before_bard_static` method in
56
- `ApplicationController`, that will be run before any prototype. You can
57
- use it, for example, to provide authentication or prevent prototypes
58
- from being rendered in production.
59
-
57
+ `mockup_form_for`: create a dummy form using rails form helpers
58
+ `link_to_current`: adds a `current` class if the current url matches the link
59
+ `link_to_nav`: same as `link_to_current` but also matches if the current url is a child of the link
60
60
 
61
61
  Gotchas
62
62
  -------
@@ -64,3 +64,4 @@ Gotchas
64
64
  When rendering a partial, you must specify the full path
65
65
  (e.g. `mockups/posts/form`) unless the partial is in
66
66
  `app/views/mockups/`.
67
+
@@ -1,19 +1,14 @@
1
1
  module Bard
2
2
  module Static
3
3
  class StaticController < ApplicationController
4
- skip_before_action :verify_authenticity_token
5
-
6
- before_action :before_bard_static,
7
- :if => proc { respond_to?(:before_bard_static, true) }
8
-
9
4
  def mockups
10
5
  request.env["bard_static.prototype"] = true
11
- with_404_handler { render_with_index "mockups/#{params[:file_path]}", :layout => false }
6
+ with_404_handler { render_with_index "mockups/#{params[:file_path]}", layout: false }
12
7
  end
13
8
 
14
9
  def static
15
10
  layout = !request.xhr? # render ajax responses with no layout
16
- with_404_handler { render_with_index "static/#{params[:file_path]}", :layout => layout }
11
+ with_404_handler { render_with_index "static/#{params[:file_path]}", layout: layout }
17
12
  end
18
13
 
19
14
  private
@@ -22,14 +17,14 @@ module Bard
22
17
  begin
23
18
  yield
24
19
  rescue ActionView::MissingTemplate
25
- render :text => "Not Found", :status => 404
20
+ render text: "Not Found", status: 404
26
21
  end
27
22
  end
28
23
 
29
24
  def render_with_index path, options = {}
30
25
  begin
31
26
  options = options.dup # render is destructive to the options hash!
32
- options = options.merge(:template => path)
27
+ options = options.merge(template: path)
33
28
  render options
34
29
  rescue ActionView::MissingTemplate
35
30
  options[:template] = "#{path}/index"
data/config/routes.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  Rails.application.routes.draw do
2
- namespace "mockups", :module => "bard/static" do
3
- root :to => "static#mockups", :file_path => "index"
2
+ namespace "mockups", module: "bard/static" do
3
+ root to: "static#mockups", file_path: "index"
4
4
  get "/*file_path" => "static#mockups"
5
5
  end
6
- root :to => "bard/static/static#static", :file_path => "index", :as => "bard_static_default_root"
7
- get "*file_path" => "bard/static/static#static", :constraints => (lambda do |request|
8
- lookup_context = ActionView::Base.new("app/views/static").lookup_context
6
+ root to: "bard/static/static#static", file_path: "index", as: "bard_static_default_root"
7
+ get "*file_path" => "bard/static/static#static", constraints: ->(request){
8
+ lookup_context = ActionView::LookupContext.new([Rails.root.join("app/views/static")])
9
9
  lookup_context.exists?(request.path) || lookup_context.exists?(request.path + "/index")
10
- end)
10
+ }
11
11
  end
12
+
@@ -1,5 +1,5 @@
1
1
  module Bard
2
2
  module Static
3
- VERSION = "2.5.0"
3
+ VERSION = "3.1.1"
4
4
  end
5
5
  end
data/lib/bard/static.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "bard/static/no_robots_middleware"
2
+ require_relative "../../app/helpers/bard/static/mockup_helper"
2
3
 
3
4
  module Bard
4
5
  module Static
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-static
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-11-23 00:00:00.000000000 Z
15
+ date: 2022-03-16 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: Handcrafted prototypes for Rails.
18
18
  email:
@@ -52,8 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  requirements: []
55
- rubyforge_project:
56
- rubygems_version: 2.4.8
55
+ rubygems_version: 3.2.3
57
56
  signing_key:
58
57
  specification_version: 4
59
58
  summary: Protoyping engine for Rails.