app_status_notification 0.9.0.beta2 → 0.9.0.beta4

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: 4c12c2ec89f2a04084d25216df4a4914fd49004872e664d613fe6f94be350618
4
- data.tar.gz: 13b1507f4f5a2bc375224b17cec96e9b2839d6c73b57fa2756c9e02deadd0c4c
3
+ metadata.gz: f83b4047c5a400af798316cc3fa1f74d5bb25a6afdeb538a547dd2aaa1f6ecbb
4
+ data.tar.gz: d5129809a70c73e73d73adb5b7b85e6638105bf4b44de63c93a83f065c957533
5
5
  SHA512:
6
- metadata.gz: e3b02a1267a5a4c3fed2c3ef3fbb4a8d095750bd9fce310f65236a609846f68ac27e399c4725d6bac7dcbce21faa26ad97df6f2a3f5998503d8dd2803e064d42
7
- data.tar.gz: 9765bdfb5ed5948902357df5a003d92912fc15074a2547e0c2def94b03b0c7e9656aabe7b575522f0ae68c67c7c4aeb480cec7b7367965ef86ffc0bdfbc5583b
6
+ metadata.gz: 5baeaf849707ba264c8b4508555ca933a99baf95281f9ea1f701a7f2f4ec8b30309656bb728373b4376170289bf49837c0d2770571aad8fbf11bc1ffa87054a6
7
+ data.tar.gz: 9b11014958d24a18675f6c3a29e7b5f8e721fe0eb89959d8575cee2aee4d1978dfe1eb3024136ce0dc3470c63e8016eefafa968463c8d8be1e9db9616f6eb4d0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_status_notification (0.9.0.beta2)
4
+ app_status_notification (0.9.0.beta4)
5
5
  activesupport (>= 6.0.3.1)
6
6
  anyway_config (>= 2.0.0)
7
7
  faraday (>= 1.0.1)
@@ -14,8 +14,8 @@ module AppStatusNotification
14
14
  AppStatusNotification::Command.run(params)
15
15
  end
16
16
 
17
- def self.watch(config_file = nil)
18
- AppStatusNotification::Watchman.run(config_file)
17
+ def self.watch(config_path = nil, store_path = nil)
18
+ AppStatusNotification::Watchman.run(config_path, store_path)
19
19
  end
20
20
 
21
21
  def self.development(enabled = false)
@@ -25,15 +25,15 @@ class AppStatusNotification::Command
25
25
  arg_name 'config'
26
26
  flag [:c, :config]
27
27
 
28
- desc 'Set locale path'
29
- arg_name 'locale'
30
- flag [:locale]
28
+ desc 'Set store path'
29
+ arg_name 'store'
30
+ flag [:s, :store]
31
31
 
32
32
  desc 'Start watch service'
33
33
  arg_name 'Describe arguments to ddd here'
34
34
  command :watch do |c|
35
35
  c.action do |global, options, args|
36
- AppStatusNotification.watch(global[:config])
36
+ AppStatusNotification.watch(global[:config], global[:store])
37
37
  end
38
38
  end
39
39
 
@@ -54,10 +54,10 @@ class AppStatusNotification::Command
54
54
  end
55
55
 
56
56
  on_error do |exception|
57
- puts exception.backtrace unless exception.is_a?(Interrupt)
57
+ # puts exception.backtrace unless exception.is_a?(Interrupt)
58
58
  # Error logic here
59
59
  # return false to skip default error handling
60
- true
60
+ false
61
61
  end
62
62
 
63
63
  default_command :watch
@@ -14,6 +14,7 @@ module AppStatusNotification
14
14
  notifications: {},
15
15
  refresh_interval: 60,
16
16
  locale: 'zh',
17
+ store_path: 'stores',
17
18
  dry: false,
18
19
  enable_crash_report: true,
19
20
  crash_report: 'https://aa7c78acbb324fcf93169fce2b7e5758@o333914.ingest.sentry.io/5575774'
@@ -47,12 +48,8 @@ module AppStatusNotification
47
48
  @account ||= Account.parse(super)
48
49
  end
49
50
 
50
- def store_path
51
- File.join(File.expand_path('../../', __dir__), 'stores')
52
- end
53
-
54
51
  def config_path
55
- File.join(File.expand_path('../../', __dir__), 'config')
52
+ Anyway::Settings.default_config_path
56
53
  end
57
54
 
58
55
  on_load :configure_locale
@@ -62,9 +59,13 @@ module AppStatusNotification
62
59
 
63
60
  private
64
61
 
62
+ def builtin_config_path
63
+ @builtin_config_path ||= File.join(File.expand_path('../../', __dir__), 'config')
64
+ end
65
+
65
66
  def configure_locale
66
67
  # built-in
67
- I18n.load_path << Dir[File.join(config_path, 'locales', '*.yml')]
68
+ I18n.load_path << Dir[File.join(builtin_config_path, 'locales', '*.yml')]
68
69
 
69
70
  # default locale
70
71
  I18n.locale = locale.to_sym
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppStatusNotification
4
- VERSION = '0.9.0.beta2'
4
+ VERSION = '0.9.0.beta4'
5
5
  end
@@ -1,15 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'app_status_notification/runner'
4
+ require 'fileutils'
4
5
 
5
6
  module AppStatusNotification
6
7
  class Watchman
7
8
  include AppStatusNotification::I18nHelper
8
9
 
9
- def self.run(config_path = nil)
10
- Anyway::Settings.default_config_path = config_path if Dir.exist?(config_path)
10
+ def self.run(config_path = nil, store_path = '.')
11
+ Anyway::Settings.default_config_path = config_path if config_path && Dir.exist?(config_path)
11
12
 
12
13
  config = Config.new
14
+
15
+ if store_path
16
+ FileUtils.mkdir_p(store_path)
17
+ config.store_path = store_path
18
+ end
19
+
13
20
  yield config if block_given?
14
21
 
15
22
  Watchman.new(config).run
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_status_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.beta2
4
+ version: 0.9.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf