capistrano-typo3 0.5.1 → 0.5.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: eb5cc54bbc6964dc71232417d6da19a4ec6fc865
4
- data.tar.gz: e41a7c8db712812e8f15ddfd2d4c9f3371a77442
3
+ metadata.gz: 67be3d0d96438f00b0c03bcea91920051b390926
4
+ data.tar.gz: f2314ba40882ddf06c37a5a2a2c431d57f05bd26
5
5
  SHA512:
6
- metadata.gz: 2a3df5af753a0fe65fb20e137f5003d8d890621f19436aaa044ec417d8958d0cd17b4b6c8647369ca5f4b3aceda22f3ca93e2dc318eece4d12a30ab8e4067ac1
7
- data.tar.gz: 336af96ecc43bb45bfefb26ea4948af3fd06448fdf2ba85c7b3151e126dff0304ba173bfb891d991e33c28b27fb54cd07f043af5228cd635492c71aa5bee52e4
6
+ metadata.gz: b79802466debf604b69dff6a6fe0ea59b0607fe4885e8b3f173446a915d1fa671dc135d28aa2788991c2e364901f75f5f18c36243e11325f80723e9b2aeb6c85
7
+ data.tar.gz: e6186356944254e77c67d47342110032481e5f5b398f724028c22167432dc1cc6e301e4d338ae99d48b72dce68fe5850e6b104a0e66bd0567dd421df89d121e5
@@ -21,4 +21,12 @@ namespace :git do
21
21
  end
22
22
  end
23
23
 
24
+ task "check_branch" do
25
+ current_branch = `git branch | grep \\* | cut -d ' ' -f2`.strip
26
+ if current_branch != fetch(:branch)
27
+ raise "current branch differs from homestead.rb configuration.\n see config/deploy/homestead.rb\n\n Current branch: #{current_branch}\n Homestead branch: #{fetch(:branch)} "
28
+ end
29
+ end
30
+
31
+
24
32
  end
@@ -0,0 +1,95 @@
1
+ namespace :sync do
2
+
3
+ desc 'sync files from production'
4
+ task :sync_files_from_production do
5
+ on roles(:allow_syncfiles) do
6
+ if fetch(:t3_live_sync)['filesync']
7
+ fetch(:t3_live_sync)['filesync'].each do |key,command|
8
+ execute "cd #{fetch(:deploy_to)} && #{command}"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ desc 'sync database from production and run sql updates'
15
+ task :sync_db_from_production do
16
+ on roles(:allow_syncdatabase) do
17
+
18
+ ignorestring = ""
19
+
20
+ if(:t3_db_sync_ignore_tables)
21
+
22
+ fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
23
+ ignorestring = "#{ignorestring} --ignore-table=#{fetch(:t3_live_sync)['dbsync']['dbname']}.#{ignore_tbl}"
24
+ end
25
+ end
26
+
27
+ # DUMP DATABASE TO IMAGE
28
+ execute <<DBSYNC1
29
+ ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
30
+ 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
31
+ -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
32
+ -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
33
+ #{ignorestring} \
34
+ #{fetch(:t3_live_sync)['dbsync']['dbname']} > /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
35
+ DBSYNC1
36
+
37
+ if(:t3_db_sync_ignore_tables)
38
+ fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
39
+
40
+ execute <<DBSYNC1
41
+ ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
42
+ 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
43
+ -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
44
+ -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
45
+ --no-data \
46
+ #{fetch(:t3_live_sync)['dbsync']['dbname']} #{ignore_tbl} >> /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
47
+ DBSYNC1
48
+ end
49
+ end
50
+
51
+ # COMPRESS IMAGE
52
+ execute <<DBSYNC2
53
+ ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
54
+ 'gzip -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
55
+ DBSYNC2
56
+
57
+ # TRANSFER IMAGE
58
+ execute <<DBSYNC3
59
+ scp #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']}:/tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz \
60
+ /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
61
+ DBSYNC3
62
+
63
+ # DECOMPRESS IMAGE
64
+ execute <<DBSYNC4
65
+ gunzip -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
66
+ DBSYNC4
67
+
68
+ # IMPORT AND REMOVE IMAGE
69
+ execute <<DBSYNC5
70
+ mysql -u#{fetch(:dbuser)} -h#{fetch(:dbhost)} -p#{fetch(:dbpass)} #{fetch(:dbname)} < /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']} && \
71
+ rm -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}
72
+ DBSYNC5
73
+
74
+ # REMOVE IMAGE
75
+ execute <<DBSYNC6
76
+ ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
77
+ 'rm -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz'
78
+ DBSYNC6
79
+ end
80
+
81
+ invoke 'sync:sql_updates'
82
+ end
83
+
84
+ desc 'run necessary sql queries for environment'
85
+ task :sql_updates do
86
+ on roles(:allow_syncdatabase) do
87
+ if fetch(:sql_updates)
88
+ fetch(:sql_updates).each do |command|
89
+ execute DT3MySQL::mysql_execute(command)
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ end
@@ -19,13 +19,15 @@ namespace :typo3 do
19
19
 
20
20
  desc "Setup a new production environment. Don't sync content from old production"
21
21
  task :setup_new_stage_no_sync do
22
- invoke 'typo3:helper:rm_deploy_to' #OKE
23
- invoke 'deploy' #OKE
24
- invoke 'typo3:helper:setup_shared_typo3_dirs' #OKE
25
- invoke 'typo3:helper:update_localconf' #OKE
26
- invoke 'typo3:helper:write_tsconstants' #OKE
27
- invoke 'typo3:helper:current_relative_symlink' #OKE
28
- invoke 'typo3:helper:restart_webserver' #OKE
22
+ invoke 'typo3:helper:rm_deploy_to'
23
+ invoke 'deploy'
24
+
25
+ invoke 'typo3:helper:setup_shared_typo3_dirs' unless fetch(:t3_skip_setup_shared_typo3_dirs)
26
+ invoke 'typo3:helper:update_localconf' unless fetch(:t3_skip_update_localconf)
27
+ invoke 'typo3:helper:write_tsconstants' unless fetch(:t3_skip_write_tsconstants)
28
+ invoke 'typo3:helper:current_relative_symlink' unless fetch(:t3_skip_current_relative_symlink)
29
+ invoke 'typo3:helper:restart_webserver' unless fetch(:t3_skip_restart_webserver)
30
+
29
31
  invoke 'typo3:helper:execute_post_deployment_commands'
30
32
 
31
33
  print "environment has been setup, you do need to sync content from old production"
@@ -34,17 +36,17 @@ namespace :typo3 do
34
36
  desc "Setup a new staged typo3 environment when a it's already in model"
35
37
  task :setup_new_stage_sync do
36
38
 
37
- invoke 'typo3:helper:rm_deploy_to' #OKE
38
- invoke 'deploy' #OKE
39
- invoke 'typo3:helper:setup_shared_typo3_dirs' #OKE
40
-
41
- invoke 'typo3:content:sync_files_from_production' #OKE
42
- invoke 'typo3:content:sync_db_from_production' #OKE
43
- invoke 'typo3:content:flush_cache_in_db' #OKE
44
- invoke 'typo3:helper:update_localconf' #OKE
45
- invoke 'typo3:helper:write_tsconstants' #OKE
46
- invoke 'typo3:helper:current_relative_symlink' #OKE
47
- invoke 'typo3:helper:restart_webserver' #OKE
39
+ invoke 'typo3:helper:rm_deploy_to'
40
+ invoke 'deploy'
41
+ invoke 'typo3:helper:setup_shared_typo3_dirs' unless fetch(:t3_skip_setup_shared_typo3_dirs)
42
+
43
+ invoke 'typo3:content:sync_files_from_production'
44
+ invoke 'typo3:content:sync_db_from_production'
45
+ invoke 'typo3:content:flush_cache_in_db'
46
+ invoke 'typo3:helper:update_localconf' unless fetch(:t3_skip_update_localconf)
47
+ invoke 'typo3:helper:write_tsconstants' unless fetch(:t3_skip_write_tsconstants)
48
+ invoke 'typo3:helper:current_relative_symlink' unless fetch(:t3_skip_current_relative_symlink)
49
+ invoke 'typo3:helper:restart_webserver' unless fetch(:t3_skip_restart_webserver)
48
50
  invoke 'typo3:helper:execute_post_deployment_commands'
49
51
  end
50
52
 
@@ -54,20 +56,20 @@ namespace :typo3 do
54
56
  invoke 'typo3:content:sync_files_from_production'
55
57
  invoke 'typo3:content:sync_db_from_production'
56
58
  invoke 'typo3:content:flush_cache_in_db'
57
- invoke 'typo3:helper:update_localconf'
58
- invoke 'typo3:helper:write_tsconstants' #OKE
59
- invoke 'typo3:helper:current_relative_symlink'
60
- invoke 'typo3:helper:restart_webserver'
59
+ invoke 'typo3:helper:update_localconf' unless fetch(:t3_skip_update_localconf)
60
+ invoke 'typo3:helper:write_tsconstants' unless fetch(:t3_skip_write_tsconstants)
61
+ invoke 'typo3:helper:current_relative_symlink' unless fetch(:t3_skip_current_relative_symlink)
62
+ invoke 'typo3:helper:restart_webserver' unless fetch(:t3_skip_restart_webserver)
61
63
  invoke 'typo3:helper:execute_post_deployment_commands'
62
64
  end
63
65
 
64
66
  desc "deploy the typo3 way"
65
67
  task :deploy do
66
68
  invoke 'deploy'
67
- invoke 'typo3:helper:update_localconf'
68
- invoke 'typo3:helper:write_tsconstants' #OKE
69
- invoke 'typo3:helper:current_relative_symlink'
70
- invoke 'typo3:helper:restart_webserver'
69
+ invoke 'typo3:helper:update_localconf' unless fetch(:t3_skip_update_localconf)
70
+ invoke 'typo3:helper:write_tsconstants' unless fetch(:t3_skip_write_tsconstants)
71
+ invoke 'typo3:helper:current_relative_symlink' unless fetch(:t3_skip_current_relative_symlink)
72
+ invoke 'typo3:helper:restart_webserver' unless fetch(:t3_skip_restart_webserver)
71
73
  invoke 'typo3:helper:execute_post_deployment_commands'
72
74
  end
73
75
 
@@ -57,30 +57,6 @@ deprecation_*.log
57
57
  end
58
58
  end
59
59
 
60
- desc "update LocalConf with correct db credentionals without SSH"
61
- task :update_localconf_local do
62
-
63
- system "echo '<?php' > dummy/typo3conf/AdditionalConfiguration.php"
64
-
65
- if fetch(:t3_add_unsafe_trusted_host_pattern)
66
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"SYS\"][\"trustedHostsPattern\"] = \".*\";' >> dummy/typo3conf/AdditionalConfiguration.php"
67
- end
68
-
69
- if fetch(:t3_store_db_credentials_in_addionalconf)
70
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"] = \"#{fetch(:dbname)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
71
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"host\"] = \"#{fetch(:dbhost)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
72
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"password\"] = \"#{fetch(:dbpass)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
73
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"] = \"#{fetch(:dbuser)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
74
- else
75
- cmd1 =Typo3Helper::make_set_localconf_database_settings_command(fetch(:dbname),fetch(:dbuser),fetch(:dbpass),fetch(:dbhost))
76
- system "cd #{fetch(:deploy_to)} && #{cmd1}"
77
-
78
- cmd2 = "mv #{fetch(:typo3_v6_local_conf_path)}.tmp #{fetch(:typo3_v6_local_conf_path)}"
79
- system "cd #{fetch(:deploy_to)} && #{cmd2}"
80
- end
81
- end
82
-
83
-
84
60
  desc "update LocalConf with correct db credentionals"
85
61
  task :update_localconf do
86
62
 
@@ -6,25 +6,34 @@ namespace :typo3 do
6
6
 
7
7
  desc "init site dirs from scratch (new installs)"
8
8
  task "init_site_dirs" do
9
- invoke 'typo3:vagrant:check_branch'
9
+ invoke 'git:check_branch'
10
10
 
11
11
  on roles(:all) do
12
12
  ## PURGE IF NEEDED
13
13
  execute "sudo rm -Rf #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
14
- execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
15
14
 
16
15
  ## CREATE
17
16
  execute "sudo mkdir -p #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
18
- execute "sudo chown -Rf vagrant.vagrant #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
17
+
18
+ ['fileadmin','typo3temp','uploads'].each do|dir|
19
+ begin
20
+ execute "sudo chown -Rfv vagrant.vagrant #{fetch(:deploy_to)}/shared/#{dir}"
21
+ rescue
22
+ print 'could not CHOWN #{dir}. Propably already owned by vagrant.vagrant'
23
+ end
24
+ end
25
+
26
+
19
27
  end
20
28
  end
21
29
 
22
30
 
23
- desc "init site database from scratch (new installs)"
31
+ desc "init site database from scratch (new installs) (danger: drops old)"
24
32
  task "init_site_database" do
25
- invoke 'typo3:vagrant:check_branch'
33
+ invoke 'git:check_branch'
26
34
 
27
35
  on roles(:all) do
36
+ execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
28
37
  execute "sudo mysql -e 'CREATE DATABASE #{fetch(:dbname)} CHARACTER SET utf8 COLLATE utf8_general_ci;'"
29
38
  end
30
39
  end
@@ -0,0 +1,14 @@
1
+ # vim: ft=ruby:sts=2:expandtab
2
+
3
+ namespace :typo3 do
4
+ namespace :util do
5
+
6
+ desc "flush typo3temp dir"
7
+ task :typo3temp_rm do
8
+ on roles(:all) do
9
+ execute "rm -Rfv #{fetch(:deploy_to)}/shared/typo3temp/*"
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -14,7 +14,7 @@ namespace :typo3 do
14
14
 
15
15
  desc "when homestead is not yet configured"
16
16
  task "init_homestead_conf" do
17
- invoke 'typo3:vagrant:check_branch'
17
+ invoke 'git:check_branch'
18
18
  sh "mkdir -p config"
19
19
  sh "cd config && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/vagrant.yml"
20
20
  sh "cd config/deploy && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/homestead.rb"
@@ -23,7 +23,7 @@ namespace :typo3 do
23
23
 
24
24
  desc "setup new homestead vagrant machine for TYPO3 development"
25
25
  task "setup_machine" do
26
- invoke 'typo3:vagrant:check_branch'
26
+ invoke 'git:check_branch'
27
27
 
28
28
  if `vagrant status | grep running`.strip != ""
29
29
  sh "vagrant destroy"
@@ -53,7 +53,7 @@ namespace :typo3 do
53
53
 
54
54
  desc "init site from scratch (new installs)"
55
55
  task "init_site" do
56
- invoke 'typo3:vagrant:check_branch'
56
+ invoke 'git:check_branch'
57
57
 
58
58
  on roles(:all) do
59
59
  ## PURGE IF NEEDED
@@ -96,7 +96,7 @@ MSG
96
96
 
97
97
  desc "setup site (remote exists)"
98
98
  task "setup_site" do
99
- invoke 'typo3:vagrant:check_branch'
99
+ invoke 'git:check_branch'
100
100
 
101
101
  on roles(:all) do
102
102
  ## PURGE IF NEEDED
@@ -154,12 +154,6 @@ MSG
154
154
  print "OBSOLETE: you can run 'setup_site' over and over again\n"
155
155
  end
156
156
 
157
- task "check_branch" do
158
- current_branch = `git branch | grep \\* | cut -d ' ' -f2`.strip
159
- if current_branch != fetch(:branch)
160
- raise "current branch differs from homestead.rb configuration.\n see config/deploy/homestead.rb\n\n Current branch: #{current_branch}\n Homestead branch: #{fetch(:branch)} "
161
- end
162
- end
163
157
 
164
158
  task "set_no_site" do
165
159
  on roles(:all) do
@@ -0,0 +1,46 @@
1
+ # vim: ft=ruby:sts=2:expandtab
2
+
3
+ namespace :wp do
4
+
5
+ namespace :homestead do
6
+
7
+ desc "init site dirs from scratch (new installs)"
8
+ task "init_site_dirs" do
9
+ invoke 'git:check_branch'
10
+
11
+ on roles(:all) do
12
+ execute "sudo rm -Rf #{fetch(:deploy_to)}/shared/uploads"
13
+ execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
14
+
15
+ execute "sudo mkdir -p #{fetch(:deploy_to)}/shared/uploads"
16
+ execute "sudo chown vagrant.vagrant -Rf #{fetch(:deploy_to)}/shared/uploads"
17
+ end
18
+ end
19
+
20
+ desc "init site database from scratch (new installs)"
21
+ task "init_site_database" do
22
+ invoke 'git:check_branch'
23
+
24
+ on roles(:all) do
25
+ execute "sudo mysql -e 'CREATE DATABASE #{fetch(:dbname)} CHARACTER SET utf8 COLLATE utf8_general_ci;'"
26
+ end
27
+ end
28
+
29
+ desc "setup site (existing installs)"
30
+ task "setup_site" do
31
+ invoke 'wp:homestead:init_site_dirs'
32
+ invoke 'wp:homestead:init_site_database'
33
+
34
+ invoke 'deploy:fixknownhosts'
35
+ invoke 'sync:sync_db_from_production'
36
+
37
+ #WP update config
38
+
39
+ invoke 'sync:sync_files_from_production'
40
+ invoke 'typo3:helper:restart_webserver'
41
+ end
42
+
43
+ end
44
+ end
45
+
46
+
@@ -6,19 +6,22 @@ require "capistrano/typo3/dt3_div"
6
6
  require "capistrano/typo3/dt3_mysql"
7
7
  require 'yaml' # Built in, no gem required
8
8
 
9
-
10
-
11
9
  TYPO3_DB_DUMP_DIR = 'db_dumps'
12
10
 
13
11
  load File.expand_path('../tasks/typo3.cap', __FILE__)
14
12
  load File.expand_path('../tasks/typo3content.cap', __FILE__)
15
13
  load File.expand_path('../tasks/typo3helper.cap', __FILE__)
14
+ load File.expand_path('../tasks/typo3util.cap', __FILE__)
16
15
  load File.expand_path('../tasks/typo3homestead.cap', __FILE__)
17
16
  load File.expand_path('../tasks/typo3test.cap', __FILE__)
18
17
  load File.expand_path('../tasks/typo3vagrant.cap', __FILE__)
18
+
19
+ load File.expand_path('../tasks/wp_homestead.cap', __FILE__)
20
+
19
21
  load File.expand_path('../tasks/deploy.cap', __FILE__)
20
22
  load File.expand_path('../tasks/git.cap', __FILE__)
21
23
  load File.expand_path('../tasks/db.cap', __FILE__)
24
+ load File.expand_path('../tasks/sync.cap', __FILE__)
22
25
 
23
26
 
24
27
 
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Typo3
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-typo3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-11 00:00:00.000000000 Z
11
+ date: 2018-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,12 +88,15 @@ files:
88
88
  - lib/capistrano/tasks/db.cap
89
89
  - lib/capistrano/tasks/deploy.cap
90
90
  - lib/capistrano/tasks/git.cap
91
+ - lib/capistrano/tasks/sync.cap
91
92
  - lib/capistrano/tasks/typo3.cap
92
93
  - lib/capistrano/tasks/typo3content.cap
93
94
  - lib/capistrano/tasks/typo3helper.cap
94
95
  - lib/capistrano/tasks/typo3homestead.cap
95
96
  - lib/capistrano/tasks/typo3test.cap
97
+ - lib/capistrano/tasks/typo3util.cap
96
98
  - lib/capistrano/tasks/typo3vagrant.cap
99
+ - lib/capistrano/tasks/wp_homestead.cap
97
100
  - lib/capistrano/typo3.rb
98
101
  - lib/capistrano/typo3/dt3_div.rb
99
102
  - lib/capistrano/typo3/dt3_mysql.rb