daddy 0.11.0 → 0.11.2

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: c61a2b9374136d7bab58f889a39fad32f581f58114fac666c3caa5872d593b70
4
- data.tar.gz: 5184b70837b08b68b524c7207f9b7aaa9906e00227703d7a2c68d0c0731e3617
3
+ metadata.gz: f71b758b41276f069327bb600ffc20ac7fafecf1245913333dee6f718dc72142
4
+ data.tar.gz: 10961fa1199db0e326ea388d95337822feb447afa55414786f3e82db412ca9b7
5
5
  SHA512:
6
- metadata.gz: ced8c1258872315a461415eb39161bf42e60565dde3d99c6282888f96cc8179a1b3c17e2dd4fd485fb580dc1259e8dfcbcc2e5eeeaf95bf355eb9aeecfebce1b
7
- data.tar.gz: e7ccf25b3da46d354853f1ff74882be87509bc37d1a7ddcf74752dc2cf685c0303bbcd1ada007a635d78b4ce6dfb690235d8fb20766751cbb882db934065229f
6
+ metadata.gz: 6786c310177fee7fb8cce31d7fdfc5145acccd65b5cc13b2d1aaea441eff058d5e7088a71256b3378debd01a6b622c9aeb6f66f49140369adfe0a3eb95fabcf0
7
+ data.tar.gz: 1176e6f9decb1fb0ec4fd1d427630a4ca68e2a123df34bc796f4e2b8060e56e911bc4d41b227494b7d4ae66eff6c7f3e6c57d2aac489d2c446e54b4112373b96
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  package 'nodejs' do
25
25
  user 'root'
26
- version '18.20.8-1nodesource'
26
+ version '22.18.0-1nodesource'
27
27
  options '--enablerepo=nodesource-nodejs'
28
28
  end
29
29
 
@@ -1,6 +1,6 @@
1
1
  [nodesource-nodejs]
2
2
  name=Node.js Packages for Linux RPM based distros - x86_64
3
- baseurl=https://rpm.nodesource.com/pub_18.x/nodistro/nodejs/x86_64
3
+ baseurl=https://rpm.nodesource.com/pub_22.x/nodistro/nodejs/x86_64
4
4
  priority=9
5
5
  enabled=0
6
6
  gpgcheck=1
@@ -1,4 +1,4 @@
1
- version = ENV['RUBY_VERSION'] || '3.2.9'
1
+ version = ENV['RUBY_VERSION'] || '3.4.7'
2
2
  short_version = version.split('.')[0..1].join('.')
3
3
 
4
4
  execute "download ruby-#{version}" do
@@ -34,7 +34,7 @@ execute "install ruby-#{version}" do
34
34
  end
35
35
 
36
36
  {
37
- 'bundler' => ['2.3.26', '2.7.1'],
37
+ 'bundler' => ['2.7.2'],
38
38
  'itamae' => '1.14.1'
39
39
  }.each do |name, versions|
40
40
  versions = Array(versions)
@@ -47,8 +47,14 @@ end
47
47
  end
48
48
  end
49
49
 
50
- execute 'gem update --system 3.7.1 -N' do
50
+ execute 'gem update --system 3.7.2 -N' do
51
51
  user 'root'
52
52
  action :nothing
53
53
  subscribes :run, "gem_package[bundler]", :immediately
54
54
  end
55
+
56
+ execute "bundle config set --global path ~/.gem/ruby/#{short_version}.0" do
57
+ user ENV['USER']
58
+ not_if "bundle config get path | grep -qE '\\.gem/ruby/#{short_version}.0'"
59
+ end
60
+
@@ -0,0 +1 @@
1
+ 55a4cd1dcbe5ca27cf65e89a935a482c2bb2284832939266551c0ec68b437f46 ruby-3.4.3.tar.gz
@@ -0,0 +1 @@
1
+ 23815a6d095696f7919090fdc3e2f9459b2c83d57224b2e446ce1f5f7333ef36 ruby-3.4.7.tar.gz
data/lib/daddy/version.rb CHANGED
@@ -2,6 +2,6 @@ module Daddy
2
2
  VERSION = [
3
3
  VERSION_MAJOR = '0',
4
4
  VERSION_MINOR = '11',
5
- VERSION_REVISION = '0'
5
+ VERSION_REVISION = '2'
6
6
  ].join('.')
7
7
  end
data/lib/daddy.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'daddy/utils/config'
2
- require 'daddy/utils/string_utils'
3
2
  require 'sql_builder'
4
3
 
5
4
  module Daddy
@@ -1,8 +1,9 @@
1
- require 'rake'
1
+ require_relative 'task_helper'
2
2
 
3
3
  namespace :dad do
4
4
  namespace :db do
5
-
5
+ include DatabaseHelpers
6
+
6
7
  desc 'database.yml に従ってDBを作成します。'
7
8
  task :create do
8
9
  config = YAML.safe_load(ERB.new(File.read('config/database.yml'), trim_mode: '-').result, aliases: true)
@@ -10,31 +11,71 @@ namespace :dad do
10
11
  FileUtils.mkdir_p("tmp")
11
12
  system("echo '# mysql ddl' > tmp/create_databases.sql")
12
13
 
13
- user = host = port = nil
14
+ # Collect all unique users from the target environment and databases
15
+ users = {}
16
+ host = port = nil
17
+
14
18
  config.each do |env, props|
15
19
  next if env == 'default'
16
- next if props['username'] == user
17
-
18
- user = props['username']
19
- host = props['host']
20
- port = props['port']
21
- system("echo 'drop user if exists \"#{user}\"@\"%\";' >> tmp/create_databases.sql")
22
- system("echo 'create user \"#{user}\"@\"%\" IDENTIFIED BY \"#{props['password']}\";' >> tmp/create_databases.sql")
20
+ next if ENV['RAILS_ENV'] and ENV['RAILS_ENV'] != env
21
+
22
+ if multiple_databases?(props)
23
+ # Multiple databases configuration (Rails 8 style)
24
+ props.each do |db_name, db_config|
25
+ next unless db_config.is_a?(Hash) && db_config['username']
26
+ username = db_config['username']
27
+ users[username] ||= {
28
+ 'password' => db_config['password'],
29
+ 'host' => db_config['host'],
30
+ 'port' => db_config['port']
31
+ }
32
+ host ||= db_config['host']
33
+ port ||= db_config['port']
34
+ end
35
+ else
36
+ # Single database configuration
37
+ next unless props['username']
38
+ username = props['username']
39
+ users[username] ||= {
40
+ 'password' => props['password'],
41
+ 'host' => props['host'],
42
+ 'port' => props['port']
43
+ }
44
+ host ||= props['host']
45
+ port ||= props['port']
46
+ end
47
+ end
48
+
49
+ # Create users
50
+ users.each do |username, user_info|
51
+ system("echo 'drop user if exists \"#{username}\"@\"%\";' >> tmp/create_databases.sql")
52
+ system("echo 'create user \"#{username}\"@\"%\" IDENTIFIED BY \"#{user_info['password']}\";' >> tmp/create_databases.sql")
23
53
  end
24
54
 
55
+ # Create databases
25
56
  config.each do |env, props|
26
57
  next if env == 'default'
27
58
  next if ENV['RAILS_ENV'] and ENV['RAILS_ENV'] != env
28
59
 
29
- system("echo 'drop database if exists #{props['database']};' >> tmp/create_databases.sql")
30
- system("echo 'create database #{props['database']};' >> tmp/create_databases.sql")
31
- system("echo 'grant all on #{props['database']}.* to #{user};' >> tmp/create_databases.sql")
32
-
33
- if ENV['FILE']
34
- system("echo 'grant all on #{props['database']}.* to #{user}@localhost;' >> tmp/create_databases.sql")
35
- system("echo 'grant file on *.* to #{user}@localhost;' >> tmp/create_databases.sql")
60
+ if multiple_databases?(props)
61
+ # Multiple databases configuration (Rails 8 style)
62
+ props.each do |db_name, db_config|
63
+ next unless db_config.is_a?(Hash) && db_config['database']
64
+ database = db_config['database']
65
+ username = db_config['username']
66
+
67
+ create_database_sql(database, username)
68
+ puts "database #{database} (#{env}/#{db_name}) written to tmp/create_databases.sql"
69
+ end
70
+ else
71
+ # Single database configuration
72
+ next unless props['database']
73
+ database = props['database']
74
+ username = props['username']
75
+
76
+ create_database_sql(database, username)
77
+ puts "database #{database} (#{env}) written to tmp/create_databases.sql"
36
78
  end
37
- puts "database for environment #{env} written to tmp/create_databases.sql"
38
79
  end
39
80
 
40
81
  system("echo 'flush privileges;' >> tmp/create_databases.sql")
@@ -139,4 +139,32 @@ def self.run_itamae(*recipes)
139
139
  end
140
140
 
141
141
  run "bundle exec itamae local #{options.join(' ')} #{recipe_files.join(' ')}"
142
+ end
143
+
144
+ # Database helper methods for dad:db namespace
145
+ module DatabaseHelpers
146
+ # Helper method to check if a configuration is multiple databases (Rails 8 style)
147
+ def multiple_databases?(props)
148
+ return false unless props.is_a?(Hash)
149
+ # Standard Rails database config keys
150
+ standard_keys = ['adapter', 'collation', 'database', 'encoding', 'host', 'max_connections', 'migrations_paths', 'password', 'port', 'url', 'username']
151
+ # If it has a 'database' key directly, it's a single database config
152
+ return false if props.key?('database')
153
+ # If it has keys that are not standard keys and those values are hashes with 'database' keys, it's multiple databases
154
+ props.any? do |key, value|
155
+ !standard_keys.include?(key.to_s) && value.is_a?(Hash) && value.key?('database')
156
+ end
157
+ end
158
+
159
+ # Helper method to write database creation SQL commands
160
+ def create_database_sql(database, username)
161
+ system("echo 'drop database if exists #{database};' >> tmp/create_databases.sql")
162
+ system("echo 'create database #{database};' >> tmp/create_databases.sql")
163
+ system("echo 'grant all on #{database}.* to \"#{username}\"@\"%\";' >> tmp/create_databases.sql")
164
+
165
+ if ENV['FILE']
166
+ system("echo 'grant all on #{database}.* to \"#{username}\"@localhost;' >> tmp/create_databases.sql")
167
+ system("echo 'grant file on *.* to \"#{username}\"@localhost;' >> tmp/create_databases.sql")
168
+ end
169
+ end
142
170
  end
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.11.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
@@ -9,20 +9,6 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: concurrent-ruby
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "<"
17
- - !ruby/object:Gem::Version
18
- version: 1.3.5
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - "<"
24
- - !ruby/object:Gem::Version
25
- version: 1.3.5
26
12
  - !ruby/object:Gem::Dependency
27
13
  name: docker-api
28
14
  requirement: !ruby/object:Gem::Requirement
@@ -183,14 +169,14 @@ dependencies:
183
169
  requirements:
184
170
  - - ">="
185
171
  - !ruby/object:Gem::Version
186
- version: '6.1'
172
+ version: '7.2'
187
173
  type: :development
188
174
  prerelease: false
189
175
  version_requirements: !ruby/object:Gem::Requirement
190
176
  requirements:
191
177
  - - ">="
192
178
  - !ruby/object:Gem::Version
193
- version: '6.1'
179
+ version: '7.2'
194
180
  - !ruby/object:Gem::Dependency
195
181
  name: redis
196
182
  requirement: !ruby/object:Gem::Requirement
@@ -261,20 +247,6 @@ dependencies:
261
247
  - - ">="
262
248
  - !ruby/object:Gem::Version
263
249
  version: '0'
264
- - !ruby/object:Gem::Dependency
265
- name: simplecov-rcov
266
- requirement: !ruby/object:Gem::Requirement
267
- requirements:
268
- - - ">="
269
- - !ruby/object:Gem::Version
270
- version: '0'
271
- type: :development
272
- prerelease: false
273
- version_requirements: !ruby/object:Gem::Requirement
274
- requirements:
275
- - - ">="
276
- - !ruby/object:Gem::Version
277
- version: '0'
278
250
  description: Daddy helps me build web applications since daddy knows some good practices.
279
251
  email: ichylinux@gmail.com
280
252
  executables: []
@@ -320,6 +292,8 @@ files:
320
292
  - itamae/environments/ruby/default.rb
321
293
  - itamae/environments/ruby/ruby-2.7.8.tar.gz_sha256sum.txt
322
294
  - itamae/environments/ruby/ruby-3.2.9.tar.gz_sha256sum.txt
295
+ - itamae/environments/ruby/ruby-3.4.3.tar.gz_sha256sum.txt
296
+ - itamae/environments/ruby/ruby-3.4.7.tar.gz_sha256sum.txt
323
297
  - itamae/locale/en.yml
324
298
  - itamae/locale/ja.yml
325
299
  - itamae/templates/etc/god/master.conf.erb
@@ -327,7 +301,6 @@ files:
327
301
  - itamae/templates/etc/logrotate.d/god.erb
328
302
  - itamae/templates/etc/nginx/conf.d/servers/gitbucket.conf.erb
329
303
  - itamae/templates/etc/nginx/conf.d/servers/jenkins.conf.erb
330
- - itamae/templates/etc/sysconfig/jenkins.erb
331
304
  - itamae/templates/etc/systemd/system/tracd.service.erb
332
305
  - itamae/templates/etc/vsftpd/vsftpd.conf.erb
333
306
  - itamae/templates/etc/yum.repos.d/google-chrome.repo.erb
@@ -371,14 +344,11 @@ files:
371
344
  - lib/daddy/test_help.rb
372
345
  - lib/daddy/utils/config.rb
373
346
  - lib/daddy/utils/sql_utils.rb
374
- - lib/daddy/utils/string_utils.rb
375
347
  - lib/daddy/version.rb
376
348
  - lib/sql_builder.rb
377
349
  - lib/tasks/app_base_dir.rake
378
350
  - lib/tasks/cucumber_steps.rake
379
351
  - lib/tasks/dad.rake
380
- - lib/tasks/db/database.yml.erb
381
- - lib/tasks/db_config.rake
382
352
  - lib/tasks/db_create.rake
383
353
  - lib/tasks/db_dump.rake
384
354
  - lib/tasks/db_fixtures.rake
@@ -453,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
453
423
  - !ruby/object:Gem::Version
454
424
  version: '0'
455
425
  requirements: []
456
- rubygems_version: 3.7.1
426
+ rubygems_version: 3.7.2
457
427
  specification_version: 4
458
428
  summary: My rails dad
459
429
  test_files: []
@@ -1,148 +0,0 @@
1
- ## Path: Development/Jenkins
2
- ## Description: Jenkins Automation Server
3
- ## Type: string
4
- ## Default: "/var/lib/jenkins"
5
- ## ServiceRestart: jenkins
6
- #
7
- # Directory where Jenkins store its configuration and working
8
- # files (checkouts, build reports, artifacts, ...).
9
- #
10
- JENKINS_HOME="/var/lib/jenkins"
11
-
12
- ## Type: string
13
- ## Default: ""
14
- ## ServiceRestart: jenkins
15
- #
16
- # Java executable to run Jenkins
17
- # When left empty, we'll try to find the suitable Java.
18
- #
19
- JENKINS_JAVA_CMD=""
20
-
21
- ## Type: string
22
- ## Default: "jenkins"
23
- ## ServiceRestart: jenkins
24
- #
25
- # Unix user account that runs the Jenkins daemon
26
- # Be careful when you change this, as you need to update
27
- # permissions of $JENKINS_HOME and /var/log/jenkins.
28
- #
29
- JENKINS_USER="jenkins"
30
-
31
- ## Type: string
32
- ## Default: "false"
33
- ## ServiceRestart: jenkins
34
- #
35
- # Whether to skip potentially long-running chown at the
36
- # $JENKINS_HOME location. Do not enable this, "true", unless
37
- # you know what you're doing. See JENKINS-23273.
38
- #
39
- #JENKINS_INSTALL_SKIP_CHOWN="false"
40
-
41
- ## Type: string
42
- ## Default: "-Djava.awt.headless=true"
43
- ## ServiceRestart: jenkins
44
- #
45
- # Options to pass to java when running Jenkins.
46
- #
47
- JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
48
- JENKINS_JAVA_OPTIONS="-Dhudson.model.DirectoryBrowserSupport.CSP=\"sandbox allow-same-origin allow-scripts; default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';\" ${JENKINS_JAVA_OPTIONS}"
49
- JENKINS_JAVA_OPTIONS="-Dhudson.diyChunking=false ${JENKINS_JAVA_OPTIONS}"
50
-
51
- ## Type: integer(0:65535)
52
- ## Default: 8080
53
- ## ServiceRestart: jenkins
54
- #
55
- # Port Jenkins is listening on.
56
- # Set to -1 to disable
57
- #
58
- JENKINS_PORT="8080"
59
-
60
- ## Type: string
61
- ## Default: ""
62
- ## ServiceRestart: jenkins
63
- #
64
- # IP address Jenkins listens on for HTTP requests.
65
- # Default is all interfaces (0.0.0.0).
66
- #
67
- JENKINS_LISTEN_ADDRESS=""
68
-
69
- ## Type: integer(0:65535)
70
- ## Default: ""
71
- ## ServiceRestart: jenkins
72
- #
73
- # HTTPS port Jenkins is listening on.
74
- # Default is disabled.
75
- #
76
- JENKINS_HTTPS_PORT=""
77
-
78
- ## Type: string
79
- ## Default: ""
80
- ## ServiceRestart: jenkins
81
- #
82
- # Path to the keystore in JKS format (as created by the JDK 'keytool').
83
- # Default is disabled.
84
- #
85
- JENKINS_HTTPS_KEYSTORE=""
86
-
87
- ## Type: string
88
- ## Default: ""
89
- ## ServiceRestart: jenkins
90
- #
91
- # Password to access the keystore defined in JENKINS_HTTPS_KEYSTORE.
92
- # Default is disabled.
93
- #
94
- JENKINS_HTTPS_KEYSTORE_PASSWORD=""
95
-
96
- ## Type: string
97
- ## Default: ""
98
- ## ServiceRestart: jenkins
99
- #
100
- # IP address Jenkins listens on for HTTPS requests.
101
- # Default is disabled.
102
- #
103
- JENKINS_HTTPS_LISTEN_ADDRESS=""
104
-
105
-
106
- ## Type: integer(1:9)
107
- ## Default: 5
108
- ## ServiceRestart: jenkins
109
- #
110
- # Debug level for logs -- the higher the value, the more verbose.
111
- # 5 is INFO.
112
- #
113
- JENKINS_DEBUG_LEVEL="5"
114
-
115
- ## Type: yesno
116
- ## Default: no
117
- ## ServiceRestart: jenkins
118
- #
119
- # Whether to enable access logging or not.
120
- #
121
- JENKINS_ENABLE_ACCESS_LOG="no"
122
-
123
- ## Type: integer
124
- ## Default: 100
125
- ## ServiceRestart: jenkins
126
- #
127
- # Maximum number of HTTP worker threads.
128
- #
129
- JENKINS_HANDLER_MAX="100"
130
-
131
- ## Type: integer
132
- ## Default: 20
133
- ## ServiceRestart: jenkins
134
- #
135
- # Maximum number of idle HTTP worker threads.
136
- #
137
- JENKINS_HANDLER_IDLE="20"
138
-
139
- ## Type: string
140
- ## Default: ""
141
- ## ServiceRestart: jenkins
142
- #
143
- # Pass arbitrary arguments to Jenkins.
144
- # Full option list: java -jar jenkins.war --help
145
- #
146
- JENKINS_ARGS=""
147
-
148
- export PATH="${PATH}":/usr/local/bin
@@ -1,43 +0,0 @@
1
- require 'nkf'
2
-
3
- module Daddy
4
- module Utils
5
- class StringUtils
6
-
7
- def self.to_hiragana(s)
8
- return s if is_empty(s)
9
- NKF::nkf('-Ww --hiragana', s)
10
- end
11
-
12
- def self.to_katakana(s)
13
- return s if is_empty(s)
14
- NKF::nkf('-Ww --katakana', s)
15
- end
16
-
17
- def self.to_zen(s)
18
- return s if is_empty(s)
19
- NKF::nkf('-WwXm0', s)
20
- end
21
-
22
- def self.to_han(s)
23
- return s if is_empty(s)
24
- NKF::nkf('-Wwxm0Z0', s)
25
- end
26
-
27
- def self.current_time(now = nil)
28
- now = Time.now unless now
29
- now.instance_eval { '%s%03d' % [strftime('%Y%m%d%H%M%S'), (usec / 1000.0).round] }
30
- end
31
-
32
- def self.rand(length = 8)
33
- chars = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a
34
- ret = []
35
- length.times do |i|
36
- ret[i] = chars[rand(chars.size)]
37
- end
38
- ret.join
39
- end
40
-
41
- end
42
- end
43
- end
@@ -1,52 +0,0 @@
1
- # MySQL. Versions 5.0+ are recommended.
2
- #
3
- # Install the MYSQL driver
4
- # gem install mysql2
5
- #
6
- # Ensure the MySQL gem is defined in your Gemfile
7
- # gem 'mysql2'
8
- #
9
- # And be sure to use new-style password hashing:
10
- # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
- #
12
- default: &default
13
- adapter: mysql2
14
- encoding: utf8
15
- pool: 5
16
- username: <%= @app_name %>
17
- password: <%= @app_name %>
18
- socket: /var/lib/mysql/mysql.sock
19
-
20
- development:
21
- <<: *default
22
- database: <%= @app_name %>_dev
23
-
24
- # Warning: The database defined as "test" will be erased and
25
- # re-generated from your development database when you run "rake".
26
- # Do not set this db to the same as development or production.
27
- test:
28
- <<: *default
29
- database: <%= @app_name %>_test
30
-
31
- # As with config/secrets.yml, you never want to store sensitive information,
32
- # like your database password, in your source code. If your source code is
33
- # ever seen by anyone, they now have access to your database.
34
- #
35
- # Instead, provide the password as a unix environment variable when you boot
36
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
37
- # for a full rundown on how to provide these environment variables in a
38
- # production deployment.
39
- #
40
- # On Heroku and other platform providers, you may have a full connection URL
41
- # available as an environment variable. For example:
42
- #
43
- # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
44
- #
45
- # You can use this database configuration with:
46
- #
47
- # production:
48
- # url: <%= ENV['DATABASE_URL'] %>
49
- #
50
- production:
51
- <<: *default
52
- database: <%= @app_name %>_pro
@@ -1,14 +0,0 @@
1
- require_relative 'task_helper'
2
-
3
- namespace :dad do
4
- namespace :db do
5
-
6
- desc 'database.yml を生成します。'
7
- task :config do
8
- @app_name = File.basename(Rails.root)[0..15]
9
-
10
- template = File.join(File.dirname(__FILE__), 'db/database.yml.erb')
11
- render template, to: 'config/database.yml'
12
- end
13
- end
14
- end