evt-command_line-component_generator 2.0.1.5 → 2.0.2.0

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: c4b30b1ed028ad5f2b53c8f25524af784302bc8e2108c4c04bdb7a3e806c4fe9
4
- data.tar.gz: 97c65714c1794e29264d7bc2c36e0b853d45fd71f4dd600f9f922d4601c213af
3
+ metadata.gz: e9dc83ce90b7d40d49debcda7337476597c604c5eb465a78d61a3e4faf8208fa
4
+ data.tar.gz: f03dd4d8d0967ca8aa516de2da62f0e18859902c2befee732ec65f30a7b4d727
5
5
  SHA512:
6
- metadata.gz: eb64299460d8e399deaae1e16efb2b624b97abf1687015511f9137fca5459954df509ab6b5dd93188883a3dc701a4c6148c1d4a17e9e0a460ff08de11b5f1375
7
- data.tar.gz: 7dd6917860cedf66340c71711381884c7d3a2e27c5713341c7e5eb55fbb3ff91aaa6f5f647a7837316cb4967b0babc89ed1dc231a9dcd3c543fa7bb39e2d97da
6
+ metadata.gz: ab294844b21cd720792cb5ebc1ec12ae44291f66f3801bd41d533a869ff5c6d12126af9562c0edabbf45b9784bffe908fcb010af1985ce31a9303af118438a52
7
+ data.tar.gz: 91618c55dcd7a1464ef7eaab75671cbcf7a03a6a584a01c0ba9b47e6a667aafbedbde38d53dcb7613f528a1cee0eacb64d1250fca7327a0388fb17fac7cd1266
@@ -49,8 +49,8 @@ module CommandLine
49
49
 
50
50
  def assign_executable_attribute
51
51
  chmod './install-gems.sh', 0755
52
+ chmod './symlink-lib.sh', 0755
52
53
  chmod './test.sh', 0755
53
- chmod 'script/test-database-connection', 0755
54
54
  chmod 'script/start', 0755
55
55
  end
56
56
  end
@@ -1,20 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
- s.name = '<%= component_name %>'
4
- s.version = '0.0.0'
5
- s.summary = ' '
6
- s.description = ' '
3
+ s.name = "<%= component_name %>"
4
+ s.version = "0.0.0"
5
+ s.summary = " "
6
+ s.description = " "
7
7
 
8
- s.authors = ['email@domain.com']
9
- s.homepage = 'http://domain.com'
10
- s.licenses = ['TODO']
8
+ s.authors = ["email@domain.com"]
9
+ s.homepage = "http://domain.com"
10
+ s.licenses = ["TODO"]
11
11
 
12
- s.require_paths = ['lib']
13
- s.files = Dir.glob('{lib}/**/*')
12
+ s.require_paths = ["lib"]
13
+ s.files = Dir.glob("{lib}/**/*")
14
14
  s.platform = Gem::Platform::RUBY
15
- s.required_ruby_version = '>= 2.4'
15
+ s.required_ruby_version = ">= 2.4"
16
16
 
17
- s.add_runtime_dependency 'eventide-postgres'
17
+ s.add_runtime_dependency "eventide-postgres"
18
18
 
19
- s.add_development_dependency 'test_bench'
19
+ s.add_development_dependency "evt-messaging-fixtures"
20
+ s.add_development_dependency "evt-entity_projection-fixtures"
21
+ s.add_development_dependency "evt-schema-fixtures"
22
+
23
+ s.add_development_dependency "test_bench"
20
24
  end
@@ -1,5 +1,5 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gemspec name: '<%= component_name %>'
3
+ gemspec name: "<%= component_name %>"
4
4
 
5
- gem 'evt-component_host'
5
+ gem "evt-component_host"
@@ -1,3 +1,3 @@
1
- require_relative 'load_path'
1
+ require_relative "load_path"
2
2
 
3
- require '<%= component_name %>'
3
+ require "<%= component_name %>"
@@ -1,23 +1,94 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- echo "Removing gems directory..."
4
- rm -rf gems
5
- echo "Removing .bundle directory..."
6
- rm -rf .bundle
7
- echo "Removing Gemfile.lock file..."
8
- rm -f Gemfile.lock
3
+ set -euo pipefail
4
+
5
+ function boolean-var {
6
+ variable_name=$1
7
+ default=${2:-no}
8
+
9
+ val=${!variable_name:=$default}
10
+
11
+ if [[ "n|no|f|false|off|0" =~ $val ]]; then
12
+ echo 'false'
13
+ elif [[ "y|yes|t|true|on|1" =~ $val ]]; then
14
+ echo 'true'
15
+ else
16
+ echo "Variable \$$variable_name is set to \`$val' which is not a boolean value" >&2
17
+ echo >&2
18
+ exit 1
19
+ fi
20
+ }
21
+
22
+ if [ -z ${REMOVE_GEMS+x} ]; then
23
+ echo
24
+ echo "REMOVE_GEMS is not set. Using \"on\" by default."
25
+ remove_gems="on"
26
+ else
27
+ remove_gems=$REMOVE_GEMS
28
+ fi
29
+
30
+ gem_dir="./gems"
31
+
32
+ echo
33
+ echo "Install Gems"
34
+ echo "= = ="
35
+
36
+ if [ -z ${POSTURE+x} ]; then
37
+ echo "POSTURE is not set. Using \"operational\" by default."
38
+ posture="operational"
39
+ else
40
+ posture=$POSTURE
41
+ fi
42
+
43
+ echo "Posture: $posture"
44
+ echo "Gem Directory: $gem_dir"
45
+ echo "Remove Gems: $remove_gems"
46
+
47
+ echo
48
+
49
+ echo "Removing bundler configuration"
50
+ echo "- - -"
51
+
52
+ cmd="rm -rfv ./.bundle"
53
+
54
+ echo $cmd
55
+ ($cmd)
56
+
9
57
  echo
58
+ echo "Removing Gemfile.lock"
59
+ echo "- - -"
10
60
 
11
- set -e
61
+ cmd="rm -fv Gemfile.lock"
62
+
63
+ echo $cmd
64
+ ($cmd)
12
65
 
13
- echo "Installing gems to ./gems"
14
- echo '= = ='
66
+ remove_gems=$(boolean-var remove_gems)
67
+
68
+ if $remove_gems; then
69
+ echo
70
+ echo "Removing installed gems"
71
+ echo "- - -"
72
+
73
+ cmd="rm -rf $gem_dir"
74
+
75
+ echo $cmd
76
+ ($cmd)
77
+ fi
78
+
79
+ echo
80
+ echo "Installing bundle"
81
+ echo "- - -"
15
82
 
16
83
  cmd="bundle install --standalone --path=./gems"
17
84
 
85
+ if [ operational == "$posture" ]; then
86
+ cmd="$cmd --without=development"
87
+ fi
88
+
18
89
  echo $cmd
19
90
  ($cmd)
20
91
 
21
- echo '- - -'
22
- echo '(done)'
92
+ echo "- - -"
93
+ echo "(done)"
23
94
  echo
@@ -1,17 +1,17 @@
1
- require 'eventide/postgres'
1
+ require "eventide/postgres"
2
2
 
3
3
  # TODO Load command and event message files"
4
- # require '<%= component_name %>/messages/commands/...'
5
- # require '<%= component_name %>/messages/events/...'
4
+ # require "<%= component_name %>/messages/commands/..."
5
+ # require "<%= component_name %>/messages/events/..."
6
6
 
7
- require '<%= component_name %>/<%= entity_name %>'
8
- require '<%= component_name %>/projection'
9
- require '<%= component_name %>/store'
7
+ require "<%= component_name %>/<%= entity_name %>"
8
+ require "<%= component_name %>/projection"
9
+ require "<%= component_name %>/store"
10
10
 
11
- require '<%= component_name %>/handlers/commands'
12
- require '<%= component_name %>/handlers/events'
11
+ require "<%= component_name %>/handlers/commands"
12
+ require "<%= component_name %>/handlers/events"
13
13
 
14
- require '<%= component_name %>/consumers/commands'
15
- require '<%= component_name %>/consumers/events'
14
+ require "<%= component_name %>/consumers/commands"
15
+ require "<%= component_name %>/consumers/events"
16
16
 
17
- require '<%= component_name %>/start'
17
+ require "<%= component_name %>/start"
@@ -1,14 +1,14 @@
1
- require 'clock/controls'
2
- require 'identifier/uuid/controls'
1
+ require "clock/controls"
2
+ require "identifier/uuid/controls"
3
3
 
4
- require '<%= component_name %>/controls/id'
5
- require '<%= component_name %>/controls/time'
6
- require '<%= component_name %>/controls/version'
4
+ require "<%= component_name %>/controls/id"
5
+ require "<%= component_name %>/controls/time"
6
+ require "<%= component_name %>/controls/version"
7
7
 
8
- require '<%= component_name %>/controls/<%= entity_name %>'
8
+ require "<%= component_name %>/controls/<%= entity_name %>"
9
9
 
10
10
  # TODO Implement command controls (if using controls as part of your testing methodology)"
11
- # require '<%= component_name %>/controls/commands/...'
11
+ # require "<%= component_name %>/controls/commands/..."
12
12
 
13
13
  # TODO Implement event controls (if using controls as part of your testing methodology)"
14
- # require '<%= component_name %>/controls/events/...'
14
+ # require "<%= component_name %>/controls/events/..."
@@ -3,8 +3,8 @@
3
3
  module <%= component_constant_name %>
4
4
  module Start
5
5
  def self.call
6
- Consumers::Commands.start('<%= entity_stream_name %>:command')
7
- Consumers::Events.start('<%= entity_stream_name %>')
6
+ Consumers::Commands.start("<%= entity_stream_name %>:command")
7
+ Consumers::Events.start("<%= entity_stream_name %>")
8
8
  end
9
9
  end
10
10
  end
@@ -1,17 +1,17 @@
1
- bundler_standalone_loader = 'gems/bundler/setup'
1
+ bundler_standalone_loader = ENV["BUNDLER_STANDALONE_LOADER"] || "gems/bundler/setup"
2
2
 
3
3
  begin
4
4
  require_relative bundler_standalone_loader
5
5
  rescue LoadError
6
- puts "WARNING: Standalone bundle loader is not at #{bundler_standalone_loader}. Using Bundler to load gems."
6
+ warn "WARNING: Standalone bundle loader is not at #{bundler_standalone_loader}. Using Bundler to load gems."
7
7
  require "bundler/setup"
8
8
  Bundler.require
9
9
  end
10
10
 
11
- lib_dir = File.expand_path('../lib', __FILE__)
12
- $LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include?(lib_dir)
11
+ lib_dir = File.expand_path("lib", __dir__)
12
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
13
13
 
14
- libraries_dir = ENV['LIBRARIES_HOME']
14
+ libraries_dir = ENV["LIBRARIES_HOME"]
15
15
  unless libraries_dir.nil?
16
16
  libraries_dir = File.expand_path(libraries_dir)
17
17
  $LOAD_PATH.unshift libraries_dir unless $LOAD_PATH.include?(libraries_dir)
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../init'
3
+ require_relative "../init"
4
4
 
5
- require 'component_host'
5
+ require "component_host"
6
6
 
7
- ComponentHost.start('<%= service_name %>-component') do |host|
7
+ ComponentHost.start("<%= service_name %>-component") do |host|
8
8
  host.register(<%= component_constant_name %>::Start)
9
9
  end
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eo pipefail
4
+
5
+ if [ -z ${LIBRARIES_HOME+x} ]; then
6
+ echo "LIBRARIES_HOME must be set to the libraries directory path... exiting"
7
+ exit 1
8
+ fi
9
+
10
+ if [ ! -d "$LIBRARIES_HOME" ]; then
11
+ echo "$LIBRARIES_HOME does not exist... exiting"
12
+ exit 1
13
+ fi
14
+
15
+ function make-directory {
16
+ directory=$1
17
+
18
+ lib_directory="$LIBRARIES_HOME/$directory"
19
+
20
+ if [ ! -d "$lib_directory" ]; then
21
+ echo "- making directory $lib_directory"
22
+ mkdir -p "$lib_directory"
23
+ fi
24
+ }
25
+
26
+ function symlink-lib {
27
+ name=$1
28
+ directory=$2
29
+
30
+ echo
31
+ echo "Symlinking $name"
32
+ echo "- - -"
33
+
34
+ src="$(pwd)/lib"
35
+ dest="$LIBRARIES_HOME"
36
+ if [ ! -z "$directory" ]; then
37
+ src="$src/$directory"
38
+ dest="$dest/$directory"
39
+
40
+ make-directory $directory
41
+ fi
42
+ src="$src/$name"
43
+
44
+ echo "- destination is $dest"
45
+
46
+ full_name=$directory/$name
47
+
48
+ for entry in $src*; do
49
+ entry_basename=$(basename $entry)
50
+ dest_item="$dest/$entry_basename"
51
+
52
+ echo "- symlinking $entry_basename to $dest_item"
53
+
54
+ cmd="ln -s $entry $dest_item"
55
+ echo $cmd
56
+ ($cmd)
57
+ done
58
+
59
+ echo "- - -"
60
+ echo "($name done)"
61
+ echo
62
+ }
63
+
64
+ symlink-lib "<%= component_name %>"
@@ -1,5 +1,5 @@
1
- ENV['TEST_BENCH_EXCLUDE_FILE_PATTERN'] ||= '/_|sketch|(_init\.rb|_tests\.rb)\z'
1
+ require_relative "./test_init"
2
2
 
3
- require_relative './test_init'
4
-
5
- TestBench::CLI.()
3
+ TestBench::CLI.(
4
+ exclude_file_pattern: %r{/_|sketch|(_init\.rb|_tests\.rb)\z}
5
+ )
@@ -1 +1 @@
1
- require_relative '../test_init'
1
+ require_relative "../test_init"
@@ -1,7 +1,7 @@
1
1
  # This test is for example purposes. You may remove it once it has served its purpose.
2
2
  # More on the TestBench test framework for Ruby: https://github.com/ntl/test-bench/blob/master/README.adoc
3
3
 
4
- require_relative './automated_init'
4
+ require_relative "./automated_init"
5
5
 
6
6
  context "Database Connection" do
7
7
  session = MessageStore::Postgres::Session.build
@@ -10,7 +10,7 @@ context "Database Connection" do
10
10
 
11
11
  test "Connects on first use" do
12
12
  refute_raises do
13
- session.execute('SELECT 1;')
13
+ session.execute("SELECT 1;")
14
14
  end
15
15
  end
16
16
 
@@ -1,3 +1,5 @@
1
- require_relative '../test_init'
1
+ ENV["LOG_LEVEL"] ||= "info"
2
+ ENV["LOG_TAGS"] ||= "_untagged,-data,messaging,entity_projection,entity_store,ignored"
3
+ ENV["TEST_BENCH_DETAIL"] ||= "on"
2
4
 
3
- ENV['LOG_LEVEL'] = 'info'
5
+ require_relative "../test_init"
@@ -1,15 +1,19 @@
1
- ENV['CONSOLE_DEVICE'] ||= 'stdout'
2
- ENV['LOG_LEVEL'] ||= '_min'
1
+ ENV["CONSOLE_DEVICE"] ||= "stdout"
2
+ ENV["LOG_LEVEL"] ||= "_min"
3
3
 
4
4
  puts RUBY_DESCRIPTION
5
- puts
6
5
 
7
- require_relative '../init.rb'
6
+ puts
7
+ puts "TEST_BENCH_DETAIL: #{ENV["TEST_BENCH_DETAIL"].inspect}"
8
+ puts
8
9
 
9
- require 'test_bench'; TestBench.activate
10
+ require_relative "../init.rb"
11
+ require "<%= component_name %>/controls"
10
12
 
11
- require 'pp'
13
+ require "test_bench"; TestBench.activate
12
14
 
13
- require '<%= component_name %>/controls'
15
+ require "messaging/fixtures"
16
+ require "entity_projection/fixtures"
17
+ require "schema/fixtures"
14
18
 
15
19
  include <%= component_constant_name %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-command_line-component_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1.5
4
+ version: 2.0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
- autorequire:
8
+ autorequire:
9
9
  bindir: executable
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -87,8 +87,8 @@ files:
87
87
  - source/lib/%component_name%/store.rb.tt
88
88
  - source/load_path.rb
89
89
  - source/script/start.tt
90
- - source/script/test-database-connection
91
90
  - source/settings/message_store_postgres.json.example
91
+ - source/symlink-lib.sh.tt
92
92
  - source/test.sh
93
93
  - source/test/automated.rb
94
94
  - source/test/automated/automated_init.rb
@@ -99,7 +99,7 @@ homepage: https://github.com/eventide-project/command-line-component-generator
99
99
  licenses:
100
100
  - MIT
101
101
  metadata: {}
102
- post_install_message:
102
+ post_install_message:
103
103
  rdoc_options: []
104
104
  require_paths:
105
105
  - lib
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubygems_version: 3.1.2
118
- signing_key:
118
+ signing_key:
119
119
  specification_version: 4
120
120
  summary: Command line Eventide component generator
121
121
  test_files: []
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../init'
4
-
5
- puts 'Testing Message Store Database Connection'
6
- puts '= = ='
7
-
8
- session = MessageStore::Postgres::Session.build
9
-
10
- puts "Connection Status: #{session.open? ? 'open' : 'closed' }"
11
-
12
- session.open
13
-
14
- puts 'Opening connection'
15
- puts "Connection Status: #{session.open? ? 'open' : 'closed' }"
16
-
17
- sql_command = 'SELECT 1;'
18
- puts "Executing test command: #{sql_command}"
19
-
20
- session.execute(sql_command)
21
-
22
- puts 'Closing connection'
23
- session.close
24
-
25
- puts "Connection Status: #{session.open? ? 'open' : 'closed' }"
26
-
27
- puts '- - -'
28
- puts 'done'