buoys 1.1.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/lib/buoys/buoy.rb +3 -2
- data/lib/buoys/config.rb +1 -3
- data/lib/buoys/loader.rb +1 -1
- data/lib/buoys/railtie.rb +1 -1
- data/lib/buoys/version.rb +1 -1
- data/lib/generators/buoys/templates/_buoys.html.erb +1 -1
- data/lib/generators/buoys/templates/breadcrumbs.rb +1 -1
- data/test/buoys_buoy_test.rb +17 -1
- data/test/buoys_generator_test.rb +2 -2
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/javascripts/application.js +3 -1
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +3 -3
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/item.rb +1 -1
- data/test/dummy/app/models/user.rb +1 -1
- data/test/dummy/app/views/layouts/application.html.erb +10 -9
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +1 -1
- data/test/dummy/bin/rails +1 -1
- data/test/dummy/bin/setup +20 -13
- data/test/dummy/bin/update +31 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +9 -21
- data/test/dummy/config/boot.rb +2 -4
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +1 -1
- data/test/dummy/config/environment.rb +1 -3
- data/test/dummy/config/environments/development.rb +31 -13
- data/test/dummy/config/environments/production.rb +31 -18
- data/test/dummy/config/environments/test.rb +10 -13
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +6 -5
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -2
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -2
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -2
- data/test/dummy/config/initializers/inflections.rb +0 -2
- data/test/dummy/config/initializers/mime_types.rb +0 -2
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -4
- data/test/dummy/config/locales/en.yml +10 -0
- data/test/dummy/config/puma.rb +37 -0
- data/test/dummy/config/routes.rb +2 -2
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +2 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +129 -0
- data/test/dummy/log/test.log +486 -263
- data/test/dummy/package.json +5 -0
- data/test/dummy/public/404.html +6 -6
- data/test/dummy/public/422.html +6 -6
- data/test/dummy/public/500.html +6 -6
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/tmp/development_secret.txt +1 -0
- data/test/test_helper.rb +4 -5
- metadata +101 -47
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/config/initializers/session_store.rb +0 -5
- data/test/dummy/config/secrets.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7206430f425484e8e75b8cd16a49b6a737dafdc54486dfc7d803d1cd06a05b91
|
4
|
+
data.tar.gz: 170521a71be7ff33dd3d1a29a377f3e8dc2f2993debae6273e0ef3dc01249cd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126f9ac46f9f98f28e24cdb3566c9ebc3d997c8e55f793ebc3e2545b1821e74944123748d02b6b36396b35d93f91b90bdb8afab2891f8d2502564aba60a09fbb
|
7
|
+
data.tar.gz: 153b7a25618e75baa83a554cacee3d97ef68adf320591c1bb1d20838655b0c067fb34a8a727b1def1f6b6958535d8c8e95a79046e9e7661af34755bde03276b3
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ buoy :story do |story|
|
|
60
60
|
# same as `link I18n.t('story', scope: 'buoys.breadcrumbs', default: 'story'), story_path(story)`
|
61
61
|
end
|
62
62
|
|
63
|
-
# You can
|
63
|
+
# You can also override Buoys configuration
|
64
64
|
# ex)
|
65
65
|
buoy :story_tasks do |story|
|
66
66
|
link :story_tasks, story_tasks_path
|
data/Rakefile
CHANGED
data/lib/buoys/buoy.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module Buoys
|
4
4
|
class Buoy
|
5
5
|
attr_reader :previous, :context
|
6
|
+
|
6
7
|
# buoy :account do
|
7
8
|
# link 'Account', account_path
|
8
9
|
# end
|
@@ -40,8 +41,8 @@ module Buoys
|
|
40
41
|
end
|
41
42
|
alias parent pre_buoy
|
42
43
|
|
43
|
-
def method_missing(method, *args, &block)
|
44
|
-
context.send(method, *args, &block)
|
44
|
+
def method_missing(method, *args, **kwargs, &block)
|
45
|
+
context.send(method, *args, **kwargs, &block)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
data/lib/buoys/config.rb
CHANGED
data/lib/buoys/loader.rb
CHANGED
data/lib/buoys/railtie.rb
CHANGED
data/lib/buoys/version.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
<span itemprop='name'><%= link.text %></span>
|
8
8
|
<meta itemprop='position' content='<%= i %>' />
|
9
9
|
<% else %>
|
10
|
-
<%= link_to link.
|
10
|
+
<%= link_to link.url, link.options.merge(itemprop: :item) do %>
|
11
11
|
<span itemprop='name'><%= link.text %></span>
|
12
12
|
<% end %>
|
13
13
|
<meta itemprop='position' content='<%= i %>' />
|
data/test/buoys_buoy_test.rb
CHANGED
@@ -4,7 +4,11 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
class BuoysBuoyTest < ActiveSupport::TestCase
|
6
6
|
setup do
|
7
|
-
@view_context = ActionView::Base.
|
7
|
+
@view_context = if ActionView::Base.respond_to?(:empty)
|
8
|
+
ActionView::Base.empty
|
9
|
+
else
|
10
|
+
ActionView::Base.new # Rails 5.2 or lower
|
11
|
+
end
|
8
12
|
Buoys::Loader.load_buoys_files
|
9
13
|
end
|
10
14
|
|
@@ -29,4 +33,16 @@ class BuoysBuoyTest < ActiveSupport::TestCase
|
|
29
33
|
assert_equal links[0].text, 'Account'
|
30
34
|
assert_equal links[0].url, 'http://example.com/account'
|
31
35
|
end
|
36
|
+
|
37
|
+
test 'delegate unknown methods to view context' do
|
38
|
+
def @view_context.hello(arg, kwarg:, &block)
|
39
|
+
[arg, kwarg, block]
|
40
|
+
end
|
41
|
+
|
42
|
+
arg, kwarg, block = Buoys::Buoy.new(@view_context, :account).hello('hello', kwarg: ',') { 'world' }
|
43
|
+
|
44
|
+
assert_equal arg, 'hello'
|
45
|
+
assert_equal kwarg, ','
|
46
|
+
assert_equal block.call, 'world'
|
47
|
+
end
|
32
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable Style/RegexpLiteral,
|
3
|
+
# rubocop:disable Style/RegexpLiteral, Layout/LineLength
|
4
4
|
require 'test_helper'
|
5
5
|
require 'generators/buoys/install_generator'
|
6
6
|
|
@@ -51,4 +51,4 @@ class BuoysGeneratorTest < Rails::Generators::TestCase
|
|
51
51
|
assert_file File.expand_path('./config/locales/buoys.en.yml', dest_root)
|
52
52
|
end
|
53
53
|
end
|
54
|
-
# rubocop:enable Style/RegexpLiteral,
|
54
|
+
# rubocop:enable Style/RegexpLiteral, Layout/LineLength
|
data/test/dummy/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
|
4
|
-
|
4
|
+
require_relative 'config/application'
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
@@ -5,9 +5,11 @@
|
|
5
5
|
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
6
|
//
|
7
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.
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
9
|
//
|
10
10
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
13
15
|
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -6,9 +6,9 @@
|
|
6
6
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
7
|
*
|
8
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
|
10
|
-
*
|
11
|
-
* file per style scope.
|
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
12
|
*
|
13
13
|
*= require_tree .
|
14
14
|
*= require_self
|
@@ -1,14 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
10
7
|
|
11
|
-
<%=
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
|
+
<%= javascript_include_tag 'application' %>
|
10
|
+
</head>
|
12
11
|
|
13
|
-
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
14
15
|
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/test/dummy/bin/bundle
CHANGED
data/test/dummy/bin/rails
CHANGED
data/test/dummy/bin/setup
CHANGED
@@ -1,29 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require '
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
3
4
|
|
4
5
|
# path to your application root.
|
5
|
-
APP_ROOT =
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
6
7
|
|
7
|
-
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
8
13
|
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
10
19
|
|
11
|
-
|
12
|
-
system
|
13
|
-
system "bundle check || bundle install"
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
21
|
+
# system('bin/yarn')
|
14
22
|
|
15
23
|
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?(
|
17
|
-
#
|
24
|
+
# unless File.exist?('config/database.yml')
|
25
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
18
26
|
# end
|
19
27
|
|
20
28
|
puts "\n== Preparing database =="
|
21
|
-
system
|
29
|
+
system! 'bin/rails db:setup'
|
22
30
|
|
23
31
|
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system
|
25
|
-
system "rm -rf tmp/cache"
|
32
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
33
|
|
27
34
|
puts "\n== Restarting application server =="
|
28
|
-
system
|
35
|
+
system! 'bin/rails restart'
|
29
36
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a way to update your development environment automatically.
|
14
|
+
# Add necessary update steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
21
|
+
# system('bin/yarn')
|
22
|
+
|
23
|
+
puts "\n== Updating database =="
|
24
|
+
system! 'bin/rails db:migrate'
|
25
|
+
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
27
|
+
system! 'bin/rails log:clear tmp:clear'
|
28
|
+
|
29
|
+
puts "\n== Restarting application server =="
|
30
|
+
system! 'bin/rails restart'
|
31
|
+
end
|
data/test/dummy/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(APP_ROOT) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg", *ARGV
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
@@ -1,31 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.expand_path('../boot', __FILE__)
|
1
|
+
require_relative 'boot'
|
4
2
|
|
5
3
|
require 'rails/all'
|
6
4
|
|
7
5
|
Bundler.require(*Rails.groups)
|
8
|
-
require
|
6
|
+
require "buoys"
|
9
7
|
|
10
8
|
module Dummy
|
11
9
|
class Application < Rails::Application
|
12
|
-
#
|
13
|
-
|
14
|
-
# -- all .rb files in that directory are automatically loaded.
|
15
|
-
|
16
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
17
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
18
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
10
|
+
# Initialize configuration defaults for originally generated Rails version.
|
11
|
+
config.load_defaults 5.2
|
19
12
|
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
26
|
-
if Gem::Version.new(Rails.version) >= Gem::Version.new('4.2.0') &&
|
27
|
-
Gem::Version.new(Rails.version) <= Gem::Version.new('5.0.0')
|
28
|
-
config.active_record.raise_in_transactional_callbacks = true
|
29
|
-
end
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration can go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
16
|
+
# the framework and any gems in your application.
|
30
17
|
end
|
31
18
|
end
|
19
|
+
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
# Set up gems listed in the Gemfile.
|
4
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
5
3
|
|
6
4
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
7
|
-
$LOAD_PATH.unshift File.expand_path('
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
Rails.application.configure do
|
4
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
5
3
|
|
@@ -11,33 +9,53 @@ Rails.application.configure do
|
|
11
9
|
# Do not eager load code on boot.
|
12
10
|
config.eager_load = false
|
13
11
|
|
14
|
-
# Show full error reports
|
15
|
-
config.consider_all_requests_local
|
16
|
-
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
# Run rails dev:cache to toggle caching.
|
17
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
|
+
config.action_controller.perform_caching = true
|
19
|
+
|
20
|
+
config.cache_store = :memory_store
|
21
|
+
config.public_file_server.headers = {
|
22
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
23
|
+
}
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
config.cache_store = :null_store
|
28
|
+
end
|
29
|
+
|
30
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
31
|
+
config.active_storage.service = :local
|
17
32
|
|
18
33
|
# Don't care if the mailer can't send.
|
19
34
|
config.action_mailer.raise_delivery_errors = false
|
20
35
|
|
36
|
+
config.action_mailer.perform_caching = false
|
37
|
+
|
21
38
|
# Print deprecation notices to the Rails logger.
|
22
39
|
config.active_support.deprecation = :log
|
23
40
|
|
24
41
|
# Raise an error on page load if there are pending migrations.
|
25
42
|
config.active_record.migration_error = :page_load
|
26
43
|
|
44
|
+
# Highlight code that triggered database queries in logs.
|
45
|
+
config.active_record.verbose_query_logs = true
|
46
|
+
|
27
47
|
# Debug mode disables concatenation and preprocessing of assets.
|
28
48
|
# This option may cause significant delays in view rendering with a large
|
29
49
|
# number of complex assets.
|
30
50
|
config.assets.debug = true
|
31
51
|
|
32
|
-
#
|
33
|
-
|
34
|
-
config.assets.digest = true
|
35
|
-
|
36
|
-
# Adds additional error checking when serving assets at runtime.
|
37
|
-
# Checks for improperly declared sprockets dependencies.
|
38
|
-
# Raises helpful error messages.
|
39
|
-
config.assets.raise_runtime_errors = true
|
52
|
+
# Suppress logger output for asset requests.
|
53
|
+
config.assets.quiet = true
|
40
54
|
|
41
55
|
# Raises error for missing translations
|
42
56
|
# config.action_view.raise_on_missing_translations = true
|
57
|
+
|
58
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
59
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
60
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
43
61
|
end
|