forest_liana 2.8.2 → 2.8.3

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
2
  SHA1:
3
- metadata.gz: 14ab097ffc6a225f2195936253472b5c52a73e3b
4
- data.tar.gz: 60a23d3c4b9a13db8f87c8debf710b80394651e9
3
+ metadata.gz: 3f8a110de97c7549661abca45b0a64d007761f81
4
+ data.tar.gz: e4f6330c222dde8972c7a265c550b846589e990b
5
5
  SHA512:
6
- metadata.gz: 01f1d41c1d3b33fd91fdc3d1b1275a0ccbdbb29bc41b29b73d782883dfb7e5490eeebf2b409fa919f1cb40edb0c489a3a0fbb10571b17cd44e10ff1734b771f6
7
- data.tar.gz: 38ed452888ca8f14d894395b2fb3cbae2319c2c9dcbdfea7bcd039e3439a77fc25d682e6390dffa26a85beae01f43d27e8a4d0cb732f5c74a0e6d9f998adefce
6
+ metadata.gz: 4873a75514f82752ea362470f7d28424b97b2ced4ef140d19970fed6fb959198a90f3ea88e86c1605ec1fd33a900277eff5b10dbc93ab231c3f51ecbd38b4372
7
+ data.tar.gz: df50c529a44f907d9414b713419cb2495216b18551494ad665d0c00e10872c23a867dd4b9d11c4afe6ebac68ce075484c08bae73bce4a0924593ad52838329cf
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "2.8.2"
2
+ VERSION = "2.8.3"
3
3
  end
@@ -7,32 +7,53 @@ module ForestLiana
7
7
  argument :env_secret, type: :string, required: true, desc: 'required', banner: 'env_secret'
8
8
 
9
9
  def install
10
- route "mount ForestLiana::Engine => '/forest'"
11
-
12
- initializer 'forest_liana.rb' do
13
- "ForestLiana.env_secret = Rails.application.secrets.forest_env_secret" +
14
- "\nForestLiana.auth_secret = Rails.application.secrets.forest_auth_secret"
10
+ if ForestLiana.env_secret.present?
11
+ puts "\nForest liana already installed on this app (environment secret: #{ForestLiana.env_secret})"
12
+ return
15
13
  end
16
14
 
15
+ route "mount ForestLiana::Engine => '/forest'"
16
+
17
17
  auth_secret = SecureRandom.urlsafe_base64
18
18
 
19
19
  puts "\nForest generated a random authentication secret to secure the " +
20
20
  "data access of your local project.\nYou can change it at any time in " +
21
21
  "your config/secrets.yml file.\n\n"
22
22
 
23
- inject_into_file 'config/secrets.yml', after: "development:\n" do
24
- " forest_env_secret: #{env_secret}\n" +
25
- " forest_auth_secret: #{auth_secret}\n"
26
- end
27
-
28
- inject_into_file 'config/secrets.yml', after: "staging:\n", force: true do
29
- " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
30
- " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n"
23
+ # NOTICE: If it is a Rails 5.2+ apps, the secrets.yml file might not exist
24
+ # (replaced by credentials.yml.enc but still supported).
25
+ if File.exist? 'config/secrets.yml'
26
+ inject_into_file 'config/secrets.yml', after: "development:\n" do
27
+ " forest_env_secret: #{env_secret}\n" +
28
+ " forest_auth_secret: #{auth_secret}\n"
29
+ end
30
+
31
+ inject_into_file 'config/secrets.yml', after: "staging:\n", force: true do
32
+ " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
33
+ " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n"
34
+ end
35
+
36
+ inject_into_file 'config/secrets.yml', after: "production:\n", force: true do
37
+ " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
38
+ " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n"
39
+ end
40
+ else
41
+ create_file 'config/secrets.yml' do
42
+ "development:\n" +
43
+ " forest_env_secret: #{env_secret}\n" +
44
+ " forest_auth_secret: #{auth_secret}\n" +
45
+ "staging:\n" +
46
+ " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
47
+ " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n" +
48
+ "production:\n" +
49
+ " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
50
+ " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n"
51
+ end
31
52
  end
32
53
 
33
- inject_into_file 'config/secrets.yml', after: "production:\n", force: true do
34
- " forest_env_secret: <%= ENV[\"FOREST_ENV_SECRET\"] %>\n" +
35
- " forest_auth_secret: <%= ENV[\"FOREST_AUTH_SECRET\"] %>\n"
54
+ initializer 'forest_liana.rb' do
55
+ "ForestLiana.env_secret = Rails.application.secrets.forest_env_secret" +
56
+ "\nForestLiana.auth_secret = Rails.application.secrets.forest_auth_secret"
36
57
  end
37
58
  end
38
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails