Charu 0.0.9 → 0.0.11
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 +4 -4
- data/Execution-Cygwin.sh +5 -0
- data/README.md +1 -0
- data/lib/Charu.rb +33 -24
- data/lib/Charu/ChangeLogMemo.rb +2 -2
- data/lib/Charu/Config.rb +4 -0
- data/lib/Charu/CreateHtml.rb +5 -4
- data/lib/Charu/Debug.rb +32 -0
- data/lib/Charu/FTP.rb +36 -15
- data/lib/Charu/Sitemap.rb +18 -0
- data/lib/Charu/Template.rb +56 -1
- data/lib/Charu/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83dcb882bd64f6c482e4c757a4b3d6a29dfead3a
|
4
|
+
data.tar.gz: 421a756feaad4f44969830a55dab0eac3152952a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad5d7fcf9d50ae0f73c7d4bc96c68fe91db057ad769208e64f55dde9860201e94cbcc394b2b37dc10c3c03f453c3e6f04b5c8c8a0a34d5c6344c00a940bcf4c
|
7
|
+
data.tar.gz: 2716dad892809399769bfa4be6a55b21db2ed7fb530a63f67689b6f1686855b5c09a16e9157bc0d1519afb911fbdb314a1b99faec375a49069b4e4b9f2d2f47c
|
data/Execution-Cygwin.sh
ADDED
data/README.md
CHANGED
data/lib/Charu.rb
CHANGED
@@ -1,34 +1,43 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
|
4
|
-
require '
|
3
|
+
if "debug" == ARGV[0] then
|
4
|
+
require 'Charu/Config'
|
5
|
+
require 'Charu/ChangeLogMemo'
|
6
|
+
require 'Charu/CreateHtml'
|
7
|
+
require 'Charu/FTP'
|
8
|
+
require 'Charu/Debug'
|
5
9
|
|
6
|
-
|
10
|
+
debug = Charu::Debug.new()
|
7
11
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require 'Charu/CreateHtml'
|
12
|
-
require 'Charu/FTP'
|
12
|
+
#debug.changelogmemo()
|
13
|
+
#debug.createhtml()
|
14
|
+
debug.ftp()
|
13
15
|
|
14
|
-
|
15
|
-
# Your code goes here...
|
16
|
+
else
|
16
17
|
|
17
|
-
|
18
|
+
require "Charu/version"
|
19
|
+
require 'bundler'
|
18
20
|
|
19
|
-
|
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)
|
24
|
-
#p i.get_item_category()
|
25
|
-
#}
|
26
|
-
#}
|
27
|
-
#p changelogmemo.article_size_max()
|
28
|
-
#p changelogmemo.article_size_()
|
29
|
-
#p changelogmemo.get_category_cnt()
|
21
|
+
Bundler.require
|
30
22
|
|
23
|
+
require 'redcarpet'
|
31
24
|
|
32
|
-
|
33
|
-
|
25
|
+
require 'Charu/ChangeLogMemo'
|
26
|
+
require 'Charu/Config'
|
27
|
+
require 'Charu/Template'
|
28
|
+
require 'Charu/CreateHtml'
|
29
|
+
require 'Charu/FTP'
|
30
|
+
#require 'Charu/Sitemap'
|
34
31
|
|
32
|
+
module Charu
|
33
|
+
# Your code goes here...
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
page_counter = Charu::PageCounter.new()
|
38
|
+
page_counter.create_html()
|
39
|
+
|
40
|
+
ftp_clariant = Charu::FtpClariant.new()
|
41
|
+
ftp_clariant.put_file()
|
42
|
+
|
43
|
+
end
|
data/lib/Charu/ChangeLogMemo.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
require 'redcarpet'
|
4
|
-
|
5
3
|
module Charu
|
6
4
|
class Category
|
7
5
|
attr_accessor :category
|
@@ -99,6 +97,8 @@ module Charu
|
|
99
97
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
100
98
|
html = markdown.render(@item_log)
|
101
99
|
|
100
|
+
html.gsub!(/(\r\n|\r\f\n|\r|\n)/, "</p>\n<p>")
|
101
|
+
|
102
102
|
return html
|
103
103
|
end
|
104
104
|
return ""
|
data/lib/Charu/Config.rb
CHANGED
@@ -8,6 +8,7 @@ module Charu
|
|
8
8
|
attr_accessor :home_title, :top_home_page, :home_category, :home_description, :css_theme_path, :private_category
|
9
9
|
attr_accessor :change_log_path, :article_size, :www_html_out_path, :www_html_out_path_private, :public_category
|
10
10
|
attr_accessor :ftp_server, :ftp_port, :ftp_user, :ftp_pass
|
11
|
+
attr_accessor :wget_path
|
11
12
|
def initialize()
|
12
13
|
# ホームページタイトル
|
13
14
|
@home_title = "TestPage"
|
@@ -48,6 +49,9 @@ module Charu
|
|
48
49
|
@ftp_user = ""
|
49
50
|
@ftp_pass = ""
|
50
51
|
|
52
|
+
# Wgetのパス
|
53
|
+
@wget_path = ""
|
54
|
+
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
data/lib/Charu/CreateHtml.rb
CHANGED
@@ -25,7 +25,7 @@ module Charu
|
|
25
25
|
def create_html()
|
26
26
|
p "pages.size " + @pages.size.to_s
|
27
27
|
@pages.each{|page|
|
28
|
-
create_html = Charu::CreateHtml.new(page)
|
28
|
+
create_html = Charu::CreateHtml.new(page, @pages.size)
|
29
29
|
}
|
30
30
|
|
31
31
|
end
|
@@ -33,10 +33,11 @@ module Charu
|
|
33
33
|
end
|
34
34
|
|
35
35
|
class CreateHtml
|
36
|
-
attr_accessor :keyword, :css_theme_path, :link, :hiduke, :day, :title, :config
|
37
|
-
def initialize(page)
|
36
|
+
attr_accessor :keyword, :css_theme_path, :link, :hiduke, :day, :title, :config, :page, :page_max
|
37
|
+
def initialize(page, page_max)
|
38
38
|
@config = Charu::Config.new()
|
39
39
|
|
40
|
+
@page_max = page_max
|
40
41
|
@page = page
|
41
42
|
|
42
43
|
@header = File.open("./CharuConfig/template/header.erb").read
|
@@ -122,4 +123,4 @@ module Charu
|
|
122
123
|
}
|
123
124
|
end
|
124
125
|
end
|
125
|
-
end
|
126
|
+
end
|
data/lib/Charu/Debug.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module Charu
|
4
|
+
class Debug
|
5
|
+
def initialize()
|
6
|
+
print "=====ディバックモード=====\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
def changelogmemo()
|
10
|
+
#changelogmemo = Charu::ChangeLogMemo.new()
|
11
|
+
#changelogmemo.get_item_sort_reverse(1).each{|key, items|
|
12
|
+
#items.each{|item|
|
13
|
+
#p item.date
|
14
|
+
#p item.get_item_title.encode(Encoding::SJIS)
|
15
|
+
#p i.get_item_category()
|
16
|
+
#}
|
17
|
+
#}
|
18
|
+
#p changelogmemo.article_size_max()
|
19
|
+
#p changelogmemo.article_size_()
|
20
|
+
#p changelogmemo.get_category_cnt()
|
21
|
+
end
|
22
|
+
|
23
|
+
def ftp()
|
24
|
+
ftp_clariant = Charu::FtpClariant.new()
|
25
|
+
ftp_clariant.put_file()
|
26
|
+
end
|
27
|
+
|
28
|
+
def createhtml()
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/Charu/FTP.rb
CHANGED
@@ -7,38 +7,59 @@ module Charu
|
|
7
7
|
def initialize()
|
8
8
|
@config = Charu::Config.new()
|
9
9
|
|
10
|
-
@server = @config.
|
11
|
-
@port = @config.
|
12
|
-
@user = @config.
|
13
|
-
@pass = @config.
|
10
|
+
@server = @config.ftp_server
|
11
|
+
@port = @config.ftp_port
|
12
|
+
@user = @config.ftp_user
|
13
|
+
@pass = @config.ftp_pass
|
14
14
|
@dir = @config.www_html_out_path
|
15
15
|
|
16
|
-
@list = Dir.glob(@dir + '
|
16
|
+
@list = Dir.glob(@dir + './**/*')
|
17
|
+
@file_list = []
|
18
|
+
@dir_list = []
|
19
|
+
|
17
20
|
end
|
18
21
|
|
19
22
|
def put_file()
|
23
|
+
# 相対パスから絶対パスへ
|
24
|
+
file_list = []
|
25
|
+
@list.each{|file|
|
26
|
+
file_list << File::expand_path(file) # 絶対パスを取得する
|
27
|
+
}
|
28
|
+
|
29
|
+
# ディレクトリかファイルか判断
|
30
|
+
file_list.each{|file|
|
31
|
+
if FileTest.directory? file
|
32
|
+
# ディレクトリのときの処理
|
33
|
+
@dir_list << file
|
34
|
+
|
35
|
+
elsif FileTest.file? file
|
36
|
+
# ファイルのときの処理
|
37
|
+
@file_list << file
|
38
|
+
else
|
39
|
+
raise print('ファイルでもディレクトリでもない')
|
40
|
+
end
|
41
|
+
}
|
42
|
+
p @dir_list
|
43
|
+
p @file_list
|
44
|
+
|
20
45
|
ftp = Net::FTP.new
|
21
46
|
ftp.connect(@server, @port)
|
22
47
|
ftp.login(@user, @pass)
|
23
48
|
|
24
49
|
ftp.chdir('./')
|
25
|
-
|
50
|
+
print "./ :初期ディレクトリ\n"
|
26
51
|
puts ftp.pwd
|
27
52
|
|
28
|
-
|
29
|
-
@
|
30
|
-
|
31
|
-
}
|
32
|
-
ftp.chdir(@dir)
|
33
|
-
p @dir + ":移動ディレクトリ".encode(Encoding::SJIS)
|
34
|
-
puts ftp.pwd
|
53
|
+
#ftp.chdir(@dir)
|
54
|
+
#print @dir + ":移動ディレクトリ\n"
|
55
|
+
#puts ftp.pwd
|
35
56
|
|
36
57
|
# アップロード
|
37
|
-
file_list.each{|file|
|
58
|
+
@file_list.each{|file|
|
38
59
|
p file
|
39
60
|
ftp.put(file)
|
40
61
|
}
|
41
|
-
|
62
|
+
print "完了\n"
|
42
63
|
puts ftp.pwd
|
43
64
|
|
44
65
|
ftp.quit
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
|
4
|
+
module Charu
|
5
|
+
class FtpClariant
|
6
|
+
def initialize()
|
7
|
+
@config = Charu::Config.new()
|
8
|
+
|
9
|
+
|
10
|
+
system("#{@config.wget_path} -r -l 3 -Rjpg,png,css,js,gif -I /sp -X /sp/user -D #{@config.top_home_page} -E #{@config.top_home_page}")
|
11
|
+
|
12
|
+
sleep 20
|
13
|
+
|
14
|
+
system("find #{@config.top_home_page} -type f > #{@config.top_home_page}.filelist.txt")
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/Charu/Template.rb
CHANGED
@@ -15,7 +15,21 @@ header = '<!doctype html>
|
|
15
15
|
<title><%= @config.home_title %></title>
|
16
16
|
|
17
17
|
<style type="text/css">
|
18
|
-
|
18
|
+
.page{
|
19
|
+
font-size: 20pt;
|
20
|
+
}
|
21
|
+
code{
|
22
|
+
font-size: 15pt;
|
23
|
+
color: white;
|
24
|
+
background-color: black;
|
25
|
+
}
|
26
|
+
a:visited{
|
27
|
+
color: #FF0000;
|
28
|
+
}
|
29
|
+
#page_a:hover{
|
30
|
+
font-size: 20pt;
|
31
|
+
color: black;
|
32
|
+
}
|
19
33
|
</style>
|
20
34
|
|
21
35
|
</head>
|
@@ -27,6 +41,16 @@ header = '<!doctype html>
|
|
27
41
|
|
28
42
|
body = ""
|
29
43
|
body = '
|
44
|
+
<center class="page">
|
45
|
+
<a href="./index.html" id="page_a">1</a>
|
46
|
+
<% i = 1 %>
|
47
|
+
<% while i < @page_max - 1 do %>
|
48
|
+
<a href="./index<%= i + 1 %>.html" id="page_a"><%= i + 1 %></a>
|
49
|
+
<% i = i + 1 %>
|
50
|
+
<% end %>
|
51
|
+
<p>ページ</p>
|
52
|
+
</center>
|
53
|
+
|
30
54
|
<% @changelogmemo.each{|key, items| %>
|
31
55
|
<% items.each{|item| %>
|
32
56
|
<h2><span class="title">
|
@@ -36,15 +60,36 @@ body = '
|
|
36
60
|
<p><%= item.get_item_log() %></p>
|
37
61
|
<% } %>
|
38
62
|
<% } %>
|
63
|
+
|
64
|
+
<center class="page">
|
65
|
+
<a href="./index.html">1</a>
|
66
|
+
<% i = 1 %>
|
67
|
+
<% while i < @page_max - 1 do %>
|
68
|
+
<a href="./index<%= i + 1 %>.html"><%= i + 1 %></a>
|
69
|
+
<% i = i + 1 %>
|
70
|
+
<% end %>
|
71
|
+
<p>ページ</p>
|
72
|
+
</center>
|
39
73
|
'
|
40
74
|
|
41
75
|
|
42
76
|
day_body = ""
|
43
77
|
day_body = '
|
78
|
+
|
44
79
|
<a href="./index.html"><h1><%= @title %></h1></a>
|
45
80
|
<br>
|
46
81
|
<body>
|
47
82
|
|
83
|
+
<center class="page">
|
84
|
+
<a href="./index.html">1</a>
|
85
|
+
<% i = 1 %>
|
86
|
+
<% while i < @page_max - 1 do %>
|
87
|
+
<a href="./index<%= i + 1 %>.html"><%= i + 1 %></a>
|
88
|
+
<% i = i + 1 %>
|
89
|
+
<% end %>
|
90
|
+
<p>ページ</p>
|
91
|
+
</center>
|
92
|
+
|
48
93
|
<% @days.each{|day| %>
|
49
94
|
<h2><span class="title">
|
50
95
|
<% link = "日記" %>
|
@@ -53,6 +98,16 @@ day_body = '
|
|
53
98
|
<p><%= day[:Log] %></p>
|
54
99
|
<% } %>
|
55
100
|
|
101
|
+
<center class="page">
|
102
|
+
<a href="./index.html">1</a>
|
103
|
+
<% i = 1 %>
|
104
|
+
<% while i < @page_max - 1 do %>
|
105
|
+
<a href="./index<%= i + 1 %>.html"><%= i + 1 %></a>
|
106
|
+
<% i = i + 1 %>
|
107
|
+
<% end %>
|
108
|
+
<p>ページ</p>
|
109
|
+
</center>
|
110
|
+
|
56
111
|
</body>
|
57
112
|
'
|
58
113
|
|
data/lib/Charu/version.rb
CHANGED
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.11
|
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-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- ".travis.yml"
|
83
83
|
- CODE_OF_CONDUCT.md
|
84
84
|
- Charu.gemspec
|
85
|
+
- Execution-Cygwin.sh
|
86
|
+
- Execution-Windows.cmd
|
85
87
|
- Gemfile
|
86
88
|
- LICENSE.txt
|
87
89
|
- README.md
|
@@ -93,7 +95,9 @@ files:
|
|
93
95
|
- lib/Charu/ChangeLogMemo.rb
|
94
96
|
- lib/Charu/Config.rb
|
95
97
|
- lib/Charu/CreateHtml.rb
|
98
|
+
- lib/Charu/Debug.rb
|
96
99
|
- lib/Charu/FTP.rb
|
100
|
+
- lib/Charu/Sitemap.rb
|
97
101
|
- lib/Charu/Template.rb
|
98
102
|
- lib/Charu/version.rb
|
99
103
|
homepage: https://rubygems.org/gems/Charu
|