CppUmlClass 0.6.0 → 0.8.0
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/README.md +36 -1
- data/exe/create_cpp_uml_class.rb +62 -0
- data/img/.gitattributes +1 -0
- data/img/CppUMLClass.mp4 +3 -0
- data/img/class_color.png +0 -0
- data/img/setting.png +0 -0
- data/lib/CppUmlClass/version.rb +1 -1
- data/lib/config/setting.json +51 -2
- data/lib/create_uml_class.rb +22 -10
- data/lib/css/index.css +1 -1
- data/lib/js/main.js +4 -4
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da605d09be03bb286826853b419039825dd9efe590a41a73dbd4e2e1207564b1
|
4
|
+
data.tar.gz: 0e8c9bc1204d35734d037b105f1c6cfeaea9aba179807f4c6c02af2fb568ef3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28530923ed05bf95eb36a622596caf006a1e658921b503e45080ac1a7c5f2e1d255280c08e787fbe1ba5231eb743bb017e6724635f77e75877e3fb0b9976dde8
|
7
|
+
data.tar.gz: d2af820815a7c7649ce9a931fd5c65ce58f9a93ea63300930b62aa67b141bfc5b572da8861b3a2afcf3d144b01d88ca03a87e18c290856c09dfbaf844112488c
|
data/README.md
CHANGED
@@ -25,12 +25,47 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
25
25
|
|
26
26
|
$ sudo gem install CppUmlClass
|
27
27
|
|
28
|
-
## Usage
|
28
|
+
## Usage(GUI)
|
29
|
+
A browser-based GUI opens.
|
29
30
|
|
30
31
|
$ start_cpp_uml_class.rb
|
31
32
|
|
32
33
|
https://github.com/user-attachments/assets/dfd68556-bf4d-43b7-8fef-b6f951c9147d
|
33
34
|
|
35
|
+
## Usage(command line)
|
36
|
+
command line interface
|
37
|
+
```
|
38
|
+
Usage: create_cpp_uml_class.rb [options] cpp_source_directory out_file
|
39
|
+
-c config_file
|
40
|
+
```
|
41
|
+
config_file defaults to CppUmlClass/config/setting.json in your home directory.
|
42
|
+
|
43
|
+
Example
|
44
|
+
|
45
|
+
$ create_cpp_uml_class.rb ~/tool/cpp_test /tmp/test.pu
|
46
|
+
|
47
|
+
|
48
|
+
## clsss color support
|
49
|
+
|
50
|
+

|
51
|
+
|
52
|
+
## Setting
|
53
|
+
|
54
|
+
- plant uml command
|
55
|
+
- editor to open plant uml file
|
56
|
+
- default class color 1
|
57
|
+
- source path of the class that sets the color 1
|
58
|
+
- default class color 2
|
59
|
+
- source path of the class that sets the color 2
|
60
|
+
- default class color 3
|
61
|
+
- source path of the class that sets the color 2
|
62
|
+
|
63
|
+
The setting file is saved in the home directory under CppUmlClass/config/setting.json.
|
64
|
+
|
65
|
+

|
66
|
+
|
67
|
+
|
68
|
+
|
34
69
|
## Development
|
35
70
|
|
36
71
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
def config_json_hash(json)
|
7
|
+
config = {}
|
8
|
+
json["setting_list"].each do |j|
|
9
|
+
config[j["name"]] = j["value"]
|
10
|
+
end
|
11
|
+
return config
|
12
|
+
end
|
13
|
+
|
14
|
+
opt = Hash.new
|
15
|
+
opts = OptionParser.new
|
16
|
+
opts.banner = "Usage: create_cpp_uml_class.rb [options] cpp_source_directory out_file"
|
17
|
+
|
18
|
+
opts.on("-c config_file") { |v| opt[:config_file] = v } # config file path
|
19
|
+
opts.parse!(ARGV)
|
20
|
+
in_dir = ARGV[0]
|
21
|
+
out_file = ARGV[1]
|
22
|
+
if in_dir == nil or out_file == nil
|
23
|
+
puts opts.help
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
|
27
|
+
dir = File.dirname(File.expand_path(__FILE__ + "/../"))
|
28
|
+
puts "dir=#{dir}"
|
29
|
+
home_dir = ENV["HOME"] + "/" + dir.split("/")[-1].gsub(/-[0-9\.-]+/, "")
|
30
|
+
puts "home_dir=#{home_dir}"
|
31
|
+
|
32
|
+
if opt[:config_file] == nil
|
33
|
+
json = JSON.parse(File.read("#{home_dir}/config/setting.json"))
|
34
|
+
else
|
35
|
+
json = JSON.parse(File.read(opt[:config_file]))
|
36
|
+
end
|
37
|
+
json_config = config_json_hash(json)
|
38
|
+
|
39
|
+
file = "#{dir}/lib/create_uml_class.rb"
|
40
|
+
puts file
|
41
|
+
load file
|
42
|
+
|
43
|
+
@config = json_config
|
44
|
+
uml = create_uml_class(in_dir, out_file)
|
45
|
+
|
46
|
+
File.open(out_file, "w") do |f|
|
47
|
+
f.puts uml
|
48
|
+
end
|
49
|
+
|
50
|
+
# PlantUMLの実行
|
51
|
+
out_svg = out_file.gsub(File.extname(out_file), "") + ".svg"
|
52
|
+
FileUtils.rm_f out_svg
|
53
|
+
cmd = "#{@config["plantuml"]} #{out_file}"
|
54
|
+
puts cmd
|
55
|
+
system cmd
|
56
|
+
if File.exist? out_svg
|
57
|
+
puts File.binread out_file
|
58
|
+
puts "create #{out_svg}"
|
59
|
+
else
|
60
|
+
puts "plantuml error"
|
61
|
+
puts cmd
|
62
|
+
end
|
data/img/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
data/img/CppUMLClass.mp4
ADDED
data/img/class_color.png
ADDED
Binary file
|
data/img/setting.png
ADDED
Binary file
|
data/lib/CppUmlClass/version.rb
CHANGED
data/lib/config/setting.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": 0.
|
2
|
+
"version": 0.2,
|
3
3
|
"setting_list": [
|
4
4
|
{
|
5
5
|
"name": "plantuml",
|
@@ -15,9 +15,58 @@
|
|
15
15
|
"select": "",
|
16
16
|
"description": "UMLを開くエディタ"
|
17
17
|
},
|
18
|
+
{
|
19
|
+
"name": "default_class_color",
|
20
|
+
"value": "#LightGray",
|
21
|
+
"type": "input",
|
22
|
+
"select": "",
|
23
|
+
"description": "デフォルトのクラス色"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"name": "class_color_path1",
|
27
|
+
"value": "(path1)",
|
28
|
+
"type": "input",
|
29
|
+
"select": "",
|
30
|
+
"description": "色を付けるクラスのソースパス1(正規表現)"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"name": "class_color1",
|
34
|
+
"value": "#LightBlue",
|
35
|
+
"type": "input",
|
36
|
+
"select": "",
|
37
|
+
"description": "ソースパスと一致するクラス色1"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"name": "class_color_path2",
|
41
|
+
"value": "(path2)",
|
42
|
+
"type": "input",
|
43
|
+
"select": "",
|
44
|
+
"description": "色を付けるクラスのソースパス2(正規表現)"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"name": "class_color2",
|
48
|
+
"value": "#LightGreen",
|
49
|
+
"type": "input",
|
50
|
+
"select": "",
|
51
|
+
"description": "ソースパスと一致するクラス色2"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"name": "class_color_path3",
|
55
|
+
"value": "(path3)",
|
56
|
+
"type": "input",
|
57
|
+
"select": "",
|
58
|
+
"description": "色を付けるクラスのソースパス3(正規表現)"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"name": "class_color3",
|
62
|
+
"value": "#orange",
|
63
|
+
"type": "input",
|
64
|
+
"select": "",
|
65
|
+
"description": "ソースパスと一致するクラス色3"
|
66
|
+
},
|
18
67
|
{
|
19
68
|
"name": "exclude_path",
|
20
|
-
"value": "(
|
69
|
+
"value": "(exclude_path)",
|
21
70
|
"type": "input",
|
22
71
|
"select": "",
|
23
72
|
"description": "除外するパス(正規表現)"
|
data/lib/create_uml_class.rb
CHANGED
@@ -10,7 +10,8 @@ CStruct = Struct.new(:type,
|
|
10
10
|
:var_list,
|
11
11
|
:method_list,
|
12
12
|
:inherit_list,
|
13
|
-
:composition_list
|
13
|
+
:composition_list,
|
14
|
+
:class_color)
|
14
15
|
|
15
16
|
def get_gcc_path
|
16
17
|
kernel = Facter.value(:kernel)
|
@@ -43,18 +44,20 @@ def get_unifdef_path
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def get_clang_format_path
|
47
|
+
dir = File.dirname(File.expand_path(__FILE__)) + "/"
|
46
48
|
kernel = Facter.value(:kernel)
|
47
49
|
if kernel == "windows"
|
48
50
|
ENV["PATH"].split(";").each do |path|
|
49
51
|
clang_format_path = "#{path}\\clang-format"
|
50
52
|
if File.exists? clang_format_path
|
51
|
-
return "rubyw " + clang_format_path + " --style=file:'.clang-format' "
|
53
|
+
return "rubyw " + clang_format_path + " --style=file:'#{dir}.clang-format' "
|
52
54
|
end
|
53
55
|
end
|
54
56
|
return ""
|
55
57
|
else
|
56
58
|
end
|
57
|
-
|
59
|
+
#puts "clang-format --style=file:'#{dir}.clang-format' "
|
60
|
+
return "clang-format --style=file:'#{dir}.clang-format' "
|
58
61
|
end
|
59
62
|
|
60
63
|
# ソースコードの整形
|
@@ -108,7 +111,7 @@ def print_uml(out, out_list)
|
|
108
111
|
out.push "namespace #{o_list.name} {"
|
109
112
|
elsif o_list.type == :class_end
|
110
113
|
pp o_list if o_list.name == ""
|
111
|
-
out.push "class #{o_list.name} {"
|
114
|
+
out.push "class #{o_list.name} #{o_list.class_color}{"
|
112
115
|
# インスタンス変数の出力
|
113
116
|
o_list.var_list.uniq.each do |iv|
|
114
117
|
out.push iv
|
@@ -120,11 +123,11 @@ def print_uml(out, out_list)
|
|
120
123
|
out.push "}"
|
121
124
|
# 継承リストの出力
|
122
125
|
o_list.inherit_list.each do |ih|
|
123
|
-
out.push "#{o_list.name} -[#
|
126
|
+
out.push "#{o_list.name} -[#black]--|> #{ih}"
|
124
127
|
end
|
125
128
|
# compo
|
126
129
|
o_list.composition_list.uniq.each do |co|
|
127
|
-
out.push "#{o_list.name} *-[#
|
130
|
+
out.push "#{o_list.name} *-[#{o_list.class_color}]-- #{co}"
|
128
131
|
end
|
129
132
|
elsif o_list.type == :module_end
|
130
133
|
# インスタンス変数がある場合はモジュール名と同じクラスを定義
|
@@ -145,11 +148,11 @@ def print_uml(out, out_list)
|
|
145
148
|
out.push "}"
|
146
149
|
# 継承リストの出力
|
147
150
|
o_list.inherit_list.each do |ih|
|
148
|
-
out.push "#{o_list.name} -[#
|
151
|
+
out.push "#{o_list.name} -[#black]--|> #{ih}"
|
149
152
|
end
|
150
153
|
# compo
|
151
154
|
o_list.composition_list.uniq.each do |co|
|
152
|
-
out.push "#{o_list.name} *-[#
|
155
|
+
out.push "#{o_list.name} *-[#{o_list.class_color}]-- #{co}"
|
153
156
|
end
|
154
157
|
end
|
155
158
|
out.push "}"
|
@@ -204,7 +207,7 @@ def composition_list_create(in_dir, out_list)
|
|
204
207
|
#base_name = work.split(" : ")[1].to_s.split(" ")[1].to_s.gsub(/<.*>/, "")
|
205
208
|
#puts "start class #{class_name}"
|
206
209
|
if class_name.to_s != ""
|
207
|
-
cstruct_list.push CStruct.new(:
|
210
|
+
cstruct_list.push CStruct.new(:class_start, class_name, block_count, [], [], [], [])
|
208
211
|
end
|
209
212
|
end
|
210
213
|
# 関数の開始
|
@@ -318,7 +321,16 @@ def create_uml_class(in_dir, out_file)
|
|
318
321
|
next
|
319
322
|
end
|
320
323
|
out_list.push CStruct.new(:class_start, class_name, block_count, [], [], [], [])
|
321
|
-
|
324
|
+
if @config["class_color_path1"].to_s != "" and file =~ Regexp.new(@config["class_color_path1"])
|
325
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [], @config["class_color1"])
|
326
|
+
elsif @config["class_color_path2"].to_s != "" and file =~ Regexp.new(@config["class_color_path2"])
|
327
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [], @config["class_color2"])
|
328
|
+
elsif @config["class_color_path3"].to_s != "" and file =~ Regexp.new(@config["class_color_path3"])
|
329
|
+
pp file
|
330
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [], @config["class_color3"])
|
331
|
+
else
|
332
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [], @config["default_class_color"])
|
333
|
+
end
|
322
334
|
base_name.each do |name|
|
323
335
|
name.gsub!(/,/, "")
|
324
336
|
#puts "base_name=#{name}"
|
data/lib/css/index.css
CHANGED
data/lib/js/main.js
CHANGED
@@ -252,8 +252,8 @@ function setting_dialog(open_id, dialog_id, json_file) {
|
|
252
252
|
, show: "slide" //表示時のアニメーション
|
253
253
|
, hide: "explode" //閉じた時のアニメーション
|
254
254
|
, title: "Setting" //ダイアログのタイトル
|
255
|
-
, width:
|
256
|
-
, height:
|
255
|
+
, width: 650 //ダイアログの横幅
|
256
|
+
, height: 500 //ダイアログの高さ
|
257
257
|
, resizable: true //リサイズ可
|
258
258
|
, closeOnEscape: false //[ESC]キーで閉じられなくする
|
259
259
|
, draggable: true //ダイアログの移動を可に
|
@@ -384,10 +384,10 @@ function openFile(file) {
|
|
384
384
|
$(document).ready(function () {
|
385
385
|
|
386
386
|
// サーバに接続
|
387
|
-
server_connect("ws://localhost:
|
387
|
+
server_connect("ws://localhost:34731/wsserver")
|
388
388
|
window.onload = function (e) {
|
389
389
|
// サーバに接続
|
390
|
-
//server_connect("ws://localhost:
|
390
|
+
//server_connect("ws://localhost:34731/wsserver")
|
391
391
|
}
|
392
392
|
|
393
393
|
// menu
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CppUmlClass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Kuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_app_base
|
@@ -28,6 +28,7 @@ description: Create a C++ UML class diagram.
|
|
28
28
|
email:
|
29
29
|
- masataka.kuwayama@gmail.com
|
30
30
|
executables:
|
31
|
+
- create_cpp_uml_class.rb
|
31
32
|
- start_cpp_uml_class.rb
|
32
33
|
- start_cpp_uml_class.rbw
|
33
34
|
extensions: []
|
@@ -44,8 +45,13 @@ files:
|
|
44
45
|
- Rakefile
|
45
46
|
- bin/console
|
46
47
|
- bin/setup
|
48
|
+
- exe/create_cpp_uml_class.rb
|
47
49
|
- exe/start_cpp_uml_class.rb
|
48
50
|
- exe/start_cpp_uml_class.rbw
|
51
|
+
- img/.gitattributes
|
52
|
+
- img/CppUMLClass.mp4
|
53
|
+
- img/class_color.png
|
54
|
+
- img/setting.png
|
49
55
|
- lib/.clang-format
|
50
56
|
- lib/CppUmlClass.rb
|
51
57
|
- lib/CppUmlClass/version.rb
|