railties 5.1.1 → 5.1.2.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/rails/commands/help/USAGE +9 -8
- data/lib/rails/commands/secrets/secrets_command.rb +17 -6
- data/lib/rails/commands/test/test_command.rb +1 -1
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/app_base.rb +0 -4
- data/lib/rails/generators/rails/app/app_generator.rb +5 -0
- data/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +17 -13
- data/lib/rails/secrets.rb +26 -8
- data/lib/rails/test_unit/testing.rake +1 -0
- metadata +11 -13
- data/lib/rails/generators/rails/encrypted_secrets/templates/config/secrets.yml.enc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e44cca337ea7f274f92834486bb9c2de9ce0b02
|
4
|
+
data.tar.gz: '0553712679d7424e515a6a6f9e479382557a5a02'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f7d106175a3c34dfa56423aab89575a800625c144be7bea53ba8ef316827f3314a1e06cb8b78adfb31995d79c67c924eb46dc138d886a93f4a94ee925f2705
|
7
|
+
data.tar.gz: 589d690092457a528f4e1f8f083118cfbeb4bd56e27b36d88f94845761fcfdc4ea6fa21c86e7b341fcc2050f633b46503957f18bce56249cc5e3d492b72047f0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## Rails 5.1.2.rc1 (June 20, 2017) ##
|
2
|
+
|
3
|
+
* Add Windows support to `rails secrets:edit`.
|
4
|
+
|
5
|
+
*Kasper Timm Hansen*
|
6
|
+
|
7
|
+
## Rails 5.1.1 (May 12, 2017) ##
|
8
|
+
|
9
|
+
* No changes.
|
10
|
+
|
11
|
+
|
1
12
|
## Rails 5.1.0 (April 27, 2017) ##
|
2
13
|
|
3
14
|
* Namespace error pages' CSS selectors to stop the styles from bleeding into other pages
|
@@ -1,13 +1,14 @@
|
|
1
1
|
The most common rails commands are:
|
2
|
-
generate
|
3
|
-
console
|
4
|
-
server
|
5
|
-
test
|
6
|
-
|
7
|
-
|
2
|
+
generate Generate new code (short-cut alias: "g")
|
3
|
+
console Start the Rails console (short-cut alias: "c")
|
4
|
+
server Start the Rails server (short-cut alias: "s")
|
5
|
+
test Run tests except system tests (short-cut alias: "t")
|
6
|
+
test:system Run system tests
|
7
|
+
dbconsole Start a console for the database specified in config/database.yml
|
8
|
+
(short-cut alias: "db")
|
8
9
|
<% unless engine? %>
|
9
|
-
new
|
10
|
-
|
10
|
+
new Create a new Rails application. "rails new my_app" creates a
|
11
|
+
new application called MyApp in "./my_app"
|
11
12
|
<% end %>
|
12
13
|
|
13
14
|
All commands can be run with -h (or --help) for more information.
|
@@ -13,10 +13,7 @@ module Rails
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def setup
|
16
|
-
|
17
|
-
require "rails/generators/rails/encrypted_secrets/encrypted_secrets_generator"
|
18
|
-
|
19
|
-
Rails::Generators::EncryptedSecretsGenerator.start
|
16
|
+
generator.start
|
20
17
|
end
|
21
18
|
|
22
19
|
def edit
|
@@ -34,8 +31,7 @@ module Rails
|
|
34
31
|
require_application_and_environment!
|
35
32
|
|
36
33
|
Rails::Secrets.read_for_editing do |tmp_path|
|
37
|
-
|
38
|
-
system("\$EDITOR #{tmp_path}")
|
34
|
+
system("#{ENV["EDITOR"]} #{tmp_path}")
|
39
35
|
end
|
40
36
|
|
41
37
|
say "New secrets encrypted and saved."
|
@@ -43,7 +39,22 @@ module Rails
|
|
43
39
|
say "Aborted changing encrypted secrets: nothing saved."
|
44
40
|
rescue Rails::Secrets::MissingKeyError => error
|
45
41
|
say error.message
|
42
|
+
rescue Errno::ENOENT => error
|
43
|
+
raise unless error.message =~ /secrets\.yml\.enc/
|
44
|
+
|
45
|
+
Rails::Secrets.read_template_for_editing do |tmp_path|
|
46
|
+
system("#{ENV["EDITOR"]} #{tmp_path}")
|
47
|
+
generator.skip_secrets_file { setup }
|
48
|
+
end
|
46
49
|
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def generator
|
53
|
+
require "rails/generators"
|
54
|
+
require "rails/generators/rails/encrypted_secrets/encrypted_secrets_generator"
|
55
|
+
|
56
|
+
Rails::Generators::EncryptedSecretsGenerator
|
57
|
+
end
|
47
58
|
end
|
48
59
|
end
|
49
60
|
end
|
data/lib/rails/gem_version.rb
CHANGED
@@ -13,7 +13,6 @@ module Rails
|
|
13
13
|
DATABASES = %w( mysql postgresql sqlite3 oracle frontbase ibm_db sqlserver )
|
14
14
|
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
|
15
15
|
DATABASES.concat(JDBC_DATABASES)
|
16
|
-
WEBPACKS = %w( react vue angular )
|
17
16
|
|
18
17
|
attr_accessor :rails_template
|
19
18
|
add_shebang_option!
|
@@ -31,9 +30,6 @@ module Rails
|
|
31
30
|
class_option :database, type: :string, aliases: "-d", default: "sqlite3",
|
32
31
|
desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
33
32
|
|
34
|
-
class_option :webpack, type: :string, default: nil,
|
35
|
-
desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"
|
36
|
-
|
37
33
|
class_option :skip_yarn, type: :boolean, default: false,
|
38
34
|
desc: "Don't use Yarn for managing JavaScript dependencies"
|
39
35
|
|
@@ -212,6 +212,8 @@ module Rails
|
|
212
212
|
RESERVED_NAMES = %w[application destroy plugin runner test]
|
213
213
|
|
214
214
|
class AppGenerator < AppBase # :nodoc:
|
215
|
+
WEBPACKS = %w( react vue angular )
|
216
|
+
|
215
217
|
add_shared_options_for "application"
|
216
218
|
|
217
219
|
# Add bin/rails options
|
@@ -224,6 +226,9 @@ module Rails
|
|
224
226
|
class_option :skip_bundle, type: :boolean, aliases: "-B", default: false,
|
225
227
|
desc: "Don't run bundle install"
|
226
228
|
|
229
|
+
class_option :webpack, type: :string, default: nil,
|
230
|
+
desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"
|
231
|
+
|
227
232
|
def initialize(*args)
|
228
233
|
super
|
229
234
|
|
@@ -36,25 +36,29 @@ module Rails
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def add_encrypted_secrets_file
|
39
|
-
unless File.exist?("config/secrets.yml.enc")
|
39
|
+
unless (defined?(@@skip_secrets_file) && @@skip_secrets_file) || File.exist?("config/secrets.yml.enc")
|
40
40
|
say "Adding config/secrets.yml.enc to store secrets that needs to be encrypted."
|
41
41
|
say ""
|
42
|
+
say "For now the file contains this but it's been encrypted with the generated key:"
|
43
|
+
say ""
|
44
|
+
say Secrets.template, :on_green
|
45
|
+
say ""
|
42
46
|
|
43
|
-
|
44
|
-
say ""
|
45
|
-
say "For now the file contains this but it's been encrypted with the generated key:"
|
46
|
-
say ""
|
47
|
-
say prefill, :on_green
|
48
|
-
say ""
|
49
|
-
|
50
|
-
Secrets.encrypt(prefill)
|
51
|
-
end
|
47
|
+
Secrets.write(Secrets.template)
|
52
48
|
|
53
49
|
say "You can edit encrypted secrets with `bin/rails secrets:edit`."
|
54
|
-
|
55
|
-
say "Add this to your config/environments/production.rb:"
|
56
|
-
say "config.read_encrypted_secrets = true"
|
50
|
+
say ""
|
57
51
|
end
|
52
|
+
|
53
|
+
say "Add this to your config/environments/production.rb:"
|
54
|
+
say "config.read_encrypted_secrets = true"
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.skip_secrets_file
|
58
|
+
@@skip_secrets_file = true
|
59
|
+
yield
|
60
|
+
ensure
|
61
|
+
@@skip_secrets_file = false
|
58
62
|
end
|
59
63
|
|
60
64
|
private
|
data/lib/rails/secrets.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "yaml"
|
2
2
|
require "active_support/message_encryptor"
|
3
|
+
require "active_support/core_ext/string/strip"
|
3
4
|
|
4
5
|
module Rails
|
5
6
|
# Greatly inspired by Ara T. Howard's magnificent sekrets gem. 😘
|
@@ -37,6 +38,15 @@ module Rails
|
|
37
38
|
ENV["RAILS_MASTER_KEY"] || read_key_file || handle_missing_key
|
38
39
|
end
|
39
40
|
|
41
|
+
def template
|
42
|
+
<<-end_of_template.strip_heredoc
|
43
|
+
# See `secrets.yml` for tips on generating suitable keys.
|
44
|
+
# production:
|
45
|
+
# external_api_key: 1466aac22e6a869134be3d09b9e89232fc2c2289…
|
46
|
+
|
47
|
+
end_of_template
|
48
|
+
end
|
49
|
+
|
40
50
|
def encrypt(data)
|
41
51
|
encryptor.encrypt_and_sign(data)
|
42
52
|
end
|
@@ -54,15 +64,12 @@ module Rails
|
|
54
64
|
FileUtils.mv("#{path}.tmp", path)
|
55
65
|
end
|
56
66
|
|
57
|
-
def read_for_editing
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
yield tmp_path
|
67
|
+
def read_for_editing(&block)
|
68
|
+
writing(read, &block)
|
69
|
+
end
|
62
70
|
|
63
|
-
|
64
|
-
|
65
|
-
FileUtils.rm(tmp_path) if File.exist?(tmp_path)
|
71
|
+
def read_template_for_editing(&block)
|
72
|
+
writing(template, &block)
|
66
73
|
end
|
67
74
|
|
68
75
|
private
|
@@ -92,6 +99,17 @@ module Rails
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
102
|
+
def writing(contents)
|
103
|
+
tmp_path = File.join(Dir.tmpdir, File.basename(path))
|
104
|
+
File.write(tmp_path, contents)
|
105
|
+
|
106
|
+
yield tmp_path
|
107
|
+
|
108
|
+
write(File.read(tmp_path))
|
109
|
+
ensure
|
110
|
+
FileUtils.rm(tmp_path) if File.exist?(tmp_path)
|
111
|
+
end
|
112
|
+
|
95
113
|
def encryptor
|
96
114
|
@encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: @cipher)
|
97
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.2.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.1.
|
19
|
+
version: 5.1.2.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.1.
|
26
|
+
version: 5.1.2.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.1.
|
33
|
+
version: 5.1.2.rc1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.1.
|
40
|
+
version: 5.1.2.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.1.
|
95
|
+
version: 5.1.2.rc1
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 5.1.
|
102
|
+
version: 5.1.2.rc1
|
103
103
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
104
104
|
email: david@loudthinking.com
|
105
105
|
executables:
|
@@ -269,7 +269,6 @@ files:
|
|
269
269
|
- lib/rails/generators/rails/controller/controller_generator.rb
|
270
270
|
- lib/rails/generators/rails/controller/templates/controller.rb
|
271
271
|
- lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb
|
272
|
-
- lib/rails/generators/rails/encrypted_secrets/templates/config/secrets.yml.enc
|
273
272
|
- lib/rails/generators/rails/generator/USAGE
|
274
273
|
- lib/rails/generators/rails/generator/generator_generator.rb
|
275
274
|
- lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt
|
@@ -422,14 +421,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
422
421
|
version: 2.2.2
|
423
422
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
424
423
|
requirements:
|
425
|
-
- - "
|
424
|
+
- - ">"
|
426
425
|
- !ruby/object:Gem::Version
|
427
|
-
version:
|
426
|
+
version: 1.3.1
|
428
427
|
requirements: []
|
429
428
|
rubyforge_project:
|
430
|
-
rubygems_version: 2.6.
|
429
|
+
rubygems_version: 2.6.12
|
431
430
|
signing_key:
|
432
431
|
specification_version: 4
|
433
432
|
summary: Tools for creating, working with, and running Rails applications.
|
434
433
|
test_files: []
|
435
|
-
has_rdoc:
|