furikake 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/furikake/config.rb +2 -3
- data/lib/furikake/monitor.rb +2 -3
- data/lib/furikake/report.rb +4 -1
- data/lib/furikake/resource.rb +11 -4
- data/lib/furikake/version.rb +1 -1
- data/lib/furikake.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a392d6ad82395ebd3393dea89b4a95bbf19c5c6680ce120bf355caa596530d1
|
4
|
+
data.tar.gz: d91340d2a77ebe029bebe69c14d1773b17867f3b93ba3bd52873889ad0335d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7802b4435498a191181998d1e115cf774801b17852362a5df871dd2e969b2e96f69a1e3e92082bae9606ca4fdf9f0911e84d28dd0adf6d755ec5b7978caf8d20
|
7
|
+
data.tar.gz: 17b71a62bb22b4ddb4a6855b2d739a2769e35f497258e1007e1756cfcbd25d6683e6aab56afa45e763d8d1427178a81f6e3b59b3d7b58f791052fc0bb78b1db0
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/furikake/config.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module Furikake
|
2
2
|
module Config
|
3
3
|
def read_furikake_yaml
|
4
|
-
# open('.furikake.yml', 'r') { |f| YAML.load(f) }
|
5
4
|
begin
|
6
5
|
YAML.load_file('.furikake.yml')
|
7
6
|
rescue Errno::ENOENT
|
8
|
-
|
7
|
+
Logger.new(STDOUT).error('.furikake.yml が存在していません.')
|
9
8
|
exit 1
|
10
9
|
rescue => ex
|
11
|
-
|
10
|
+
Logger.new(STDOUT).error('.furikake.yml の読み込みに失敗しました. ' + ex.message)
|
12
11
|
exit 1
|
13
12
|
end
|
14
13
|
end
|
data/lib/furikake/monitor.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Reference: https://www.mk-mode.com/octopress/2013/10/06/ruby-daemonize-script/
|
2
|
-
require 'logger'
|
3
2
|
|
4
3
|
module Furikake
|
5
4
|
class Monitor < Report
|
@@ -13,11 +12,11 @@ module Furikake
|
|
13
12
|
|
14
13
|
def run
|
15
14
|
begin
|
16
|
-
@logger.info 'furikake monitor
|
15
|
+
@logger.info 'furikake monitor を起動します.'
|
17
16
|
daemonize
|
18
17
|
set_trap
|
19
18
|
monitor
|
20
|
-
@logger.warn "furikake monitor
|
19
|
+
@logger.warn "furikake monitor を停止しました."
|
21
20
|
File.delete(@pid_file) if File.file?(@pid_file)
|
22
21
|
rescue => e
|
23
22
|
@logger.error "monitor の起動に失敗しました. #{e}"
|
data/lib/furikake/report.rb
CHANGED
@@ -4,7 +4,9 @@ module Furikake
|
|
4
4
|
class Report
|
5
5
|
include Furikake::Config
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize
|
8
|
+
@logger = Logger.new(STDOUT)
|
9
|
+
end
|
8
10
|
|
9
11
|
def show
|
10
12
|
params = read_furikake_yaml
|
@@ -24,6 +26,7 @@ module Furikake
|
|
24
26
|
p['wiki_contents'] = document
|
25
27
|
param = check_api_key(p)
|
26
28
|
Furikake::Reporters::Backlog.new(param).publish
|
29
|
+
@logger.info("#{param['space_id']} の #{param['wiki_id']} に情報を投稿しました.")
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
data/lib/furikake/resource.rb
CHANGED
@@ -8,16 +8,18 @@ module Furikake
|
|
8
8
|
require "#{type}"
|
9
9
|
type_name = type.split('-')[-1]
|
10
10
|
eval "documents.concat(Furikake::Resources::Addons::#{type_name.camelize}.report)"
|
11
|
+
logger.info("リソースタイプ: #{type_name} の情報を取得しました.")
|
11
12
|
documents.concat("\n\n")
|
12
13
|
else
|
13
14
|
begin
|
14
15
|
require "furikake/resources/#{type}"
|
15
16
|
eval "documents.concat(Furikake::Resources::#{type.camelize}.report)"
|
17
|
+
logger.info("リソースタイプ: #{type} の情報を取得しました.")
|
16
18
|
documents.concat("\n\n")
|
17
19
|
rescue LoadError
|
18
|
-
|
20
|
+
logger.warn("リソースタイプ: #{type} を読み込めませんでした.")
|
19
21
|
rescue
|
20
|
-
|
22
|
+
logger.warn("リソースタイプ: #{type} の情報を取得出来ませんでした.")
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -59,11 +61,16 @@ module Furikake
|
|
59
61
|
config = YAML.load_file(path)
|
60
62
|
config['resources']['aws'].sort
|
61
63
|
rescue Errno::ENOENT
|
62
|
-
|
64
|
+
logger.error('.furikake.yml が存在していません.')
|
65
|
+
exit 1
|
63
66
|
rescue => ex
|
64
|
-
|
67
|
+
logger.error('.furikake.yml の読み込みに失敗しました. ' + ex.message)
|
65
68
|
exit 1
|
66
69
|
end
|
67
70
|
end
|
71
|
+
|
72
|
+
def self.logger
|
73
|
+
Logger.new(STDOUT)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
data/lib/furikake/version.rb
CHANGED
data/lib/furikake.rb
CHANGED