k_manager 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/k_manager/cli/new.rb +2 -0
- data/lib/k_manager/manager.rb +11 -0
- data/lib/k_manager/overview/models.rb +1 -1
- data/lib/k_manager/resources/resource_document_factory.rb +1 -1
- data/lib/k_manager/version.rb +1 -1
- data/lib/k_manager/watcher.rb +11 -3
- data/lib/k_manager.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 157a9a658d9851e2dc9aa452e5acfffbbd323d40a5bd3aedaefee2ee0c416566
|
4
|
+
data.tar.gz: c2e4e2c47536323c37764003f5ee3267871c0521707f60559a086a7bf7c269df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58f487cb037aec8befd840a16c984f570fff3e1e9e9e96f38c8982b387fc39d07942eb8ffe5ed0ae3b285c99ca199749b4e744083c0e2a9126232baec2bfb1ba
|
7
|
+
data.tar.gz: f21a0047dce6f822e9b2fbbfde1bc183850c8ab02712964d651f733f395d50d2dfd4439f155eef5ef421170e642117981209eeb57c6f4dd5523fe99837577f7b
|
data/Gemfile
CHANGED
@@ -36,6 +36,7 @@ if ENV['KLUE_LOCAL_GEMS']&.to_s&.downcase == 'true'
|
|
36
36
|
gem 'k_decor' , path: '../k_decor'
|
37
37
|
gem 'k_doc' , path: '../k_doc'
|
38
38
|
gem 'k_domain' , path: '../k_domain'
|
39
|
+
gem 'k_fileset' , path: '../k_fileset'
|
39
40
|
gem 'k_log' , path: '../k_log'
|
40
41
|
gem 'k_type' , path: '../k_type'
|
41
42
|
gem 'k_util' , path: '../k_util'
|
data/lib/k_manager/cli/new.rb
CHANGED
@@ -30,6 +30,7 @@ module KManager
|
|
30
30
|
'my_project # will watch .xmen folder'
|
31
31
|
]
|
32
32
|
|
33
|
+
# rubocop:disable Metrics/ParameterLists
|
33
34
|
def call(project_folder:, builder_folder:, boot_file:, log_level:, force:, **)
|
34
35
|
project_folder = absolute_path(project_folder, Dir.pwd)
|
35
36
|
name = File.basename(project_folder)
|
@@ -40,6 +41,7 @@ module KManager
|
|
40
41
|
|
41
42
|
create_project(project_folder, builder_folder, boot_file) if can_create?(force, builder_folder)
|
42
43
|
end
|
44
|
+
# rubocop:enable Metrics/ParameterLists
|
43
45
|
|
44
46
|
private
|
45
47
|
|
data/lib/k_manager/manager.rb
CHANGED
@@ -28,6 +28,17 @@ module KManager
|
|
28
28
|
yield(@current_resource)
|
29
29
|
end
|
30
30
|
|
31
|
+
Options = Struct.new(:sleep, :exception_style)
|
32
|
+
|
33
|
+
# @param [Integer] sleep Seconds to sleep after running, 0 = no sleep
|
34
|
+
# @param [Symbol] exception_style Format for exception messages caught by watcher.
|
35
|
+
# :message - message only
|
36
|
+
# :short - message and short backtrace
|
37
|
+
# :long - message and long backtrace
|
38
|
+
def opts
|
39
|
+
@opts ||= Options.new(0, :message)
|
40
|
+
end
|
41
|
+
|
31
42
|
def areas
|
32
43
|
@areas ||= []
|
33
44
|
end
|
@@ -62,7 +62,7 @@ module KManager
|
|
62
62
|
attribute :resource_relative_path , Types::Strict::String.optional.default(nil)
|
63
63
|
attribute :resource_exist? , Types::Strict::Bool
|
64
64
|
attribute :document_id , Types::Strict::Integer
|
65
|
-
attribute :document_data , Types::Strict::Hash.optional.default(nil) | Types::Strict::Array.of(Types::Strict::Hash).optional.default(nil)
|
65
|
+
attribute :document_data , Types::Strict::Any.optional.default # Hash.optional.default(nil) | Types::Strict::Array.of(Types::Strict::Hash).optional.default(nil)
|
66
66
|
attribute :document_key , Types::Strict::String | Types::Strict::Symbol
|
67
67
|
attribute :document_namespace , Types::Strict::String | Types::Strict::Array.of(Types::Strict::String).optional.default(nil)
|
68
68
|
attribute :document_tag , Types::Strict::String | Types::Strict::Symbol
|
@@ -81,7 +81,7 @@ module KManager
|
|
81
81
|
# KManager::Manager.current_resource
|
82
82
|
# KDsl.target_resource = self
|
83
83
|
|
84
|
-
log.error "#{resource.activated?} - #{resource.resource_path}"
|
84
|
+
# log.error "#{resource.activated?} - #{resource.resource_path}"
|
85
85
|
|
86
86
|
Object.class_eval resource.content, resource.resource_path
|
87
87
|
|
data/lib/k_manager/version.rb
CHANGED
data/lib/k_manager/watcher.rb
CHANGED
@@ -20,7 +20,7 @@ module KManager
|
|
20
20
|
# process_updated_file(filename) if event == :updated # || event == :created
|
21
21
|
# process_deleted_file(filename) if event == :deleted
|
22
22
|
|
23
|
-
# rubocop:disable Lint/RescueException
|
23
|
+
# rubocop:disable Lint/RescueException, Metrics/AbcSize
|
24
24
|
def start
|
25
25
|
boot_up
|
26
26
|
|
@@ -32,18 +32,26 @@ module KManager
|
|
32
32
|
|
33
33
|
puts "File #{event}: #{filename}"
|
34
34
|
|
35
|
+
# NOTE: KManager will not support space in file name, but this will at least deal with file copy when " copy" is added to a file name
|
36
|
+
filename = filename.gsub(' ', '%20')
|
37
|
+
|
38
|
+
puts "File #{event}: #{filename}"
|
39
|
+
|
35
40
|
uri = URI::File.build(host: nil, path: filename)
|
36
41
|
KManager.resource_changed(uri, event)
|
37
42
|
|
43
|
+
sleep KManager.opts.sleep if KManager.opts.sleep.positive?
|
44
|
+
|
38
45
|
update_dashboard
|
39
46
|
puts "File #{event}: #{filename}"
|
40
47
|
end
|
41
48
|
end
|
42
49
|
rescue Exception => e
|
43
50
|
# TODO: Make style a setting: :message, :short, (whatever the last one is)
|
44
|
-
log.exception(e, style:
|
51
|
+
log.exception(e, style: KManager.opts.exception_style)
|
52
|
+
log.exception(e)
|
45
53
|
end
|
46
|
-
# rubocop:enable Lint/RescueException
|
54
|
+
# rubocop:enable Lint/RescueException, Metrics/AbcSize
|
47
55
|
|
48
56
|
private
|
49
57
|
|
data/lib/k_manager.rb
CHANGED
@@ -96,7 +96,7 @@ module KManager
|
|
96
96
|
@manager = Manager.new
|
97
97
|
end
|
98
98
|
|
99
|
-
def_delegators :manager, :areas, :add_area, :find_document, :fire_actions, :resource_changed
|
99
|
+
def_delegators :manager, :opts, :areas, :add_area, :find_document, :fire_actions, :resource_changed
|
100
100
|
|
101
101
|
# ----------------------------------------------------------------------
|
102
102
|
# Document factory facade methods
|
@@ -106,7 +106,7 @@ module KManager
|
|
106
106
|
@document_factory ||= DocumentFactory.new
|
107
107
|
end
|
108
108
|
|
109
|
-
def_delegators :document_factory, :model, :csv, :json, :yaml
|
109
|
+
def_delegators :document_factory, :action, :model, :csv, :json, :yaml
|
110
110
|
|
111
111
|
# TODO: DEPRECATE or REFACTOR
|
112
112
|
def new_project_config(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|