daddy 0.9.14 → 0.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08a683e91f1863f8f0f5effad040d53352232fc49df964cf0f35733d8ea0ba78'
4
- data.tar.gz: 436e4e02ff4609b9b94216c1d277bb5e3a6d6d9016fca3d79fd0cf43b8e14838
3
+ metadata.gz: 54b50f10c353ee074f29bc7851e0c5ee33e82a1cf325f2b1178a27565f6b649f
4
+ data.tar.gz: 7f05b4291c47f44960853430ac699c4919668898f5aba8d62708c9ac27ed66bd
5
5
  SHA512:
6
- metadata.gz: e91c52a247f2e8b772cb088db3c603174e05faf2078812b2025957551d7da42539a9c72f8453e83162b119b5ec3a56a5a3179c93f63d3ce0140206340bc6e7ea
7
- data.tar.gz: 313ae2396d6d8a23a0484322e8e729cd89458df0837af44204ba1f12b1b29852ab685c80137a1f0503a8c40160ff9733d9d459396f31558e5e64bd47c38551fc
6
+ metadata.gz: 1430690d24611de760e956483befbb9c1b890570f3314c5589e2f66806ee736b5e05a42b287d4bcf9e6df089b7c777f9a570eb7771ae77f3a25fcde0ccc8acbd
7
+ data.tar.gz: 6eb971434b89d35e37f405470157bad91a3e175db8d69a96e4b83038aef4e8b7df01d5778ea43242af1c2fd9a736643116017b84512872b95563fe9dc51a4594
@@ -8,15 +8,15 @@ CarrierWave.configure do |config|
8
8
  "/data/#{::Rails.application.class.module_parent_name.underscore}/#{::Rails.env}"
9
9
  end
10
10
 
11
- unless ::Rails.env.test?
12
- if File.exists?('config/aws.yml')
11
+ if File.exists?('config/aws.yml')
12
+ aws = YAML.safe_load(ERB.new(File.read('config/aws.yml'), 0, '-').result)
13
+
14
+ if aws.dig('s3', 'enabled')
13
15
  require 'carrierwave/storage/fog'
14
16
  config.storage :fog
15
17
  config.cache_storage :fog
16
-
17
18
  config.fog_provider = 'fog/aws'
18
- aws = YAML.load_file('config/aws.yml')
19
-
19
+
20
20
  config.fog_credentials = {
21
21
  provider: 'AWS',
22
22
  aws_access_key_id: aws['s3']['access_key_id'],
@@ -18,14 +18,14 @@ module Daddy
18
18
 
19
19
  initializer 'carrierwave' do
20
20
  if defined?(CarrierWave)
21
- ::Rails.logger.info '[daddy] loading carrierwave uploader'
22
- require 'daddy/uploader'
21
+ puts '[daddy] loading carrierwave configuration'
22
+ require 'daddy/carrierwave'
23
23
  end
24
24
  end
25
25
 
26
26
  initializer 'sidekiq' do
27
27
  if defined?(Sidekiq)
28
- ::Rails.logger.info '[daddy] loading sidekiq configuration'
28
+ puts '[daddy] loading sidekiq configuration'
29
29
  require 'daddy/sidekiq'
30
30
  end
31
31
  end
data/lib/daddy/version.rb CHANGED
@@ -2,6 +2,6 @@ module Daddy
2
2
  VERSION = [
3
3
  VERSION_MAJOR = '0',
4
4
  VERSION_MINOR = '9',
5
- VERSION_REVISION = '14'
5
+ VERSION_REVISION = '16'
6
6
  ].join('.')
7
7
  end
@@ -8,7 +8,7 @@ namespace :dad do
8
8
  @app_name = File.basename(Rails.root)[0..15]
9
9
 
10
10
  template = File.join(File.dirname(__FILE__), 'db/database.yml.erb')
11
- render template, :to => 'config/database.yml'
11
+ render template, to: 'config/database.yml'
12
12
  end
13
13
  end
14
14
  end
@@ -5,31 +5,31 @@ namespace :dad do
5
5
 
6
6
  desc 'database.yml に従ってDBを作成します。'
7
7
  task :create do
8
- config = YAML.load(ERB.new(File.read('config/database.yml'), 0, '-').result)
8
+ config = YAML.safe_load(ERB.new(File.read('config/database.yml'), 0, '-').result, [], [], aliases: true)
9
9
 
10
10
  FileUtils.mkdir_p("tmp")
11
11
  system("echo '# mysql ddl' > tmp/create_databases.sql")
12
12
 
13
13
  config.each do |env, props|
14
14
  next if env == 'default'
15
+ next if ENV['RAILS_ENV'] and ENV['RAILS_ENV'] != env
15
16
 
16
- puts "database for environment #{env}"
17
17
  system("echo 'drop database if exists #{props['database']};' >> tmp/create_databases.sql")
18
18
  system("echo 'create database #{props['database']};' >> tmp/create_databases.sql")
19
+ system("echo 'drop user if exists \"#{props['username']}\"@\"%\";' >> tmp/create_databases.sql")
20
+ system("echo 'create user \"#{props['username']}\"@\"%\" IDENTIFIED BY \"#{props['password']}\";' >> tmp/create_databases.sql")
19
21
  system("echo 'grant all on #{props['database']}.* to #{props['username']} identified by \"#{props['password']}\";' >> tmp/create_databases.sql")
20
22
 
21
23
  if ENV['FILE']
22
24
  system("echo 'grant all on #{props['database']}.* to #{props['username']}@localhost identified by \"#{props['password']}\";' >> tmp/create_databases.sql")
23
25
  system("echo 'grant file on *.* to #{props['username']}@localhost;' >> tmp/create_databases.sql")
24
26
  end
27
+ puts "database for environment #{env} written to tmp/create_databases.sql"
25
28
  end
26
29
 
27
30
  system("echo 'flush privileges;' >> tmp/create_databases.sql")
28
31
  system("echo >> tmp/create_databases.sql")
29
32
 
30
- puts
31
- puts File.read('tmp/create_databases.sql')
32
-
33
33
  if ENV['MYSQL_NO_ROOT_PASSWORD']
34
34
  fail unless system("mysql -u root < tmp/create_databases.sql")
35
35
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
@@ -353,6 +353,7 @@ files:
353
353
  - lib/capistrano/tasks/clear_cache.rake
354
354
  - lib/capistrano/tasks/update_linked_files.rake
355
355
  - lib/daddy.rb
356
+ - lib/daddy/carrierwave.rb
356
357
  - lib/daddy/cucumber.rb
357
358
  - lib/daddy/cucumber/helpers.rb
358
359
  - lib/daddy/cucumber/helpers/assert.rb
@@ -383,7 +384,6 @@ files:
383
384
  - lib/daddy/sidekiq.rb
384
385
  - lib/daddy/tasks.rb
385
386
  - lib/daddy/test_help.rb
386
- - lib/daddy/uploader.rb
387
387
  - lib/daddy/utils/config.rb
388
388
  - lib/daddy/utils/sql_utils.rb
389
389
  - lib/daddy/utils/string_utils.rb
@@ -466,7 +466,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
466
466
  - !ruby/object:Gem::Version
467
467
  version: '0'
468
468
  requirements: []
469
- rubygems_version: 3.4.22
469
+ rubygems_version: 3.3.26
470
470
  signing_key:
471
471
  specification_version: 4
472
472
  summary: My rails dad