ai_sentinel 0.2.0 → 0.2.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: 4ac43b28f3c4ba7b059a19714ed5f094273527d6f8b534c53823ef6e9f1af09a
4
- data.tar.gz: c35e17935d631d41d171f26078320a4d03ccd72848c8fb5990d98b1c8aa6bb7e
3
+ metadata.gz: 426089deb83c2bedf49d58d170b9241d0cd14a0284fa7b23acc7e8b5932f666f
4
+ data.tar.gz: 7fd0fc6880e2cacc358a2e32bcbed7636e70aade5d688294c5ef79961cb20c92
5
5
  SHA512:
6
- metadata.gz: c5a008e3fdc0d2f4e5fbf71c3bb22a02d8b30939fc89b8b29346f8563eaa9440f8f1a1b51a32cf41814998ab47d51cf11f62347cd22d9a120ecab09159bb0395
7
- data.tar.gz: ac98856532fee5d16c4873978dca30821bf32cf58e027b1c63c947775ad124c102c2f99f9916c9b62e557664a667695fa0b819b2b7278aa901589c33ebd8d104
6
+ metadata.gz: b19b08eafd1dc89bcb3ca42f29ae483e6751a1bbf50546b6be65a4b2840705cf705d25d340af8d81b0a443267f20227e1f492b5d44403e0a0cd5ef1d5f93f643
7
+ data.tar.gz: 1eb5109adbf99a1802e393942282f05e7635274e0d658e4799488f9a0526cdf94db249df83cfaf65d0097c155448b8445f05bf6fce330d15fdd7f3bff6c51d1e
@@ -10,6 +10,15 @@ module AiSentinel
10
10
  loader.load!
11
11
  end
12
12
 
13
+ def apply_working_directory_and_load_env
14
+ dir = AiSentinel.configuration.working_directory
15
+ return unless dir
16
+
17
+ FileUtils.mkdir_p(dir)
18
+ Dir.chdir(dir)
19
+ Dotenv.load
20
+ end
21
+
13
22
  def setup_database
14
23
  if options[:config]
15
24
  load_config
@@ -22,6 +22,7 @@ module AiSentinel
22
22
  option :daemonize, type: :boolean, default: false, aliases: '-d', desc: 'Run in background'
23
23
  def start
24
24
  load_config
25
+ apply_working_directory_and_load_env
25
26
  AiSentinel.send(:resolve_api_key)
26
27
  AiSentinel.configuration.validate!
27
28
  Persistence::Database.setup(AiSentinel.configuration.database_path)
@@ -51,6 +52,7 @@ module AiSentinel
51
52
  desc 'run WORKFLOW', 'Manually trigger a workflow immediately'
52
53
  def run_workflow(workflow_name)
53
54
  load_config
55
+ apply_working_directory_and_load_env
54
56
  AiSentinel.send(:resolve_api_key)
55
57
  AiSentinel.configuration.validate!
56
58
  Persistence::Database.setup(AiSentinel.configuration.database_path)
@@ -69,6 +71,7 @@ module AiSentinel
69
71
  desc 'validate', 'Validate the configuration file'
70
72
  def validate
71
73
  load_config
74
+ apply_working_directory_and_load_env
72
75
  AiSentinel.send(:resolve_api_key)
73
76
  AiSentinel.configuration.validate!
74
77
  say "Config is valid. #{AiSentinel.registry.size} workflow(s) loaded."
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'dotenv'
3
4
  require 'fileutils'
4
5
  require 'rufus-scheduler'
5
6
 
@@ -59,6 +60,7 @@ module AiSentinel
59
60
 
60
61
  FileUtils.mkdir_p(dir)
61
62
  Dir.chdir(dir)
63
+ Dotenv.load
62
64
  end
63
65
 
64
66
  def write_pid_file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiSentinel
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai_sentinel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Celi