eac_tools 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +28 -17
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/applications/base.rb +2 -2
  5. data/sub/avm/lib/avm/entries/auto_values/entry.rb +32 -0
  6. data/sub/avm/lib/avm/entries/auto_values.rb +11 -0
  7. data/sub/avm/lib/avm/{instances/entries.rb → entries/base.rb} +9 -5
  8. data/sub/avm/lib/avm/{instances → entries}/entry.rb +3 -12
  9. data/sub/avm/lib/avm/entries.rb +9 -0
  10. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +3 -2
  11. data/sub/avm/lib/avm/instances/base.rb +2 -2
  12. data/sub/avm/lib/avm/version.rb +1 -1
  13. data/sub/avm-eac_asciidoctor_base0/Gemfile +8 -0
  14. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/avm-eac_asciidoctor_base0.gemspec +0 -0
  15. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/apache_host.rb +0 -0
  16. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/apache_path.rb +0 -0
  17. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/deploy.rb +0 -0
  18. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/instance.rb +0 -0
  19. data/sub/{avm-tools/lib/avm/tools/runner/eac_asciidoctor_base0.rb → avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners/base.rb} +3 -4
  20. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners.rb +11 -0
  21. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/base.rb +0 -0
  22. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +0 -0
  23. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/build.rb +0 -0
  24. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +0 -0
  25. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/runner.rb +0 -0
  26. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +54 -0
  27. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners.rb +13 -0
  28. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources.rb +0 -0
  29. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  30. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0.rb +0 -0
  31. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +0 -0
  32. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/rubocop_spec.rb +0 -0
  33. data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/spec_helper.rb +0 -0
  34. data/sub/avm-eac_webapp_base0/Gemfile +8 -0
  35. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +22 -0
  36. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_host.rb +78 -0
  37. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  38. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
  39. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
  40. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/file_unit.rb +42 -0
  41. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/git_info.rb +62 -0
  42. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/version.rb +24 -0
  43. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
  44. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy.rb +73 -0
  45. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  46. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +62 -0
  47. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/apache_host.rb +35 -0
  48. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  49. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/dump.rb +63 -0
  50. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/load.rb +55 -0
  51. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data.rb +17 -0
  52. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/deploy.rb +39 -0
  53. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner.rb +12 -0
  54. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources/base.rb +15 -0
  55. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources.rb +11 -0
  56. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +7 -0
  57. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0.rb +9 -0
  58. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/sources/base_spec.rb +7 -0
  59. data/sub/avm-eac_webapp_base0/spec/rubocop_spec.rb +3 -0
  60. data/sub/avm-eac_webapp_base0/spec/spec_helper.rb +4 -0
  61. data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/apache_host/no_ssl.conf +11 -0
  62. data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  63. data/sub/avm-tools/avm-tools.gemspec +0 -1
  64. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  65. metadata +93 -26
  66. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_asciidoctor_base0/build.rb +0 -56
  67. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +0 -14
  68. data/sub/avm-tools/sub/avm-eac_asciidoctor_base0/Gemfile +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8e33f3e6179cddcf3aaa81d8bed6e2396944fb81bc6064ebaaf2101301db2ff
4
- data.tar.gz: 6217ef998e5b4222b90295be158905905e12573cf1d83ace772a70325de003c4
3
+ metadata.gz: 435984e41a0bf529de374dc9e4640143f9e9caf7a26118d11ce65e6879488ed2
4
+ data.tar.gz: 99c63bd9a4b686211df32d65762873913e21b245a21535e3bc0f3ef8d9e81080
5
5
  SHA512:
6
- metadata.gz: 49ab7e7819b789a1b13fb29c86c93f8b11c36f5b7d7b4ccc7e42aa62e211b5989c6f1fc5e04db2fa39266cbbb192286ad444ee55d0be1e31e7977895376418d5
7
- data.tar.gz: 4cd10a7625697c078772c15883487e35644986a5bccaff9a06e4ad0f5467fffe82db0ab17aa404dfd3245112bf1c5f924bd247cbe361614ba5021cd0156902f0
6
+ metadata.gz: 31d1736330d976d3a50e14fa312b2ce826227fea5da3fb3a9bfd846a9a870a7a36244f11f7ac77989bd6773f6f8dbf797ed4065b0061256dbaacd4468d047052
7
+ data.tar.gz: ec2df47e102ed54df74f8f35ffb52038d272c20879900c88aaf27058be34c0d2527a96b6f21c4c0dd81b0a70d42d1ff6e166d045a311c9cd411cdc89ebb2afbe
data/Gemfile.lock CHANGED
@@ -1,16 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.14.0)
4
+ eac_tools (0.15.0)
5
+ avm-eac_asciidoctor_base0 (~> 0.4)
5
6
  avm-eac_generic_base0 (~> 0.4)
6
7
  avm-eac_rails_base0 (~> 0.6, >= 0.6.1)
7
8
  avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
8
9
  avm-eac_redmine_base0 (~> 0.11)
9
10
  avm-eac_redmine_plugin_base0 (~> 0.3)
10
11
  avm-eac_ruby_base1 (~> 0.12)
11
- avm-tools (~> 0.127)
12
+ avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
13
+ avm-tools (~> 0.128)
12
14
  eac_ruby_utils (~> 0.97)
13
15
 
16
+ PATH
17
+ remote: sub/avm-eac_asciidoctor_base0
18
+ specs:
19
+ avm-eac_asciidoctor_base0 (0.4.0)
20
+ asciidoctor (~> 2.0, >= 2.0.12)
21
+ avm-eac_webapp_base0 (~> 0.2)
22
+ eac_ruby_utils (~> 0.63)
23
+ os
24
+ rouge (~> 3.26)
25
+
14
26
  PATH
15
27
  remote: sub/avm-eac_generic_base0
16
28
  specs:
@@ -62,13 +74,22 @@ PATH
62
74
  avm-eac_generic_base0 (~> 0.2)
63
75
  eac_ruby_utils (~> 0.95, >= 0.95.1)
64
76
 
77
+ PATH
78
+ remote: sub/avm-eac_webapp_base0
79
+ specs:
80
+ avm-eac_webapp_base0 (0.3.1)
81
+ avm (~> 0.1)
82
+ avm-eac_generic_base0 (~> 0.1)
83
+ avm-eac_postgresql_base0 (~> 0.1)
84
+ avm-eac_ubuntu_base0 (~> 0.3)
85
+ eac_ruby_utils (~> 0.68)
86
+
65
87
  PATH
66
88
  remote: sub/avm-tools
67
89
  specs:
68
- avm-tools (0.127.0)
90
+ avm-tools (0.128.0)
69
91
  aranha-parsers (~> 0.4)
70
92
  avm (~> 0.30)
71
- avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
72
93
  avm-eac_ruby_base1 (~> 0.8)
73
94
  avm-eac_ubuntu_base0 (~> 0.3)
74
95
  avm-files (~> 0.1)
@@ -82,7 +103,7 @@ PATH
82
103
  PATH
83
104
  remote: sub/avm
84
105
  specs:
85
- avm (0.32.0)
106
+ avm (0.33.0)
86
107
  eac_cli (~> 0.27, >= 0.27.6)
87
108
  eac_config (~> 0.10)
88
109
  eac_docker (~> 0.3)
@@ -164,12 +185,6 @@ GEM
164
185
  ofx-parser (~> 1.1.0)
165
186
  asciidoctor (2.0.17)
166
187
  ast (2.4.2)
167
- avm-eac_asciidoctor_base0 (0.3.4)
168
- asciidoctor (~> 2.0, >= 2.0.12)
169
- avm-eac_webapp_base0 (~> 0.2)
170
- eac_ruby_utils (~> 0.63)
171
- os
172
- rouge (~> 3.26)
173
188
  avm-eac_postgresql_base0 (0.2.0)
174
189
  avm (~> 0.12, >= 0.12.1)
175
190
  eac_ruby_utils (~> 0.82)
@@ -177,12 +192,6 @@ GEM
177
192
  avm (~> 0.7)
178
193
  eac_ruby_utils (~> 0.77, >= 0.77.1)
179
194
  eac_templates (~> 0.3)
180
- avm-eac_webapp_base0 (0.3.0)
181
- avm (~> 0.1)
182
- avm-eac_generic_base0 (~> 0.1)
183
- avm-eac_postgresql_base0 (~> 0.1)
184
- avm-eac_ubuntu_base0 (~> 0.3)
185
- eac_ruby_utils (~> 0.68)
186
195
  avm-files (0.3.2)
187
196
  avm (~> 0.6)
188
197
  eac_fs (~> 0.5)
@@ -310,12 +319,14 @@ PLATFORMS
310
319
 
311
320
  DEPENDENCIES
312
321
  avm!
322
+ avm-eac_asciidoctor_base0!
313
323
  avm-eac_generic_base0!
314
324
  avm-eac_rails_base0!
315
325
  avm-eac_rails_base1!
316
326
  avm-eac_redmine_base0!
317
327
  avm-eac_redmine_plugin_base0!
318
328
  avm-eac_ruby_base1!
329
+ avm-eac_webapp_base0!
319
330
  avm-tools!
320
331
  eac_cli!
321
332
  eac_config!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.14.0'
4
+ VERSION = '0.15.0'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/entries'
3
+ require 'avm/entries/base'
4
4
  require 'avm/registry'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
 
@@ -9,7 +9,7 @@ module Avm
9
9
  class Base
10
10
  enable_simple_cache
11
11
  require_sub __FILE__, include_modules: true
12
- include ::Avm::Instances::Entries
12
+ include ::Avm::Entries::Base
13
13
 
14
14
  LOCAL_INSTANCE_SUFFIX = 'dev'
15
15
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_config/node'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module AutoValues
9
+ class Entry
10
+ class << self
11
+ def auto_value_method_name(suffix)
12
+ "auto_#{suffix.to_s.gsub('.', '_')}"
13
+ end
14
+ end
15
+
16
+ common_constructor :entries_provider, :suffix
17
+
18
+ def auto_value_method
19
+ self.class.auto_value_method_name(suffix)
20
+ end
21
+
22
+ def found?
23
+ entries_provider.respond_to?(auto_value_method, true)
24
+ end
25
+
26
+ def value
27
+ entries_provider.if_respond(auto_value_method)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ module AutoValues
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -1,17 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'avm/instances/entry'
4
+ require 'avm/entries/entry'
5
5
 
6
6
  module Avm
7
- module Instances
8
- module Entries
7
+ module Entries
8
+ module Base
9
+ def entries_provider_id
10
+ id
11
+ end
12
+
9
13
  def entry(suffix, options = {})
10
- ::Avm::Instances::Entry.new(self, suffix, options)
14
+ ::Avm::Entries::Entry.new(self, suffix, options)
11
15
  end
12
16
 
13
17
  def path_prefix
14
- @path_prefix ||= [id].freeze
18
+ @path_prefix ||= [entries_provider_id].freeze
15
19
  end
16
20
 
17
21
  def read_entry(entry_suffix, options = {})
@@ -1,25 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/entries/auto_values/entry'
3
4
  require 'eac_config/node'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
7
- module Instances
8
+ module Entries
8
9
  class Entry
9
- class << self
10
- def auto_value_method_name(suffix)
11
- "auto_#{suffix.to_s.gsub('.', '_')}"
12
- end
13
- end
14
-
15
10
  common_constructor :parent, :suffix, :options
16
11
 
17
12
  def auto_value
18
- parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
19
- end
20
-
21
- def auto_value_method
22
- self.class.auto_value_method_name(suffix)
13
+ ::Avm::Entries::AutoValues::Entry.new(parent, suffix).value
23
14
  end
24
15
 
25
16
  def full_path
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/entry'
3
+ require 'avm/entries/auto_values/entry'
4
+ require 'avm/entries/entry'
4
5
  require 'avm/instances/entry_keys'
5
6
 
6
7
  module Avm
@@ -11,7 +12,7 @@ module Avm
11
12
  ::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
12
13
  .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
14
  .each do |mailer_key|
14
- define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
15
+ define_method ::Avm::Entries::AutoValues::Entry.auto_value_method_name(mailer_key) do
15
16
  mailer_auto_common(mailer_key)
16
17
  end
17
18
  end
@@ -4,7 +4,7 @@ require 'avm/with/application_stereotype'
4
4
  require 'avm/with/extra_subcommands'
5
5
  require 'eac_ruby_utils/require_sub'
6
6
  require 'eac_ruby_utils/simple_cache'
7
- require 'avm/instances/entries'
7
+ require 'avm/entries/base'
8
8
 
9
9
  module Avm
10
10
  module Instances
@@ -13,7 +13,7 @@ module Avm
13
13
  enable_listable
14
14
  enable_simple_cache
15
15
  require_sub __FILE__, include_modules: true
16
- include ::Avm::Instances::Entries
16
+ include ::Avm::Entries::Base
17
17
  include ::Avm::With::ExtraSubcommands
18
18
  include ::Avm::With::ApplicationStereotype
19
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.32.0'
4
+ VERSION = '0.33.0'
5
5
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/runner'
4
- require 'avm/eac_asciidoctor_base0'
5
4
 
6
5
  module Avm
7
- module Tools
8
- class Runner
9
- class EacAsciidoctorBase0 < ::Avm::EacWebappBase0::Runner
6
+ module EacAsciidoctorBase0
7
+ module Runners
8
+ class Base < ::Avm::EacWebappBase0::Runner
10
9
  require_sub __FILE__
11
10
  end
12
11
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ module Runners
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/tools/core_ext'
4
+ require 'avm/eac_asciidoctor_base0/sources/build'
5
+ require 'os'
6
+
7
+ module Avm
8
+ module EacAsciidoctorBase0
9
+ module Sources
10
+ module Runners
11
+ class Build
12
+ runner_with :help do
13
+ desc 'Build the project'
14
+ arg_opt '-d', '--target-dir', 'Directory to build'
15
+ bool_opt '--open', 'Show the result.'
16
+ end
17
+
18
+ def run
19
+ start_banner
20
+ build.run
21
+ open
22
+ end
23
+
24
+ private
25
+
26
+ def build_uncached
27
+ ::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:project),
28
+ target_directory: parsed.target_dir)
29
+ end
30
+
31
+ def default_target_directory
32
+ runner_context.call(:project).root.join('build')
33
+ end
34
+
35
+ def open
36
+ return unless parsed.open?
37
+
38
+ infom "Opening \"#{open_path}\"..."
39
+ ::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
40
+ end
41
+
42
+ def open_path
43
+ build.source_files.first.target_path
44
+ end
45
+
46
+ def start_banner
47
+ runner_context.call(:project_banner)
48
+ infov 'Target directory', build.target_directory
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ module Sources
8
+ module Runners
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.3.4'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/eac_webapp_base0/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-eac_webapp_base0'
9
+ s.version = Avm::EacWebappBase0::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib,template}/**/*']
14
+
15
+ s.add_dependency 'avm', '~> 0.1'
16
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.1'
17
+ s.add_dependency 'avm-eac_postgresql_base0', '~> 0.1'
18
+ s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.68'
20
+
21
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
22
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/jobs/base'
5
+ require 'avm/eac_ubuntu_base0/apache'
6
+ require 'eac_templates/core_ext'
7
+
8
+ module Avm
9
+ module EacWebappBase0
10
+ class ApacheHost
11
+ JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
12
+ run_certbot enable_ssl_site reload_apache].freeze
13
+ include ::Avm::Jobs::Base
14
+
15
+ def no_ssl_site_content
16
+ ::Avm::EacWebappBase0::ApacheHost
17
+ .template.child('no_ssl.conf')
18
+ .apply(variables_source)
19
+ end
20
+
21
+ def ssl?
22
+ options[:certbot]
23
+ end
24
+
25
+ private
26
+
27
+ def apache_uncached
28
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
29
+ end
30
+
31
+ def enable_no_ssl_site
32
+ infom 'Enabling no SSL site...'
33
+ no_ssl_site.enable
34
+ end
35
+
36
+ def enable_ssl_site
37
+ return unless ssl?
38
+
39
+ infom 'Enabling SSL site...'
40
+ ssl_site.enable
41
+ end
42
+
43
+ def no_ssl_site_uncached
44
+ apache.site(instance.id)
45
+ end
46
+
47
+ def reload_apache
48
+ infom 'Reloading Apache...'
49
+ apache.service('reload')
50
+ end
51
+
52
+ def remove_ssl_site
53
+ infom 'Removing SSL site...'
54
+ ssl_site.remove
55
+ end
56
+
57
+ def run_certbot
58
+ return unless ssl?
59
+
60
+ infom 'Running Certbot...'
61
+ instance.host_env.command(
62
+ 'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'),
63
+ '--redirect', '--non-interactive', '--agree-tos',
64
+ '--email', instance.read_entry('admin.email')
65
+ ).system!
66
+ end
67
+
68
+ def ssl_site_uncached
69
+ apache.site(no_ssl_site.name + '-le-ssl')
70
+ end
71
+
72
+ def write_available_no_ssl_site
73
+ infom 'Writing no SSL site conf...'
74
+ no_ssl_site.write(no_ssl_site_content)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class ApachePath
10
+ JOBS = %w[write_available_conf enable_conf reload_apache].freeze
11
+ include ::Avm::Jobs::Base
12
+
13
+ def content
14
+ ::Avm::EacWebappBase0::ApachePath.template.child('default.conf').apply(variables_source)
15
+ end
16
+
17
+ def document_root
18
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
19
+ end
20
+
21
+ def extra_content
22
+ ''
23
+ end
24
+
25
+ private
26
+
27
+ def apache_uncached
28
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
29
+ end
30
+
31
+ def enable_conf
32
+ infom 'Enabling configuration...'
33
+ conf.enable
34
+ end
35
+
36
+ def reload_apache
37
+ infom 'Reloading Apache...'
38
+ apache.service('reload')
39
+ end
40
+
41
+ def conf_uncached
42
+ apache.conf(instance.id)
43
+ end
44
+
45
+ def write_available_conf
46
+ infom 'Writing available configuration...'
47
+ conf.write(content)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/path_string'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Deploy
8
+ module AppendedDirectories
9
+ APPENDED_DIRECTORIES_ENTRY_KEY = 'deploy.appended_directories'
10
+
11
+ def appended_directories
12
+ appended_directories_from_instance_entry + appended_directories_from_options
13
+ end
14
+
15
+ def appended_directories_from_instance_entry
16
+ ::Avm::PathString.paths(instance.read_entry_optional(APPENDED_DIRECTORIES_ENTRY_KEY))
17
+ end
18
+
19
+ def appended_directories_from_options
20
+ options[OPTION_APPENDED_DIRECTORIES] || []
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end