avm-tools 0.18.0 → 0.19.0

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
  SHA256:
3
- metadata.gz: 7aac25bb0c585e13aa100af2ab6ff42d830b575cfd423a873c99b799bd1cd58c
4
- data.tar.gz: f2b38abd01c102a189b2f224c09e32a3738d7168be4aa3eff2fcfe6c2c1c9f5e
3
+ metadata.gz: 0ecbab04ccca2c30b62ceb4a779d86ef11590ad4e82558593d42e2cc10e17deb
4
+ data.tar.gz: 1b7dd104d1f0f81d32212a74ad3e6bed6c43d44d1b82c689ec06ab8ef3f7fa3c
5
5
  SHA512:
6
- metadata.gz: b72bb22e2fa79eb43f6adeb6c7aeb3021167055c8d903cab131caa9aca00aed799ba1aa12b968f3382cec180b7954ea7ad89b5db0cced4f474e15e2d0182da4e
7
- data.tar.gz: 76c35f6f8f8023356b47f2866ce9e38291dd8bb256b2faf0c4da0859cde0c63f7fea138377e9d3370549aa82d6bd305feacbcd3cd79cbeb66b64dce2c4d891bc
6
+ metadata.gz: c06af4841c27bdfb6847dc521c18a0283ae85df3615714976d95b1aac461b70e9c4c808409b13a76fde3918f1835ef568e2e9751e4edf5ed5b549c969cca727b
7
+ data.tar.gz: 163f4a885519835eb5fdc794e7a7a919ac2c1be7782be0e47b2493859fd1734e576e5ba634caac342d9b1b144af7d0917b1f8c23a70486c510aeb4e42c37aa8f
@@ -70,6 +70,7 @@ module Avm
70
70
  mkdir_target
71
71
  clear_content
72
72
  send_untar_package
73
+ set_target_permission
73
74
  end
74
75
  end
75
76
 
@@ -108,6 +109,10 @@ module Avm
108
109
  tar_build_command.pipe(untar_build_command).execute!
109
110
  end
110
111
 
112
+ def set_target_permission
113
+ target_env.command('chmod', '755', target_path).execute!
114
+ end
115
+
111
116
  def git_archive_command
112
117
  commit.git.command('archive', '--format=tar', commit.sha1)
113
118
  end
@@ -6,6 +6,40 @@ module Avm
6
6
  module Stereotypes
7
7
  module EacRailsBase0
8
8
  class Deploy < ::Avm::Stereotypes::EacWebappBase0::Deploy
9
+ set_callback :assert_instance_branch, :after do
10
+ bundle_install
11
+ assert_database
12
+ database_migrate
13
+ compile_assets
14
+ touch_restart_file
15
+ end
16
+
17
+ def assert_database
18
+ infom 'Asserting database...'
19
+ instance.rake('db:create').system!
20
+ end
21
+
22
+ def bundle_install
23
+ infom 'Running "bundle install"...'
24
+ instance.bundle('install').system!
25
+ end
26
+
27
+ def compile_assets
28
+ infom 'Compiling assets...'
29
+ instance.rake('assets:clean', 'assets:precompile').system!
30
+ end
31
+
32
+ def database_migrate
33
+ infom 'Running database migrations...'
34
+ instance.rake('db:migrate').system!
35
+ end
36
+
37
+ def touch_restart_file
38
+ infom 'Touching restart file...'
39
+ instance.host_env.command(
40
+ 'touch', ::File.join(instance.read_entry(:fs_path), 'tmp', 'restart.txt')
41
+ ).system!
42
+ end
9
43
  end
10
44
  end
11
45
  end
@@ -7,6 +7,17 @@ module Avm
7
7
  module EacRailsBase0
8
8
  class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
9
9
  FILES_UNITS = { uploads: 'public/uploads' }.freeze
10
+
11
+ def bundle(*args)
12
+ host_env.command('bundle', *args)
13
+ .envvar('BUNDLE_GEMFILE', ::File.join(read_entry('fs_path'), 'Gemfile'))
14
+ .envvar('RAILS_ENV', 'production')
15
+ .chdir(read_entry('fs_path'))
16
+ end
17
+
18
+ def rake(*args)
19
+ bundle('exec', 'rake', *args)
20
+ end
10
21
  end
11
22
  end
12
23
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/callbacks'
3
4
  require 'delegate'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
  require 'eac_launcher/git/base'
@@ -10,9 +11,14 @@ module Avm
10
11
  module Stereotypes
11
12
  module EacWebappBase0
12
13
  class Deploy
14
+ include ::ActiveSupport::Callbacks
15
+
13
16
  enable_console_speaker
14
17
  enable_simple_cache
15
18
 
19
+ JOBS = %w[git_deploy setup_files_units assert_instance_branch].freeze
20
+ define_callbacks(*JOBS)
21
+
16
22
  attr_reader :instance, :git_reference
17
23
 
18
24
  def initialize(instance, git_reference)
@@ -22,9 +28,11 @@ module Avm
22
28
 
23
29
  def run
24
30
  start_banner
25
- git_deploy
26
- setup_files_units
27
- assert_instance_branch
31
+ JOBS.each do |job|
32
+ run_callbacks job do
33
+ send(job)
34
+ end
35
+ end
28
36
  ::Avm::Result.success('Deployed')
29
37
  rescue ::Avm::Result::Error => e
30
38
  e.to_result
@@ -7,7 +7,7 @@ module Avm
7
7
  module Templates
8
8
  class << self
9
9
  def template(subpath, required = true)
10
- path = template_path
10
+ path = template_path(subpath)
11
11
  if path.blank?
12
12
  return nil unless required
13
13
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.18.0'
5
+ VERSION = '0.19.0'
6
6
  end
7
7
  end
@@ -0,0 +1,20 @@
1
+ default: &default
2
+ adapter: %%DATABASE.SYSTEM%%
3
+ pool: 40
4
+ timeout: 5000
5
+ encoding: unicode
6
+ username: %%DATABASE.USERNAME%%
7
+ password: %%DATABASE.PASSWORD%%
8
+ host: %%DATABASE.HOSTNAME%%
9
+ port: %%DATABASE.PORT%%
10
+
11
+ development: &development
12
+ <<: *default
13
+ database: %%DATABASE.NAME%%
14
+
15
+ production:
16
+ <<: *development
17
+
18
+ test:
19
+ <<: *default
20
+ database: %%DATABASE.NAME%%_test
@@ -0,0 +1,90 @@
1
+ <?php
2
+ /**
3
+ * The base configuration for WordPress
4
+ *
5
+ * The wp-config.php creation script uses this file during the
6
+ * installation. You don't have to use the web site, you can
7
+ * copy this file to "wp-config.php" and fill in the values.
8
+ *
9
+ * This file contains the following configurations:
10
+ *
11
+ * * MySQL settings
12
+ * * Secret keys
13
+ * * Database table prefix
14
+ * * ABSPATH
15
+ *
16
+ * @link https://codex.wordpress.org/Editing_wp-config.php
17
+ *
18
+ * @package WordPress
19
+ */
20
+
21
+ // ** MySQL settings - You can get this info from your web host ** //
22
+ /** The name of the database for WordPress */
23
+ define( 'DB_NAME', '%%DATABASE_NAME%%' );
24
+
25
+ /** MySQL database username */
26
+ define( 'DB_USER', '%%DATABASE_USER%%' );
27
+
28
+ /** MySQL database password */
29
+ define( 'DB_PASSWORD', '%%DATABASE_PASSWORD%%' );
30
+
31
+ /** MySQL hostname */
32
+ define( 'DB_HOST', 'localhost' );
33
+
34
+ /** Database Charset to use in creating database tables. */
35
+ define( 'DB_CHARSET', 'utf8' );
36
+
37
+ /** The Database Collate type. Don't change this if in doubt. */
38
+ define( 'DB_COLLATE', '' );
39
+
40
+ /**#@+
41
+ * Authentication Unique Keys and Salts.
42
+ *
43
+ * Change these to different unique phrases!
44
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
45
+ } * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
46
+ *
47
+ * @since 2.6.0
48
+ */
49
+ define('AUTH_KEY', '%%AUTH_KEY%%');
50
+ define('SECURE_AUTH_KEY', '%%SECURE_AUTH_KEY%%');
51
+ define('LOGGED_IN_KEY', '%%LOGGED_IN_KEY%%');
52
+ define('NONCE_KEY', '%%NONCE_KEY%%');
53
+ define('AUTH_SALT', '%%AUTH_SALT%%');
54
+ define('SECURE_AUTH_SALT', '%%SECURE_AUTH_SALT%%');
55
+ define('LOGGED_IN_SALT', '%%LOGGED_IN_SALT%%');
56
+ define('NONCE_SALT', '%%NONCE_SALT%%');
57
+
58
+ /**#@-*/
59
+
60
+ /**
61
+ * WordPress Database Table prefix.
62
+ *
63
+ * You can have multiple installations in one database if you give each
64
+ * a unique prefix. Only numbers, letters, and underscores please!
65
+ */
66
+ $table_prefix = 'wp_';
67
+
68
+ /**
69
+ * For developers: WordPress debugging mode.
70
+ *
71
+ * Change this to true to enable the display of notices during development.
72
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
73
+ * in their development environments.
74
+ *
75
+ * For information on other constants that can be used for debugging,
76
+ * visit the Codex.
77
+ *
78
+ * @link https://codex.wordpress.org/Debugging_in_WordPress
79
+ */
80
+ define( 'WP_DEBUG', false );
81
+
82
+ /* That's all, stop editing! Happy publishing. */
83
+
84
+ /** Absolute path to the WordPress directory. */
85
+ if ( ! defined( 'ABSPATH' ) ) {
86
+ define( 'ABSPATH', dirname( __FILE__ ) . '/' );
87
+ }
88
+
89
+ /** Sets up WordPress vars and included files. */
90
+ require_once( ABSPATH . 'wp-settings.php' );
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
@@ -249,6 +249,8 @@ files:
249
249
  - lib/avm/tools/runner/git/issue.rb
250
250
  - lib/avm/tools/runner/git/issue/complete.rb
251
251
  - lib/avm/tools/version.rb
252
+ - template/avm/stereotypes/eac_rails_base0/deploy/config/database.yml.template
253
+ - template/avm/stereotypes/eac_wordpress_base0/deploy/wp-config.php.template
252
254
  homepage:
253
255
  licenses: []
254
256
  metadata: {}