railties 6.1.7.9 → 7.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -468
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +16 -16
- data/README.rdoc +0 -1
- data/lib/rails/app_updater.rb +2 -4
- data/lib/rails/application/bootstrap.rb +17 -5
- data/lib/rails/application/configuration.rb +52 -31
- data/lib/rails/application/default_middleware_stack.rb +6 -3
- data/lib/rails/application/finisher.rb +43 -85
- data/lib/rails/application/routes_reloader.rb +8 -0
- data/lib/rails/application.rb +24 -50
- data/lib/rails/application_controller.rb +2 -2
- data/lib/rails/autoloaders/inflector.rb +21 -0
- data/lib/rails/autoloaders.rb +12 -16
- data/lib/rails/code_statistics.rb +2 -2
- data/lib/rails/code_statistics_calculator.rb +10 -1
- data/lib/rails/command/base.rb +26 -12
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/command.rb +8 -5
- data/lib/rails/commands/credentials/USAGE +4 -2
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +26 -16
- data/lib/rails/commands/credentials/credentials_command.rb +6 -2
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +16 -15
- data/lib/rails/commands/help/USAGE +3 -2
- data/lib/rails/commands/runner/runner_command.rb +3 -2
- data/lib/rails/commands/server/server_command.rb +2 -5
- data/lib/rails/configuration.rb +18 -23
- data/lib/rails/engine/configuration.rb +2 -2
- data/lib/rails/engine.rb +23 -27
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/actions/create_migration.rb +2 -4
- data/lib/rails/generators/actions.rb +35 -13
- data/lib/rails/generators/app_base.rb +66 -102
- data/lib/rails/generators/app_name.rb +1 -1
- data/lib/rails/generators/base.rb +9 -13
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +5 -27
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +20 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +7 -16
- data/lib/rails/generators/erb.rb +1 -1
- data/lib/rails/generators/generated_attribute.rb +40 -4
- data/lib/rails/generators/migration.rb +2 -6
- data/lib/rails/generators/model_helpers.rb +1 -1
- data/lib/rails/generators/named_base.rb +1 -1
- data/lib/rails/generators/rails/app/app_generator.rb +44 -88
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +41 -52
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +3 -10
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +1 -4
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +0 -3
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -14
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -11
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +9 -15
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +2 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +85 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +3 -3
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +0 -5
- data/lib/rails/generators/rails/app/templates/gitignore.tt +0 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -2
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +0 -4
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +40 -15
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +4 -2
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +9 -9
- data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -5
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +3 -3
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +0 -19
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -5
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +6 -10
- data/lib/rails/generators/resource_helpers.rb +2 -2
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +5 -5
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +3 -3
- data/lib/rails/generators/testing/behaviour.rb +1 -2
- data/lib/rails/generators.rb +9 -22
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -3
- data/lib/rails/initializable.rb +1 -1
- data/lib/rails/mailers_controller.rb +2 -4
- data/lib/rails/rack/logger.rb +0 -1
- data/lib/rails/railtie/configuration.rb +1 -2
- data/lib/rails/railtie.rb +9 -9
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/secrets.rb +8 -10
- data/lib/rails/tasks/framework.rake +2 -8
- data/lib/rails/tasks/statistics.rake +3 -1
- data/lib/rails/tasks/tmp.rake +8 -1
- data/lib/rails/tasks/yarn.rake +5 -1
- data/lib/rails/tasks/zeitwerk.rake +2 -10
- data/lib/rails/templates/layouts/application.html.erb +15 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +12 -10
- data/lib/rails/templates/rails/welcome/index.html.erb +3 -0
- data/lib/rails/test_unit/railtie.rb +0 -4
- data/lib/rails/test_unit/runner.rb +7 -5
- data/lib/rails/test_unit/testing.rake +4 -9
- data/lib/rails.rb +1 -0
- metadata +34 -36
- data/lib/rails/command/spellchecker.rb +0 -57
- data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +0 -13
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +0 -67
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
- data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
- data/lib/rails/generators/rails/assets/USAGE +0 -16
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module Command
|
5
|
-
module Spellchecker # :nodoc:
|
6
|
-
class << self
|
7
|
-
def suggest(word, from:)
|
8
|
-
if defined?(DidYouMean::SpellChecker)
|
9
|
-
DidYouMean::SpellChecker.new(dictionary: from.map(&:to_s)).correct(word).first
|
10
|
-
else
|
11
|
-
from.sort_by { |w| levenshtein_distance(word, w) }.first
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
# This code is based directly on the Text gem implementation.
|
17
|
-
# Copyright (c) 2006-2013 Paul Battley, Michael Neumann, Tim Fletcher.
|
18
|
-
#
|
19
|
-
# Returns a value representing the "cost" of transforming str1 into str2.
|
20
|
-
def levenshtein_distance(str1, str2) # :doc:
|
21
|
-
s = str1
|
22
|
-
t = str2
|
23
|
-
n = s.length
|
24
|
-
m = t.length
|
25
|
-
|
26
|
-
return m if 0 == n
|
27
|
-
return n if 0 == m
|
28
|
-
|
29
|
-
d = (0..m).to_a
|
30
|
-
x = nil
|
31
|
-
|
32
|
-
# avoid duplicating an enumerable object in the loop
|
33
|
-
str2_codepoint_enumerable = str2.each_codepoint
|
34
|
-
|
35
|
-
str1.each_codepoint.with_index do |char1, i|
|
36
|
-
e = i + 1
|
37
|
-
|
38
|
-
str2_codepoint_enumerable.with_index do |char2, j|
|
39
|
-
cost = (char1 == char2) ? 0 : 1
|
40
|
-
x = [
|
41
|
-
d[j + 1] + 1, # insertion
|
42
|
-
e + 1, # deletion
|
43
|
-
d[j] + cost # substitution
|
44
|
-
].min
|
45
|
-
d[j] = e
|
46
|
-
e = x
|
47
|
-
end
|
48
|
-
|
49
|
-
d[m] = x
|
50
|
-
end
|
51
|
-
|
52
|
-
x
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/named_base"
|
4
|
-
|
5
|
-
module Css # :nodoc:
|
6
|
-
module Generators # :nodoc:
|
7
|
-
class AssetsGenerator < Rails::Generators::NamedBase # :nodoc:
|
8
|
-
source_root File.expand_path("templates", __dir__)
|
9
|
-
|
10
|
-
def copy_stylesheet
|
11
|
-
copy_file "stylesheet.css", File.join("app/assets/stylesheets", class_path, "#{file_name}.css")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/named_base"
|
4
|
-
|
5
|
-
module Css # :nodoc:
|
6
|
-
module Generators # :nodoc:
|
7
|
-
class ScaffoldGenerator < Rails::Generators::NamedBase # :nodoc:
|
8
|
-
source_root Rails::Generators::ScaffoldGenerator.source_root
|
9
|
-
|
10
|
-
# In order to allow the Sass generators to pick up the default Rails CSS and
|
11
|
-
# transform it, we leave it in a standard location for the CSS stylesheet
|
12
|
-
# generators to handle. For the simple, default case, just copy it over.
|
13
|
-
def copy_stylesheet
|
14
|
-
copy_file "scaffold.css", "app/assets/stylesheets/scaffold.css"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
-
// You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
|
3
|
-
|
4
|
-
import { createConsumer } from "@rails/actioncable"
|
5
|
-
|
6
|
-
export default createConsumer()
|
@@ -1,23 +0,0 @@
|
|
1
|
-
// This file is automatically compiled by Webpack, along with any other files
|
2
|
-
// present in this directory. You're encouraged to place your actual application logic in
|
3
|
-
// a relevant structure within app/javascript and only use these pack files to reference
|
4
|
-
// that code so it'll be compiled.
|
5
|
-
|
6
|
-
import Rails from "@rails/ujs"
|
7
|
-
<%- unless options[:skip_turbolinks] -%>
|
8
|
-
import Turbolinks from "turbolinks"
|
9
|
-
<%- end -%>
|
10
|
-
<%- unless skip_active_storage? -%>
|
11
|
-
import * as ActiveStorage from "@rails/activestorage"
|
12
|
-
<%- end -%>
|
13
|
-
<%- unless options[:skip_action_cable] -%>
|
14
|
-
import "channels"
|
15
|
-
<%- end -%>
|
16
|
-
|
17
|
-
Rails.start()
|
18
|
-
<%- unless options[:skip_turbolinks] -%>
|
19
|
-
Turbolinks.start()
|
20
|
-
<%- end -%>
|
21
|
-
<%- unless skip_active_storage? -%>
|
22
|
-
ActiveStorage.start()
|
23
|
-
<%- end -%>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
|
2
|
-
gem "bundler"
|
3
|
-
require "bundler"
|
4
|
-
|
5
|
-
# Load Spring without loading other gems in the Gemfile, for speed.
|
6
|
-
Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
|
7
|
-
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
8
|
-
gem "spring", spring.version
|
9
|
-
require "spring/binstub"
|
10
|
-
rescue Gem::LoadError
|
11
|
-
# Ignore when Spring is not installed.
|
12
|
-
end
|
13
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
2
|
-
Dir.chdir(APP_ROOT) do
|
3
|
-
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
|
4
|
-
select { |dir| File.expand_path(dir) != __dir__ }.
|
5
|
-
product(["yarn", "yarn.cmd", "yarn.ps1"]).
|
6
|
-
map { |dir, file| File.expand_path(file, dir) }.
|
7
|
-
find { |file| File.executable?(file) }
|
8
|
-
|
9
|
-
if yarn
|
10
|
-
exec yarn, *ARGV
|
11
|
-
else
|
12
|
-
$stderr.puts "Yarn executable was not detected in the system."
|
13
|
-
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
14
|
-
exit 1
|
15
|
-
end
|
16
|
-
end
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains migration options to ease your Rails 6.1 upgrade.
|
4
|
-
#
|
5
|
-
# Once upgraded flip defaults one by one to migrate to the new default.
|
6
|
-
#
|
7
|
-
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
8
|
-
|
9
|
-
# Support for inversing belongs_to -> has_many Active Record associations.
|
10
|
-
# Rails.application.config.active_record.has_many_inversing = true
|
11
|
-
|
12
|
-
# Track Active Storage variants in the database.
|
13
|
-
# Rails.application.config.active_storage.track_variants = true
|
14
|
-
|
15
|
-
# Apply random variation to the delay when retrying failed jobs.
|
16
|
-
# Rails.application.config.active_job.retry_jitter = 0.15
|
17
|
-
|
18
|
-
# Stop executing `after_enqueue`/`after_perform` callbacks if
|
19
|
-
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
|
20
|
-
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
|
21
|
-
|
22
|
-
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
|
23
|
-
#
|
24
|
-
# This change is not backwards compatible with earlier Rails versions.
|
25
|
-
# It's best enabled when your entire app is migrated and stable on 6.1.
|
26
|
-
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
|
27
|
-
|
28
|
-
# Generate CSRF tokens that are encoded in URL-safe Base64.
|
29
|
-
#
|
30
|
-
# This change is not backwards compatible with earlier Rails versions.
|
31
|
-
# It's best enabled when your entire app is migrated and stable on 6.1.
|
32
|
-
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
|
33
|
-
|
34
|
-
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
|
35
|
-
# UTC offset or a UTC time.
|
36
|
-
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
|
37
|
-
|
38
|
-
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
|
39
|
-
# requests to HTTPS in `ActionDispatch::SSL` middleware.
|
40
|
-
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
|
41
|
-
|
42
|
-
# Use new connection handling API. For most applications this won't have any
|
43
|
-
# effect. For applications using multiple databases, this new API provides
|
44
|
-
# support for granular connection swapping.
|
45
|
-
# Rails.application.config.active_record.legacy_connection_handling = false
|
46
|
-
|
47
|
-
# Make `form_with` generate non-remote forms by default.
|
48
|
-
# Rails.application.config.action_view.form_with_generates_remote_forms = false
|
49
|
-
|
50
|
-
# Set the default queue name for the analysis job to the queue adapter default.
|
51
|
-
# Rails.application.config.active_storage.queues.analysis = nil
|
52
|
-
|
53
|
-
# Set the default queue name for the purge job to the queue adapter default.
|
54
|
-
# Rails.application.config.active_storage.queues.purge = nil
|
55
|
-
|
56
|
-
# Set the default queue name for the incineration job to the queue adapter default.
|
57
|
-
# Rails.application.config.action_mailbox.queues.incineration = nil
|
58
|
-
|
59
|
-
# Set the default queue name for the routing job to the queue adapter default.
|
60
|
-
# Rails.application.config.action_mailbox.queues.routing = nil
|
61
|
-
|
62
|
-
# Set the default queue name for the mail deliver job to the queue adapter default.
|
63
|
-
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
|
64
|
-
|
65
|
-
# Generate a `Link` header that gives a hint to modern browsers about
|
66
|
-
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
|
67
|
-
# Rails.application.config.action_view.preload_links_header = true
|
@@ -1,11 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "<%= app_name.underscore.dasherize %>",
|
3
|
-
"private": true,
|
4
|
-
"dependencies": {
|
5
|
-
"@rails/ujs": "^6.0.0"<% unless options[:skip_turbolinks] %>,
|
6
|
-
"turbolinks": "^5.2.0"<% end -%><% unless skip_active_storage? %>,
|
7
|
-
"@rails/activestorage": "^6.0.0"<% end -%><% unless options[:skip_action_cable] %>,
|
8
|
-
"@rails/actioncable": "^6.0.0"<% end %>
|
9
|
-
},
|
10
|
-
"version": "0.1.0"
|
11
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Generates new asset placeholders. Pass the asset name, either CamelCased
|
3
|
-
or under_scored.
|
4
|
-
|
5
|
-
To create an asset within a folder, specify the asset's name as a
|
6
|
-
path like 'parent/name'.
|
7
|
-
|
8
|
-
This generates a stylesheet stub in app/assets/stylesheets.
|
9
|
-
|
10
|
-
If Sass 3 is available, stylesheets will be generated with the .scss extension.
|
11
|
-
|
12
|
-
Example:
|
13
|
-
`bin/rails generate assets posts`
|
14
|
-
|
15
|
-
Posts assets.
|
16
|
-
Stylesheet: app/assets/stylesheets/posts.css
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module Generators
|
5
|
-
class AssetsGenerator < NamedBase # :nodoc:
|
6
|
-
class_option :javascripts, type: :boolean, desc: "Generate JavaScripts"
|
7
|
-
class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"
|
8
|
-
|
9
|
-
class_option :javascript_engine, desc: "Engine for JavaScripts"
|
10
|
-
class_option :stylesheet_engine, desc: "Engine for Stylesheets"
|
11
|
-
|
12
|
-
private
|
13
|
-
def asset_name
|
14
|
-
file_name
|
15
|
-
end
|
16
|
-
|
17
|
-
hook_for :javascript_engine do |javascript_engine|
|
18
|
-
invoke javascript_engine, [name] if options[:javascripts]
|
19
|
-
end
|
20
|
-
|
21
|
-
hook_for :stylesheet_engine do |stylesheet_engine|
|
22
|
-
invoke stylesheet_engine, [name] if options[:stylesheets]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,80 +0,0 @@
|
|
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
|
-
}
|