Charu 0.0.4 → 0.0.6
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 +5 -5
- data/Charu.gemspec +10 -2
- data/Gemfile +1 -0
- data/README.md +13 -10
- data/exe/Charu +0 -0
- data/lib/Charu/ChangeLogMemo.rb +160 -87
- data/lib/Charu/Config.rb +17 -4
- data/lib/Charu/CreateHtml.rb +113 -0
- data/lib/Charu/FTP.rb +47 -0
- data/lib/Charu/version.rb +1 -1
- data/lib/Charu.rb +15 -9
- metadata +26 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 642236c79b07e0408025c9879fab8d063b8e880d
|
4
|
+
data.tar.gz: 90975c424f01cbdf82c5df1b06dad34c0989fce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309779a56c58f9a7c7c54023bf04b3d944850be1e8c0e3d383098a09d59d2f1decc156cfb0444e8bdd36af3008770a0c575f42d9f527e556f7afb256dbdeae1b
|
7
|
+
data.tar.gz: ee1d8d32e54ed1816dfedb0e3f6b1c995e19f57e1392f1ab1754264bd5b0f3a57965a18e5499d0842d948589e3317461ac1f37aa39b4b177bbb19ff38ee4bdea
|
data/Charu.gemspec
CHANGED
@@ -9,8 +9,13 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["ShiccaRorl"]
|
10
10
|
spec.email = ["shicca.rorl@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{ChangeLogMemo Html Converter
|
13
|
-
spec.description = %q{
|
12
|
+
spec.summary = %q{ChangeLogMemo Html Converter}
|
13
|
+
spec.description = %q{ChangeLogを日記にしているなら便利かも。
|
14
|
+
ChangeLogMemoとは?
|
15
|
+
|
16
|
+
[横着プログラミング 第1回: Unixのメモ技術](http://0xcc.net/unimag/1/)
|
17
|
+
|
18
|
+
[Change Log メモを試してみよう](http://at-aka.blogspot.jp/p/change-log.html)}
|
14
19
|
spec.homepage = "https://rubygems.org/gems/Charu"
|
15
20
|
spec.license = "MIT"
|
16
21
|
|
@@ -33,4 +38,7 @@ Gem::Specification.new do |spec|
|
|
33
38
|
spec.add_development_dependency "bundler", "~> 1.15"
|
34
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
+
|
42
|
+
spec.add_dependency 'redcarpet'
|
43
|
+
|
36
44
|
end
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,25 +22,28 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
初期化
|
25
|
+
### 初期化
|
26
26
|
```
|
27
|
-
|
27
|
+
./CharuConfig/CharuConfig.rb
|
28
28
|
```
|
29
|
+
設定してください。
|
29
30
|
|
30
|
-
|
31
|
+
### テンプレート
|
31
32
|
```
|
32
|
-
|
33
|
+
./CharuConfig/template/
|
33
34
|
```
|
34
35
|
|
35
|
-
|
36
|
+
### 実行
|
36
37
|
```
|
37
|
-
|
38
|
+
bundle exec Charu
|
38
39
|
```
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
### ChangeLogMemoとは?
|
42
|
+
|
43
|
+
[横着プログラミング 第1回: Unixのメモ技術](http://0xcc.net/unimag/1/)
|
44
|
+
|
45
|
+
[Change Log メモを試してみよう](http://at-aka.blogspot.jp/p/change-log.html)
|
46
|
+
|
44
47
|
|
45
48
|
## Development
|
46
49
|
|
data/exe/Charu
CHANGED
File without changes
|
data/lib/Charu/ChangeLogMemo.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
module Charu
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
title = ""
|
8
|
-
end
|
4
|
+
class Category
|
5
|
+
attr_accessor :category
|
6
|
+
def initialize()
|
9
7
|
@category = []
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
@config = Charu::Config.new()
|
9
|
+
|
10
|
+
# プライベートの設定
|
11
|
+
@private_category = true
|
13
12
|
end
|
14
13
|
|
15
|
-
def add(
|
16
|
-
if
|
17
|
-
|
14
|
+
def add(title_source)
|
15
|
+
if title_source == nil then
|
16
|
+
title_source = ""
|
18
17
|
end
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
title_source.scan(/\[(.*?)\]:/).each{|category|
|
20
|
+
@category << category[0]
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
@@ -25,23 +25,44 @@ module Charu
|
|
25
25
|
@category.uniq! # 重複削除
|
26
26
|
return @category
|
27
27
|
end
|
28
|
+
|
29
|
+
def get_private_category()
|
30
|
+
# プライベートの設定
|
31
|
+
@category.each{|category|
|
32
|
+
@config.private_category.each{|private_category|
|
33
|
+
if category == private_category then
|
34
|
+
@private_category = false
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return @private_category
|
39
|
+
end
|
28
40
|
end
|
29
41
|
|
30
42
|
class Item
|
31
|
-
attr_accessor :
|
32
|
-
def initialize(
|
33
|
-
if
|
43
|
+
attr_accessor :date, :item_title_source, :item_log, :category
|
44
|
+
def initialize(date)
|
45
|
+
if date == nil then
|
34
46
|
p "アイテム初期化失敗"
|
35
|
-
|
47
|
+
date = Time.now
|
36
48
|
title = "アイテム初期化失敗"
|
37
49
|
end
|
38
50
|
|
39
|
-
@
|
51
|
+
@date = date
|
40
52
|
|
41
53
|
@item_title_source = title
|
42
54
|
@item_log = ""
|
43
55
|
|
44
56
|
# カテゴリー
|
57
|
+
@item_private_list = []
|
58
|
+
|
59
|
+
@category = Charu::Category.new()
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def set_item_title_source(item_title_source)
|
64
|
+
@item_title_source = item_title_source
|
65
|
+
@category.add(@item_title_source)
|
45
66
|
end
|
46
67
|
|
47
68
|
def get_item_title()
|
@@ -71,21 +92,31 @@ module Charu
|
|
71
92
|
end
|
72
93
|
end
|
73
94
|
|
95
|
+
# カテゴリーリスト
|
74
96
|
def get_item_category()
|
75
|
-
@
|
76
|
-
if @cotegory == nil then
|
97
|
+
if @category == nil then
|
77
98
|
return []
|
78
99
|
end
|
79
|
-
return @
|
100
|
+
return @category.get_category_list()
|
101
|
+
end
|
102
|
+
|
103
|
+
# プライベートのフラグを返す
|
104
|
+
def get_private_category()
|
105
|
+
return @category.get_private_category
|
106
|
+
end
|
107
|
+
|
108
|
+
def get_item_date_string()
|
109
|
+
return @date.strftime("%Y-%m-%d")
|
80
110
|
end
|
111
|
+
|
81
112
|
end
|
82
113
|
|
83
114
|
class Entry
|
84
|
-
attr_accessor :
|
115
|
+
attr_accessor :date, :item_title, :item_log, :category, :item_source_date
|
85
116
|
def initialize(item_source)
|
86
|
-
@
|
117
|
+
@item_source_date = ""
|
87
118
|
@item_source_contents = ""
|
88
|
-
@
|
119
|
+
@item_source_date = item_source[0] # 時間データ・ソース
|
89
120
|
@item_source_contents = item_source[1] # 内容データ
|
90
121
|
|
91
122
|
if @item_source_contents == nil then
|
@@ -94,18 +125,17 @@ module Charu
|
|
94
125
|
end
|
95
126
|
|
96
127
|
def get_items() # 解析する
|
97
|
-
|
98
128
|
@items = []
|
99
129
|
item = nil
|
100
130
|
# 一行づつ処理する
|
101
131
|
@item_source_contents.split("\n").each{|line|
|
102
132
|
if item == nil then
|
103
|
-
item = Item.new(
|
133
|
+
item = Charu::Item.new(self.get_entry_time())
|
104
134
|
end
|
105
135
|
if line.match(/^\*\s.*?/) != nil or line.match(/^\t\*\s.*?/) != nil then
|
106
|
-
item = Item.new(
|
136
|
+
item = Charu::Item.new(self.get_entry_time())
|
107
137
|
@items << item
|
108
|
-
item.
|
138
|
+
item.set_item_title_source(line)
|
109
139
|
else
|
110
140
|
if line == nil then
|
111
141
|
line = ""
|
@@ -145,10 +175,10 @@ module Charu
|
|
145
175
|
return @items
|
146
176
|
end
|
147
177
|
|
148
|
-
def get_entry_time() #@
|
178
|
+
def get_entry_time() #@entry_date = Time.mktime($1.to_i, $2.to_i, $3.to_i)
|
149
179
|
t = Time.now
|
150
180
|
begin
|
151
|
-
t = Time.mktime(@
|
181
|
+
t = Time.mktime(@item_source_date.split(/-/)[0].to_i, @item_source_date.split(/-/)[1].to_i, @item_source_date.split(/-/)[2].to_i)
|
152
182
|
rescue
|
153
183
|
p "日付変換エラー".encode(Encoding::SJIS)
|
154
184
|
end
|
@@ -175,100 +205,143 @@ module Charu
|
|
175
205
|
i = i + 2
|
176
206
|
s = s + 2
|
177
207
|
if entry_data[1] != nil then
|
178
|
-
entry = Entry.new(entry_data)
|
208
|
+
entry = Charu::Entry.new(entry_data)
|
179
209
|
@entrys << entry
|
180
210
|
end
|
181
211
|
|
182
212
|
end
|
183
213
|
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# プライベートと分ける
|
218
|
+
module Charu
|
219
|
+
class ChangeLogPrivate < ChangeLog
|
220
|
+
def get_item_private()
|
221
|
+
@item_list_private = Hash.new()
|
184
222
|
|
185
|
-
def get_category_list()
|
186
|
-
p "リスト".encode(Encoding::SJIS)
|
187
|
-
category_list = []
|
188
223
|
@entrys.each{|entry|
|
189
224
|
entry.get_items().each{|item|
|
190
|
-
item.
|
191
|
-
|
192
|
-
|
225
|
+
if item.get_private_category == true then
|
226
|
+
@item_list_private[item.get_item_date_string()] = [item]
|
227
|
+
end
|
193
228
|
}
|
194
229
|
}
|
195
|
-
|
196
|
-
category_list.sort!{|a, b| a <=> b } # 並び替え
|
197
|
-
category_list.delete("")
|
198
|
-
|
199
|
-
return category_list
|
230
|
+
return @item_list_private
|
200
231
|
end
|
201
232
|
end
|
202
233
|
|
203
|
-
class ChangeLogPrivate < ChangeLog
|
204
|
-
|
205
|
-
end
|
206
|
-
|
207
234
|
class ChangeLogPublic < ChangeLog
|
208
|
-
|
235
|
+
def get_item_private()
|
236
|
+
@item_list_private = []
|
237
|
+
@entrys.entrys.each{|entry|
|
238
|
+
entry.get_items().each{|item|
|
239
|
+
@item_list_private << item
|
240
|
+
}
|
241
|
+
}
|
242
|
+
return @item_list_private
|
243
|
+
end
|
209
244
|
end
|
245
|
+
end
|
210
246
|
|
247
|
+
module Charu
|
211
248
|
class ChangeLogMemo
|
212
|
-
|
213
|
-
|
214
|
-
@file_name = file_name
|
249
|
+
def initialize()
|
250
|
+
@config = Charu::Config.new()
|
215
251
|
|
216
252
|
# ChangeLogMemoファイル
|
217
|
-
File.open(@
|
253
|
+
File.open(@config.change_log_path, 'r:utf-8'){|f|
|
218
254
|
@source = f.read # 全て読み込む
|
219
255
|
}
|
220
256
|
|
221
|
-
@change_log_private = ChangeLogPrivate.new(@source)
|
257
|
+
@change_log_private = Charu::ChangeLogPrivate.new(@source)
|
222
258
|
|
223
|
-
=
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
259
|
+
@item_list = @change_log_private.get_item_private()
|
260
|
+
|
261
|
+
# 全てのカテゴリーを取得
|
262
|
+
@all_category_list = []
|
263
|
+
@item_list.each{|key, items|
|
264
|
+
items.each{|item|
|
265
|
+
item.get_item_category().each{|category|
|
266
|
+
@all_category_list << category
|
267
|
+
}
|
232
268
|
}
|
233
269
|
}
|
234
|
-
=end
|
235
270
|
end
|
236
271
|
|
237
|
-
|
238
|
-
|
239
|
-
@
|
240
|
-
|
241
|
-
|
272
|
+
# アイテム数
|
273
|
+
def article_size_()
|
274
|
+
return @item_list.size()
|
275
|
+
end
|
276
|
+
|
277
|
+
# ページ数
|
278
|
+
def article_size_max()
|
279
|
+
return @item_list.size() / @config.article_size
|
280
|
+
end
|
281
|
+
|
242
282
|
|
243
|
-
|
283
|
+
# アイテム数を50個とかで取り出せる
|
284
|
+
def article_size(item_list, cnt)
|
285
|
+
# [000-049] cnt 1 (1-1)*50 1*50-1
|
286
|
+
# [050-099] cnt 2 (2-1)*50 2*50-1
|
287
|
+
# [100-149] cnt 3 (3-1)*50 3*50-1
|
288
|
+
|
289
|
+
# ハッシュから配列に変換
|
290
|
+
items = []
|
291
|
+
item_list.each{|key, item|
|
292
|
+
items << item
|
293
|
+
}
|
294
|
+
|
295
|
+
# 配列で処理
|
296
|
+
i = [0, 0]
|
297
|
+
i[0] = (cnt - 1) * @config.article_size
|
298
|
+
i[1] = (cnt * @config.article_size) - 1
|
299
|
+
|
300
|
+
s = i[0]
|
301
|
+
t = []
|
302
|
+
while items[s] != nil and s <= i[1] do
|
303
|
+
t << items[s]
|
304
|
+
s = s + 1
|
305
|
+
end
|
306
|
+
|
307
|
+
# 配列からハッシュに変換
|
308
|
+
item_hash = Hash.new()
|
309
|
+
t.each{|items|
|
310
|
+
items.each{|item|
|
311
|
+
item_hash[item.get_item_date_string()] = [item]
|
244
312
|
}
|
245
313
|
}
|
246
|
-
|
314
|
+
|
315
|
+
return item_hash
|
247
316
|
end
|
248
317
|
|
249
|
-
|
250
|
-
|
251
|
-
@
|
252
|
-
|
253
|
-
i << item
|
318
|
+
# 並び替え
|
319
|
+
def get_item_sort(cnt)
|
320
|
+
return article_size( Hash[ @item_list.sort ], cnt)
|
321
|
+
end
|
254
322
|
|
255
|
-
|
256
|
-
|
323
|
+
# 逆順で並び替え
|
324
|
+
def get_item_sort_reverse(cnt)
|
325
|
+
return article_size( Hash[ @item_list.sort.reverse ], cnt)
|
326
|
+
end
|
327
|
+
|
328
|
+
# カテゴリーのカテゴリー数をハッシュで戻す
|
329
|
+
def get_category_cnt()
|
330
|
+
category_cnt = Hash.new()
|
331
|
+
|
332
|
+
uniq_category_list = [] # 重複削除すみ
|
333
|
+
uniq_category_list = self.get_category_list()
|
334
|
+
|
335
|
+
uniq_category_list.each{|uniq_category|
|
336
|
+
category_cnt[uniq_category] = @all_category_list.count(uniq_category)
|
257
337
|
}
|
258
|
-
|
338
|
+
|
339
|
+
return Hash[ category_cnt.sort ]
|
259
340
|
end
|
260
341
|
|
342
|
+
# カテゴリーを取得する
|
261
343
|
def get_category_list()
|
262
|
-
|
263
|
-
@change_log_private.entrys.each{|date|
|
264
|
-
date.get_items().each{|item|
|
265
|
-
item.get_item_category().each{|category|
|
266
|
-
category_list << category
|
267
|
-
}
|
268
|
-
}
|
269
|
-
}
|
270
|
-
category_list.uniq!
|
271
|
-
return category_list
|
344
|
+
return @all_category_list.uniq()
|
272
345
|
end
|
273
346
|
end
|
274
347
|
end
|
data/lib/Charu/Config.rb
CHANGED
@@ -2,8 +2,13 @@
|
|
2
2
|
|
3
3
|
config = ""
|
4
4
|
config = '
|
5
|
+
# -*- encoding: utf-8 -*-
|
6
|
+
|
5
7
|
module Charu
|
6
8
|
class Config
|
9
|
+
attr_accessor :home_title, :top_home_page, :home_category, :home_description, :css_theme_path, :private_category
|
10
|
+
attr_accessor :change_log_path, :article_size, :www_html_out_path, :www_html_out_path_private
|
11
|
+
attr_accessor :ftp_server, :ftp_port, :ftp_user, :ftp_pass
|
7
12
|
def initialize()
|
8
13
|
# ホームページタイトル
|
9
14
|
@home_title = "TestPage"
|
@@ -12,19 +17,19 @@ module Charu
|
|
12
17
|
@top_home_page = "http://hoge.com/hoge/index.html"
|
13
18
|
|
14
19
|
# ホームページカテゴリー
|
15
|
-
@home_category = ["Ruby", "Python", "Java"]
|
20
|
+
@home_category = ["Ruby", "Python", "Java", "c++", "Ruby_on_Rails", "JavaSciript", "LIPS"]
|
16
21
|
|
17
22
|
# ホームページのdescription
|
18
23
|
@home_description = "日々勉強中"
|
19
24
|
|
20
25
|
# CSS Path
|
21
|
-
@css_theme_path = "./css"
|
26
|
+
@css_theme_path = "./css/"
|
22
27
|
|
23
28
|
# プライベートカテゴリー
|
24
|
-
@
|
29
|
+
@private_category = ["Private", "P", "★", "2ch", "5ch"]
|
25
30
|
|
26
31
|
# Change_Log_path
|
27
|
-
@
|
32
|
+
@change_log_path = "./../ChangeLog"
|
28
33
|
|
29
34
|
# 一度に表示する記事数
|
30
35
|
@article_size = 50
|
@@ -32,11 +37,19 @@ module Charu
|
|
32
37
|
# htmlの作成先
|
33
38
|
@www_html_out_path = "./www/"
|
34
39
|
|
40
|
+
# htmlの作成先 プライベート
|
41
|
+
@www_html_out_path_private = "./Private/"
|
42
|
+
|
35
43
|
# FTPの設定
|
44
|
+
@ftp_server = ""
|
45
|
+
@ftp_port = "21"
|
46
|
+
@ftp_user = ""
|
47
|
+
@ftp_pass = ""
|
36
48
|
|
37
49
|
end
|
38
50
|
end
|
39
51
|
end
|
52
|
+
|
40
53
|
'
|
41
54
|
|
42
55
|
# ディレクトリの確認
|
data/lib/Charu/CreateHtml.rb
CHANGED
@@ -1,9 +1,122 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
#require 'redcarpet'
|
4
|
+
|
5
|
+
require "erb"
|
6
|
+
|
7
|
+
module Charu
|
8
|
+
class Create_Day
|
9
|
+
def initialize()
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Create_Days
|
15
|
+
def initialize()
|
16
|
+
changelogmemo = Charu::ChangeLogMemo.new()
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Charu
|
22
|
+
class Create_Category
|
23
|
+
def initialize()
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Create_Categorys
|
29
|
+
def initialize()
|
30
|
+
changelogmemo = Charu::ChangeLogMemo.new()
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
3
35
|
module Charu
|
4
36
|
class CreateHtml
|
5
37
|
def initialize()
|
6
38
|
|
39
|
+
#markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
40
|
+
|
41
|
+
source= '
|
42
|
+
|
43
|
+
# 見出し1
|
44
|
+
## 見出し2
|
45
|
+
|
46
|
+
* リスト1
|
47
|
+
* リスト2
|
48
|
+
|
49
|
+
このサイトは[mukaer.com](http://mukaer.com)です。
|
50
|
+
|
51
|
+
'
|
52
|
+
@config = Charu::Config.new()
|
53
|
+
|
54
|
+
|
55
|
+
#puts markdown.render(source)
|
56
|
+
@header = File.open("./CharuConfig/template/header.erb").read
|
57
|
+
@footer = File.open("./CharuConfig/template/footer.erb").read
|
58
|
+
@body = File.open("./CharuConfig/template/body.erb").read
|
59
|
+
@day_body = File.open("./CharuConfig/template/day_body.erb").read
|
60
|
+
end
|
61
|
+
|
62
|
+
def keyword()
|
63
|
+
@keywords = @db[:keyword].select(:Keyword).all
|
64
|
+
|
65
|
+
@keyword = ""
|
66
|
+
@keywords.each{|i|
|
67
|
+
i.each{|key, value|
|
68
|
+
@keyword = value + ", " + @keyword}
|
69
|
+
}
|
70
|
+
@keyword.encode!("UTF-8")
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_body()
|
74
|
+
# くっつける
|
75
|
+
|
76
|
+
@htmls = []
|
77
|
+
@days.get_days().each{|day|
|
78
|
+
html = @header + @body + @footer
|
79
|
+
@htmls << [day.get_day_s(), day.get_tile(), html] # くっつける
|
80
|
+
}
|
81
|
+
|
82
|
+
@htmls.each{|day_time, tile, body|
|
83
|
+
erb = ERB.new(body)
|
84
|
+
@htmls << [day_time, tile, erb.result(binding)] # ファイル名とhtmlの配列
|
85
|
+
}
|
86
|
+
file_save()
|
87
|
+
end
|
88
|
+
|
89
|
+
def day_create_body()
|
90
|
+
@days.sort_data().each{|day_s| # 文字列だけのデータ
|
91
|
+
@daydata = []
|
92
|
+
@days.get_days.each{|day|
|
93
|
+
if day_s == day.get_day_s() then
|
94
|
+
@daydata << day
|
95
|
+
else
|
96
|
+
#@daydata << day
|
97
|
+
end
|
98
|
+
@daydata.sort!{|a, b| a.get_Datetime() <=> b.get_Datetime() }
|
99
|
+
@css_path = "./../theme/"
|
100
|
+
@css_theme_path = @css_path + @css_theme + "/" + @css_theme + ".css"
|
101
|
+
htmls = @header + @body + @footer
|
102
|
+
erb = ERB.new(htmls)
|
103
|
+
html = erb.result(binding)
|
104
|
+
# ファイル書き込み
|
105
|
+
begin
|
106
|
+
File.write(@thml_path + "index/" + day_s + ".html", html)
|
107
|
+
rescue
|
108
|
+
p day_s + ".html"
|
109
|
+
p "ファイル書き込みエラー".encode(Encoding::SJIS)
|
110
|
+
end
|
111
|
+
}
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
def file_save()
|
116
|
+
# ファイル書き込み
|
117
|
+
@days.get_days.each{|day_name, title, html|
|
118
|
+
File.write(@thml_path + @file_name, html)
|
119
|
+
}
|
7
120
|
end
|
8
121
|
end
|
9
122
|
end
|
data/lib/Charu/FTP.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'net/ftp'
|
4
|
+
|
5
|
+
module Charu
|
6
|
+
class FtpClariant
|
7
|
+
def initialize()
|
8
|
+
@config = Charu::Config.new()
|
9
|
+
|
10
|
+
@server = @config.server
|
11
|
+
@port = @config.port
|
12
|
+
@user = @config.user
|
13
|
+
@pass = @config.pass
|
14
|
+
@dir = @config.www_html_out_path
|
15
|
+
|
16
|
+
@list = Dir.glob(@dir + '*.html')
|
17
|
+
end
|
18
|
+
|
19
|
+
def put_file()
|
20
|
+
ftp = Net::FTP.new
|
21
|
+
ftp.connect(@server, @port)
|
22
|
+
ftp.login(@user, @pass)
|
23
|
+
|
24
|
+
ftp.chdir('./')
|
25
|
+
p "./ :初期ディレクトリ".encode(Encoding::SJIS)
|
26
|
+
puts ftp.pwd
|
27
|
+
|
28
|
+
file_list = []
|
29
|
+
@list.each{|file|
|
30
|
+
file_list << File::expand_path(file)
|
31
|
+
}
|
32
|
+
ftp.chdir(@dir)
|
33
|
+
p @dir + ":移動ディレクトリ".encode(Encoding::SJIS)
|
34
|
+
puts ftp.pwd
|
35
|
+
|
36
|
+
# アップロード
|
37
|
+
file_list.each{|file|
|
38
|
+
p file
|
39
|
+
ftp.put(file)
|
40
|
+
}
|
41
|
+
p "完了".encode(Encoding::SJIS)
|
42
|
+
puts ftp.pwd
|
43
|
+
|
44
|
+
ftp.quit
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/Charu/version.rb
CHANGED
data/lib/Charu.rb
CHANGED
@@ -9,20 +9,26 @@ require 'Charu/ChangeLogMemo'
|
|
9
9
|
require 'Charu/Config'
|
10
10
|
require 'Charu/Template'
|
11
11
|
require 'Charu/CreateHtml'
|
12
|
-
|
13
|
-
|
12
|
+
require 'Charu/FTP'
|
14
13
|
|
15
14
|
module Charu
|
16
15
|
# Your code goes here...
|
17
16
|
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
#p
|
24
|
-
#p
|
19
|
+
changelogmemo = Charu::ChangeLogMemo.new()
|
20
|
+
changelogmemo.get_item_sort_reverse(1).each{|key, items|
|
21
|
+
items.each{|item|
|
22
|
+
#p item.date
|
23
|
+
#p item.get_item_title.encode(Encoding::SJIS)
|
25
24
|
#p i.get_item_category()
|
26
25
|
}
|
27
|
-
|
28
|
-
|
26
|
+
}
|
27
|
+
p changelogmemo.article_size_max()
|
28
|
+
p changelogmemo.article_size_()
|
29
|
+
#p changelogmemo.get_category_cnt()
|
30
|
+
|
31
|
+
|
32
|
+
createhtml = Charu::CreateHtml.new()
|
33
|
+
|
34
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Charu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShiccaRorl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,27 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redcarpet
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: |-
|
70
|
+
ChangeLogを日記にしているなら便利かも。
|
71
|
+
ChangeLogMemoとは?
|
72
|
+
|
73
|
+
[横着プログラミング 第1回: Unixのメモ技術](http://0xcc.net/unimag/1/)
|
74
|
+
|
75
|
+
[Change Log メモを試してみよう](http://at-aka.blogspot.jp/p/change-log.html)
|
56
76
|
email:
|
57
77
|
- shicca.rorl@gmail.com
|
58
78
|
executables:
|
@@ -78,6 +98,7 @@ files:
|
|
78
98
|
- lib/Charu/ChangeLogMemo.rb
|
79
99
|
- lib/Charu/Config.rb
|
80
100
|
- lib/Charu/CreateHtml.rb
|
101
|
+
- lib/Charu/FTP.rb
|
81
102
|
- lib/Charu/template.rb
|
82
103
|
- lib/Charu/version.rb
|
83
104
|
homepage: https://rubygems.org/gems/Charu
|
@@ -100,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
121
|
version: '0'
|
101
122
|
requirements: []
|
102
123
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.5.2.1
|
104
125
|
signing_key:
|
105
126
|
specification_version: 4
|
106
|
-
summary: ChangeLogMemo Html Converter
|
127
|
+
summary: ChangeLogMemo Html Converter
|
107
128
|
test_files: []
|