railties 6.0.3.3 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +234 -370
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +16 -1
- data/lib/rails.rb +5 -8
- data/lib/rails/application.rb +49 -83
- data/lib/rails/application/bootstrap.rb +5 -5
- data/lib/rails/application/configuration.rb +71 -21
- data/lib/rails/application/default_middleware_stack.rb +5 -3
- data/lib/rails/application/finisher.rb +15 -2
- data/lib/rails/application/routes_reloader.rb +9 -2
- data/lib/rails/backtrace_cleaner.rb +12 -7
- data/lib/rails/code_statistics.rb +3 -3
- data/lib/rails/code_statistics_calculator.rb +6 -6
- data/lib/rails/command.rb +7 -1
- data/lib/rails/command/base.rb +1 -1
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/commands/credentials/USAGE +17 -2
- data/lib/rails/commands/credentials/credentials_command.rb +28 -4
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
- data/lib/rails/commands/db/system/change/change_command.rb +6 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +61 -58
- data/lib/rails/commands/encrypted/encrypted_command.rb +4 -4
- data/lib/rails/commands/generate/generate_command.rb +1 -1
- data/lib/rails/commands/notes/notes_command.rb +1 -11
- data/lib/rails/commands/rake/rake_command.rb +9 -8
- data/lib/rails/commands/secrets/USAGE +9 -3
- data/lib/rails/commands/server/server_command.rb +14 -41
- data/lib/rails/commands/test/test_command.rb +2 -2
- data/lib/rails/configuration.rb +40 -10
- data/lib/rails/engine.rb +35 -32
- data/lib/rails/engine/configuration.rb +1 -0
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators.rb +29 -15
- data/lib/rails/generators/actions.rb +50 -29
- data/lib/rails/generators/actions/create_migration.rb +5 -0
- data/lib/rails/generators/app_base.rb +38 -21
- data/lib/rails/generators/base.rb +14 -11
- data/lib/rails/generators/database.rb +3 -4
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +3 -3
- data/lib/rails/generators/generated_attribute.rb +3 -9
- data/lib/rails/generators/migration.rb +2 -1
- data/lib/rails/generators/model_helpers.rb +26 -2
- data/lib/rails/generators/named_base.rb +1 -1
- data/lib/rails/generators/rails/app/USAGE +2 -1
- data/lib/rails/generators/rails/app/app_generator.rb +89 -15
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +11 -11
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +11 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +2 -1
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +4 -4
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +13 -0
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +9 -3
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +14 -7
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +3 -4
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +17 -3
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +15 -5
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +12 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +67 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +6 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +0 -1
- data/lib/rails/generators/rails/app/templates/package.json.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +5 -5
- data/lib/rails/generators/rails/assets/USAGE +2 -3
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +2 -2
- data/lib/rails/generators/rails/controller/controller_generator.rb +2 -40
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +4 -4
- data/lib/rails/generators/rails/model/USAGE +15 -16
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +25 -23
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +10 -19
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +13 -11
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -3
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/test_case.rb +1 -1
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/behaviour.rb +1 -1
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -1
- data/lib/rails/mailers_controller.rb +1 -0
- data/lib/rails/paths.rb +14 -6
- data/lib/rails/rack/logger.rb +1 -1
- data/lib/rails/railtie.rb +32 -10
- data/lib/rails/railtie/configuration.rb +3 -2
- data/lib/rails/source_annotation_extractor.rb +1 -15
- data/lib/rails/tasks.rb +0 -4
- data/lib/rails/tasks/engine.rake +1 -4
- data/lib/rails/tasks/framework.rake +7 -1
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/statistics.rake +1 -1
- data/lib/rails/tasks/yarn.rake +14 -2
- data/lib/rails/templates/rails/mailers/email.html.erb +1 -0
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
- data/lib/rails/test_unit/reporter.rb +2 -1
- data/lib/rails/test_unit/runner.rb +20 -3
- data/lib/rails/test_unit/testing.rake +6 -0
- metadata +27 -33
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -11
- data/lib/rails/tasks/initializers.rake +0 -9
- data/lib/rails/tasks/routes.rake +0 -9
@@ -1,9 +1,9 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new generator at lib/generators. Pass the generator name as an argument,
|
3
3
|
either CamelCased or snake_cased.
|
4
4
|
|
5
5
|
Example:
|
6
|
-
`rails generate generator Awesome`
|
6
|
+
`bin/rails generate generator Awesome`
|
7
7
|
|
8
8
|
creates a standard awesome generator:
|
9
9
|
lib/generators/awesome/
|
@@ -1,13 +1,12 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new helper. Pass the helper name, either CamelCased
|
3
3
|
or under_scored.
|
4
4
|
|
5
5
|
To create a helper within a module, specify the helper name as a
|
6
6
|
path like 'parent_module/helper_name'.
|
7
7
|
|
8
8
|
Example:
|
9
|
-
`rails generate helper CreditCard`
|
9
|
+
`bin/rails generate helper CreditCard`
|
10
10
|
|
11
11
|
Credit card helper.
|
12
12
|
Helper: app/helpers/credit_card_helper.rb
|
13
|
-
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new integration test. Pass the name of the test, either
|
3
3
|
CamelCased or under_scored, as an argument.
|
4
4
|
|
5
5
|
This generator invokes the current integration tool, which defaults to
|
6
6
|
TestUnit.
|
7
7
|
|
8
8
|
Example:
|
9
|
-
`rails generate integration_test GeneralStories` creates a GeneralStories
|
9
|
+
`bin/rails generate integration_test GeneralStories` creates a GeneralStories
|
10
10
|
integration test in test/integration/general_stories_test.rb
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new database migration. Pass the migration name, either
|
3
3
|
CamelCased or under_scored, and an optional list of attribute pairs as arguments.
|
4
4
|
|
5
5
|
A migration class is generated in db/migrate prefixed by a timestamp of the current date and time.
|
@@ -8,12 +8,12 @@ Description:
|
|
8
8
|
column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable
|
9
9
|
|
10
10
|
Example:
|
11
|
-
`rails generate migration AddSslFlag`
|
11
|
+
`bin/rails generate migration AddSslFlag`
|
12
12
|
|
13
13
|
If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration
|
14
14
|
db/migrate/20080514090912_add_ssl_flag.rb
|
15
15
|
|
16
|
-
`rails generate migration AddTitleBodyToPost title:string body:text published:boolean`
|
16
|
+
`bin/rails generate migration AddTitleBodyToPost title:string body:text published:boolean`
|
17
17
|
|
18
18
|
This will create the AddTitleBodyToPost in db/migrate/20080514090912_add_title_body_to_post.rb with this in the Change migration:
|
19
19
|
|
@@ -25,7 +25,7 @@ Migration names containing JoinTable will generate join tables for use with
|
|
25
25
|
has_and_belongs_to_many associations.
|
26
26
|
|
27
27
|
Example:
|
28
|
-
`rails g migration CreateMediaJoinTable artists musics:uniq`
|
28
|
+
`bin/rails g migration CreateMediaJoinTable artists musics:uniq`
|
29
29
|
|
30
30
|
will create the migration
|
31
31
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new model. Pass the model name, either CamelCased or
|
3
3
|
under_scored, and an optional list of attribute pairs as arguments.
|
4
4
|
|
5
5
|
Attribute pairs are field:type arguments specifying the
|
@@ -29,7 +29,7 @@ Available field types:
|
|
29
29
|
Just after the field name you can specify a type like text or boolean.
|
30
30
|
It will generate the column with the associated SQL type. For instance:
|
31
31
|
|
32
|
-
`rails generate model post title:string body:text`
|
32
|
+
`bin/rails generate model post title:string body:text`
|
33
33
|
|
34
34
|
will generate a title column with a varchar type and a body column with a text
|
35
35
|
type. If no type is specified the string type will be used by default.
|
@@ -49,47 +49,47 @@ Available field types:
|
|
49
49
|
|
50
50
|
You can also consider `references` as a kind of type. For instance, if you run:
|
51
51
|
|
52
|
-
`rails generate model photo title:string album:references`
|
52
|
+
`bin/rails generate model photo title:string album:references`
|
53
53
|
|
54
54
|
It will generate an `album_id` column. You should generate these kinds of fields when
|
55
55
|
you will use a `belongs_to` association, for instance. `references` also supports
|
56
56
|
polymorphism, you can enable polymorphism like this:
|
57
57
|
|
58
|
-
`rails generate model product supplier:references{polymorphic}`
|
58
|
+
`bin/rails generate model product supplier:references{polymorphic}`
|
59
59
|
|
60
60
|
For integer, string, text and binary fields, an integer in curly braces will
|
61
61
|
be set as the limit:
|
62
62
|
|
63
|
-
`rails generate model user pseudo:string{30}`
|
63
|
+
`bin/rails generate model user pseudo:string{30}`
|
64
64
|
|
65
65
|
For decimal, two integers separated by a comma in curly braces will be used
|
66
66
|
for precision and scale:
|
67
67
|
|
68
|
-
`rails generate model product 'price:decimal{10,2}'`
|
68
|
+
`bin/rails generate model product 'price:decimal{10,2}'`
|
69
69
|
|
70
70
|
You can add a `:uniq` or `:index` suffix for unique or standard indexes
|
71
71
|
respectively:
|
72
72
|
|
73
|
-
`rails generate model user pseudo:string:uniq`
|
74
|
-
`rails generate model user pseudo:string:index`
|
73
|
+
`bin/rails generate model user pseudo:string:uniq`
|
74
|
+
`bin/rails generate model user pseudo:string:index`
|
75
75
|
|
76
76
|
You can combine any single curly brace option with the index options:
|
77
77
|
|
78
|
-
`rails generate model user username:string{30}:uniq`
|
79
|
-
`rails generate model product supplier:references{polymorphic}:index`
|
78
|
+
`bin/rails generate model user username:string{30}:uniq`
|
79
|
+
`bin/rails generate model product supplier:references{polymorphic}:index`
|
80
80
|
|
81
81
|
If you require a `password_digest` string column for use with
|
82
82
|
has_secure_password, you can specify `password:digest`:
|
83
83
|
|
84
|
-
`rails generate model user password:digest`
|
84
|
+
`bin/rails generate model user password:digest`
|
85
85
|
|
86
86
|
If you require a `token` string column for use with
|
87
87
|
has_secure_token, you can specify `auth_token:token`:
|
88
88
|
|
89
|
-
`rails generate model user auth_token:token`
|
89
|
+
`bin/rails generate model user auth_token:token`
|
90
90
|
|
91
91
|
Examples:
|
92
|
-
`rails generate model account`
|
92
|
+
`bin/rails generate model account`
|
93
93
|
|
94
94
|
For Active Record and TestUnit it creates:
|
95
95
|
|
@@ -98,11 +98,11 @@ Examples:
|
|
98
98
|
Fixtures: test/fixtures/accounts.yml
|
99
99
|
Migration: db/migrate/XXX_create_accounts.rb
|
100
100
|
|
101
|
-
`rails generate model post title:string body:text published:boolean`
|
101
|
+
`bin/rails generate model post title:string body:text published:boolean`
|
102
102
|
|
103
103
|
Creates a Post model with a string title, text body, and published flag.
|
104
104
|
|
105
|
-
`rails generate model admin/account`
|
105
|
+
`bin/rails generate model admin/account`
|
106
106
|
|
107
107
|
For Active Record and TestUnit it creates:
|
108
108
|
|
@@ -111,4 +111,3 @@ Examples:
|
|
111
111
|
Test: test/models/admin/account_test.rb
|
112
112
|
Fixtures: test/fixtures/admin/accounts.yml
|
113
113
|
Migration: db/migrate/XXX_create_admin_accounts.rb
|
114
|
-
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/core_ext/hash/except"
|
3
4
|
require "rails/generators/rails/app/app_generator"
|
4
5
|
require "date"
|
5
6
|
|
@@ -24,10 +25,14 @@ module Rails
|
|
24
25
|
directory "app"
|
25
26
|
empty_directory_with_keep_file "app/assets/images/#{namespaced_name}"
|
26
27
|
end
|
28
|
+
|
29
|
+
remove_dir "app/mailers" if options[:skip_action_mailer]
|
30
|
+
remove_dir "app/jobs" if options[:skip_active_job]
|
27
31
|
elsif full?
|
28
32
|
empty_directory_with_keep_file "app/models"
|
29
33
|
empty_directory_with_keep_file "app/controllers"
|
30
|
-
empty_directory_with_keep_file "app/mailers"
|
34
|
+
empty_directory_with_keep_file "app/mailers" unless options[:skip_action_mailer]
|
35
|
+
empty_directory_with_keep_file "app/jobs" unless options[:skip_active_job]
|
31
36
|
|
32
37
|
unless api?
|
33
38
|
empty_directory_with_keep_file "app/assets/images/#{namespaced_name}"
|
@@ -57,6 +62,12 @@ module Rails
|
|
57
62
|
template "gitignore", ".gitignore"
|
58
63
|
end
|
59
64
|
|
65
|
+
def version_control
|
66
|
+
if !options[:skip_git] && !options[:pretend]
|
67
|
+
run "git init", capture: options[:quiet], abort_on_failure: false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
60
71
|
def lib
|
61
72
|
template "lib/%namespaced_name%.rb"
|
62
73
|
template "lib/tasks/%namespaced_name%_tasks.rake"
|
@@ -86,15 +97,13 @@ task default: :test
|
|
86
97
|
end
|
87
98
|
end
|
88
99
|
|
89
|
-
|
90
|
-
:skip_active_record, :skip_active_storage, :skip_action_mailer, :skip_javascript, :skip_action_cable, :skip_sprockets, :database,
|
91
|
-
:api, :quiet, :pretend, :skip
|
92
|
-
]
|
100
|
+
DUMMY_IGNORE_OPTIONS = %i[dev edge master template]
|
93
101
|
|
94
102
|
def generate_test_dummy(force = false)
|
95
|
-
opts =
|
103
|
+
opts = options.transform_keys(&:to_sym).except(*DUMMY_IGNORE_OPTIONS)
|
96
104
|
opts[:force] = force
|
97
105
|
opts[:skip_bundle] = true
|
106
|
+
opts[:skip_spring] = true
|
98
107
|
opts[:skip_listen] = true
|
99
108
|
opts[:skip_git] = true
|
100
109
|
opts[:skip_turbolinks] = true
|
@@ -107,7 +116,11 @@ task default: :test
|
|
107
116
|
|
108
117
|
def test_dummy_config
|
109
118
|
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
|
110
|
-
|
119
|
+
|
120
|
+
insert_into_file "#{dummy_path}/config/application.rb", <<~RUBY, after: /^Bundler\.require.+\n/
|
121
|
+
require #{namespaced_name.inspect}
|
122
|
+
RUBY
|
123
|
+
|
111
124
|
if mountable?
|
112
125
|
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
|
113
126
|
end
|
@@ -121,6 +134,7 @@ task default: :test
|
|
121
134
|
|
122
135
|
def test_dummy_clean
|
123
136
|
inside dummy_path do
|
137
|
+
remove_file ".ruby-version"
|
124
138
|
remove_file "db/seeds.rb"
|
125
139
|
remove_file "Gemfile"
|
126
140
|
remove_file "lib/tasks"
|
@@ -176,7 +190,7 @@ task default: :test
|
|
176
190
|
desc: "Generate a rails engine with bundled Rails application for testing"
|
177
191
|
|
178
192
|
class_option :mountable, type: :boolean, default: false,
|
179
|
-
desc: "Generate mountable isolated
|
193
|
+
desc: "Generate mountable isolated engine"
|
180
194
|
|
181
195
|
class_option :skip_gemspec, type: :boolean, default: false,
|
182
196
|
desc: "Skip gemspec file"
|
@@ -203,6 +217,7 @@ task default: :test
|
|
203
217
|
build(:license)
|
204
218
|
build(:gitignore) unless options[:skip_git]
|
205
219
|
build(:gemfile) unless options[:skip_gemfile]
|
220
|
+
build(:version_control)
|
206
221
|
end
|
207
222
|
|
208
223
|
def create_app_files
|
@@ -275,7 +290,6 @@ task default: :test
|
|
275
290
|
say_status :vendor_app, dummy_path
|
276
291
|
mute do
|
277
292
|
build(:generate_test_dummy)
|
278
|
-
store_application_definition!
|
279
293
|
build(:test_dummy_config)
|
280
294
|
build(:test_dummy_assets)
|
281
295
|
build(:test_dummy_clean)
|
@@ -375,25 +389,13 @@ task default: :test
|
|
375
389
|
end
|
376
390
|
end
|
377
391
|
|
378
|
-
def application_definition
|
379
|
-
@application_definition ||= begin
|
380
|
-
|
381
|
-
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
|
382
|
-
unless options[:pretend] || !File.exist?(dummy_application_path)
|
383
|
-
contents = File.read(dummy_application_path)
|
384
|
-
contents[(contents.index(/module ([\w]+)\n(.*)class Application/m))..-1]
|
385
|
-
end
|
386
|
-
end
|
387
|
-
end
|
388
|
-
alias :store_application_definition! :application_definition
|
389
|
-
|
390
392
|
def get_builder_class
|
391
393
|
defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder
|
392
394
|
end
|
393
395
|
|
394
396
|
def rakefile_test_tasks
|
395
397
|
<<-RUBY
|
396
|
-
require
|
398
|
+
require "rake/testtask"
|
397
399
|
|
398
400
|
Rake::TestTask.new(:test) do |t|
|
399
401
|
t.libs << 'test'
|
@@ -422,7 +424,7 @@ end
|
|
422
424
|
|
423
425
|
def relative_path
|
424
426
|
return unless inside_application?
|
425
|
-
app_path.
|
427
|
+
app_path.delete_prefix("#{rails_app_path}/")
|
426
428
|
end
|
427
429
|
end
|
428
430
|
end
|
@@ -1,14 +1,10 @@
|
|
1
|
-
|
1
|
+
require_relative "lib/<%= namespaced_name %>/version"
|
2
2
|
|
3
|
-
# Maintain your gem's version:
|
4
|
-
require "<%= namespaced_name %>/version"
|
5
|
-
|
6
|
-
# Describe your gem and declare its dependencies:
|
7
3
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
4
|
+
spec.name = <%= name.inspect %>
|
9
5
|
spec.version = <%= camelized_modules %>::VERSION
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
6
|
+
spec.authors = [<%= author.inspect %>]
|
7
|
+
spec.email = [<%= email.inspect %>]
|
12
8
|
spec.homepage = "TODO"
|
13
9
|
spec.summary = "TODO: Summary of <%= camelized_modules %>."
|
14
10
|
spec.description = "TODO: Description of <%= camelized_modules %>."
|
@@ -16,18 +12,13 @@ Gem::Specification.new do |spec|
|
|
16
12
|
|
17
13
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
14
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
|
20
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
-
"public gem pushes."
|
24
|
-
end
|
15
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
25
16
|
|
26
|
-
spec.
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
19
|
+
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
27
20
|
|
28
|
-
|
29
|
-
<% unless options[:skip_active_record] -%>
|
21
|
+
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
|
30
22
|
|
31
|
-
spec.
|
32
|
-
<% end -%>
|
23
|
+
<%= '# ' if options.dev? || options.edge? || options.master? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
|
33
24
|
end
|
@@ -2,23 +2,16 @@ source 'https://rubygems.org'
|
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
3
|
|
4
4
|
<% if options[:skip_gemspec] -%>
|
5
|
-
<%= '# ' if options.dev? || options.edge? -%>gem 'rails', '<%= Array(rails_version_specifier).join("', '") %>'
|
5
|
+
<%= '# ' if options.dev? || options.edge? || options.master? -%>gem 'rails', '<%= Array(rails_version_specifier).join("', '") %>'
|
6
6
|
<% else -%>
|
7
|
-
#
|
8
|
-
# Bundler will treat runtime dependencies like base dependencies, and
|
9
|
-
# development dependencies will be added by default to the :development group.
|
7
|
+
# Specify your gem's dependencies in <%= name %>.gemspec.
|
10
8
|
gemspec
|
11
9
|
<% end -%>
|
10
|
+
<% unless options[:skip_active_record] -%>
|
12
11
|
|
13
|
-
<% if options[:skip_gemspec] -%>
|
14
12
|
group :development do
|
15
13
|
gem '<%= gem_for_database[0] %>'
|
16
14
|
end
|
17
|
-
<% else -%>
|
18
|
-
# Declare any dependencies that are still in development here instead of in
|
19
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
20
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
21
|
-
# your gem to rubygems.org.
|
22
15
|
<% end -%>
|
23
16
|
|
24
17
|
<% if options.dev? || options.edge? -%>
|
@@ -1,28 +1,14 @@
|
|
1
|
-
|
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 = '<%= camelized_modules %>'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.md')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
1
|
+
require "bundler/setup"
|
16
2
|
<% if engine? && !options[:skip_active_record] && with_dummy_app? -%>
|
17
3
|
|
18
4
|
APP_RAKEFILE = File.expand_path("<%= dummy_path -%>/Rakefile", __dir__)
|
19
|
-
load
|
5
|
+
load "rails/tasks/engine.rake"
|
20
6
|
<% end -%>
|
21
7
|
<% if engine? -%>
|
22
8
|
|
23
|
-
load
|
9
|
+
load "rails/tasks/statistics.rake"
|
24
10
|
<% end -%>
|
25
11
|
<% unless options[:skip_gemspec] -%>
|
26
12
|
|
27
|
-
require
|
13
|
+
require "bundler/gem_tasks"
|
28
14
|
<% end -%>
|
@@ -9,10 +9,10 @@ APP_PATH = File.expand_path('../<%= dummy_path -%>/config/application', __dir__)
|
|
9
9
|
|
10
10
|
# Set up gems listed in the Gemfile.
|
11
11
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
12
|
-
require
|
12
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
13
13
|
|
14
14
|
<% if include_all_railties? -%>
|
15
|
-
require
|
15
|
+
require "rails/all"
|
16
16
|
<% else -%>
|
17
17
|
require "rails"
|
18
18
|
# Pick the frameworks you want:
|
@@ -27,4 +27,4 @@ require "action_view/railtie"
|
|
27
27
|
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
28
28
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
29
29
|
<% end -%>
|
30
|
-
require
|
30
|
+
require "rails/engine/commands"
|