yinx_st 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yinx_st/note_meta.rb +12 -0
- data/lib/yinx_st/version.rb +1 -1
- data/lib/yinx_st.rb +88 -56
- data/yinx_st.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b0deeefba377acfcc34856ffa6bd7ad58903312
|
4
|
+
data.tar.gz: 6dd56be4c22f6df1d08d2d88f3ca59aa70087d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b77671dea7ef76537d791d3b253766aeb5b0b7ef233261d085b2b6394edc54a7484f86297f4eb384130484892dc6477c9e8d8a0bc934fb39d22e51ea339af7c
|
7
|
+
data.tar.gz: 805f5f49cb9423bc8dd57c82bac8efef126cbbe14425c9b3d56d55685b5d20ed3dd2e361dd981aa6d56f42c2836269acacdb2e6dd2c0dc7019fe7d8676641c40
|
data/lib/yinx_st/note_meta.rb
CHANGED
@@ -38,4 +38,16 @@ class Yinx::NoteMeta
|
|
38
38
|
prev_version and prev_version.tags.sort != self.tags.sort
|
39
39
|
end
|
40
40
|
|
41
|
+
def stack_book
|
42
|
+
st = stack.nil? ? '' : "#{stack}/"
|
43
|
+
"#{st}#{book}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def stack_name
|
47
|
+
stack ? stack : 'No Stack'
|
48
|
+
end
|
49
|
+
|
50
|
+
def tags_count
|
51
|
+
tags.count
|
52
|
+
end
|
41
53
|
end
|
data/lib/yinx_st/version.rb
CHANGED
data/lib/yinx_st.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require "yinx_st/version"
|
2
2
|
require 'yinx'
|
3
3
|
require 'yinx_sql'
|
4
|
-
require 'my_chart'
|
5
4
|
require 'time_seq'
|
6
5
|
|
7
6
|
require 'yinx_st/note_meta'
|
8
7
|
require 'yinx_st/batches'
|
9
8
|
|
9
|
+
require 'my_chartkick'
|
10
|
+
|
10
11
|
module YinxSt
|
11
12
|
class << self
|
13
|
+
|
14
|
+
attr_reader :chart
|
15
|
+
|
12
16
|
def fetch *args
|
13
17
|
Yinx::SQL.connect(*args)
|
14
18
|
self
|
@@ -18,66 +22,94 @@ module YinxSt
|
|
18
22
|
batches = Batches.new(n + 1)
|
19
23
|
duration = "最近#{n}日"
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
25
|
+
time_line = batches.time_line
|
26
|
+
|
27
|
+
all = batches.all_notes
|
28
|
+
unwind_tags = batches.unwind_tags
|
29
|
+
|
30
|
+
yesterday = all.select{|note| note.dump_id == batches.latest_id}
|
31
|
+
yesterday_unwind_tags = unwind_tags.select{|note| note.dump_id == batches.latest_id}
|
32
|
+
|
33
|
+
changed_content = all.select{|note| note.status != :remained}
|
34
|
+
moved_book = all.select &:moved_book?
|
35
|
+
changed_tags = all.select &:changed_tags?
|
36
|
+
|
37
|
+
@chart = MyChartkick.bundle do |s|
|
38
|
+
s.my_line_chart all,
|
39
|
+
title: "#{duration}总数变化",
|
40
|
+
x: :dump_day,
|
41
|
+
min: 2400,
|
42
|
+
asc: :key,
|
43
|
+
last: n
|
44
|
+
|
45
|
+
s.my_line_chart changed_content,
|
46
|
+
title: "#{duration}新建/修改/删除",
|
47
|
+
x: :dump_day, y: :status,
|
48
|
+
keys: time_line,
|
49
|
+
asc: :key,
|
50
|
+
last: n
|
51
|
+
|
52
|
+
s.my_line_chart moved_book,
|
53
|
+
title: "#{duration}移动笔记本",
|
54
|
+
x: :dump_day,
|
55
|
+
keys: time_line,
|
56
|
+
asc: :key,
|
57
|
+
last: n
|
58
|
+
|
59
|
+
s.my_line_chart changed_tags,
|
60
|
+
title: "#{duration}更改标签",
|
61
|
+
x: :dump_day,
|
62
|
+
keys: time_line,
|
63
|
+
asc: :key,
|
64
|
+
last: n
|
65
|
+
|
66
|
+
s.my_column_chart yesterday,
|
67
|
+
title: "目前最大的10个笔记本",
|
68
|
+
x: :stack_book,
|
69
|
+
desc: :count,
|
70
|
+
first: 10
|
71
|
+
|
72
|
+
s.my_line_chart all,
|
73
|
+
title: "#{duration}笔记本体积变化",
|
74
|
+
x: :dump_day, y: :stack_book,
|
75
|
+
asc: :key,
|
76
|
+
height: '540px',
|
77
|
+
last: n
|
78
|
+
|
79
|
+
s.my_column_chart yesterday,
|
80
|
+
title: "目前最大的10个笔记本组",
|
81
|
+
x: :stack_name,
|
82
|
+
desc: :count,
|
83
|
+
first: 10
|
84
|
+
|
85
|
+
s.my_line_chart all,
|
86
|
+
title: "#{duration}笔记本组体积变化",
|
87
|
+
x: :dump_day, y: :stack_name,
|
88
|
+
asc: :key,
|
89
|
+
last: n
|
90
|
+
|
91
|
+
s.my_pie_chart yesterday_unwind_tags,
|
92
|
+
title: "目前使用最多的15个标签",
|
93
|
+
x: :tags,
|
94
|
+
desc: :count,
|
95
|
+
first: 15
|
96
|
+
|
97
|
+
s.my_column_chart yesterday,
|
98
|
+
title: "目前每篇笔记的标签数",
|
99
|
+
x: :tags_count,
|
100
|
+
asc: :key
|
101
|
+
|
102
|
+
s.my_line_chart unwind_tags,
|
103
|
+
title: "#{duration}标签数变化",
|
104
|
+
x: :dump_day, y: :tags,
|
105
|
+
asc: :key,
|
106
|
+
height: '740px',
|
107
|
+
last: n
|
70
108
|
|
71
109
|
end
|
72
110
|
|
73
|
-
self
|
74
111
|
end
|
75
112
|
|
76
|
-
attr_reader :chart
|
77
113
|
|
78
|
-
def generate_html(erb_file=File.expand_path('../yinx_st/chart.erb', __FILE__))
|
79
|
-
template = File.read erb_file
|
80
|
-
html = ERB.new(template).result(binding)
|
81
|
-
end
|
82
114
|
end
|
83
115
|
end
|
data/yinx_st.gemspec
CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_dependency "yinx", "~> 0.1.0"
|
28
28
|
spec.add_dependency "yinx_sql", "~> 0.1.2"
|
29
|
-
spec.add_dependency "
|
29
|
+
spec.add_dependency "my_chartkick", "~> 0.1.0"
|
30
30
|
spec.add_dependency "time_seq", "~> 0.1.0"
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yinx_st
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.1.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: my_chartkick
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|