python_uml_class 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 94b38ecf2e01cf7564127df3fcdcf53c30983d56265464c891943587773fe8a6
4
+ data.tar.gz: 1d9eb97b1c61f55ed66eb145f47961530c098e53d44406a3551a06ccd0524861
5
+ SHA512:
6
+ metadata.gz: 7ab2ed48e092b4326d36f5fefd46b59114f9dd9473edd10271493cb5593af3737969c06e27bbb21a0b5affe937d90624ceed5be8e8a0cd3d5b401feda7367f55
7
+ data.tar.gz: 5e2d6938cbe8555cedd8eff6063ed6c4c4c943327a64118db6f8f9c1f1bc899493cbd458dcf59345fc3669a061ab5e67af4f0c1156a6c19d6e1d904ae1a55300
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in python_uml_class.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ python_uml_class (0.1.0)
5
+ browser_app_base (~> 0.1)
6
+ facter (~> 4.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ base64 (0.2.0)
14
+ browser_app_base (0.1.7)
15
+ facter
16
+ json
17
+ sinatra
18
+ sinatra-contrib
19
+ sinatra-websocket
20
+ thin
21
+ daemons (1.4.1)
22
+ diff-lcs (1.5.0)
23
+ em-websocket (0.3.8)
24
+ addressable (>= 2.1.1)
25
+ eventmachine (>= 0.12.9)
26
+ eventmachine (1.2.7)
27
+ facter (4.5.1)
28
+ hocon (~> 1.3)
29
+ thor (>= 1.0.1, < 2.0)
30
+ hocon (1.4.0)
31
+ json (2.7.1)
32
+ multi_json (1.15.0)
33
+ mustermann (3.0.0)
34
+ ruby2_keywords (~> 0.0.1)
35
+ public_suffix (5.0.4)
36
+ rack (2.2.8)
37
+ rack-protection (3.2.0)
38
+ base64 (>= 0.1.0)
39
+ rack (~> 2.2, >= 2.2.4)
40
+ rake (13.1.0)
41
+ rspec (3.12.0)
42
+ rspec-core (~> 3.12.0)
43
+ rspec-expectations (~> 3.12.0)
44
+ rspec-mocks (~> 3.12.0)
45
+ rspec-core (3.12.2)
46
+ rspec-support (~> 3.12.0)
47
+ rspec-expectations (3.12.3)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.12.0)
50
+ rspec-mocks (3.12.6)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.12.0)
53
+ rspec-support (3.12.1)
54
+ ruby2_keywords (0.0.5)
55
+ sinatra (3.2.0)
56
+ mustermann (~> 3.0)
57
+ rack (~> 2.2, >= 2.2.4)
58
+ rack-protection (= 3.2.0)
59
+ tilt (~> 2.0)
60
+ sinatra-contrib (3.2.0)
61
+ multi_json (>= 0.0.2)
62
+ mustermann (~> 3.0)
63
+ rack-protection (= 3.2.0)
64
+ sinatra (= 3.2.0)
65
+ tilt (~> 2.0)
66
+ sinatra-websocket (0.3.1)
67
+ em-websocket (~> 0.3.6)
68
+ eventmachine
69
+ thin (>= 1.3.1, < 2.0.0)
70
+ thin (1.8.2)
71
+ daemons (~> 1.0, >= 1.0.9)
72
+ eventmachine (~> 1.0, >= 1.0.4)
73
+ rack (>= 1, < 3)
74
+ thor (1.3.0)
75
+ tilt (2.3.0)
76
+
77
+ PLATFORMS
78
+ x86_64-linux
79
+
80
+ DEPENDENCIES
81
+ python_uml_class!
82
+ rake (~> 13.0)
83
+ rspec (~> 3.0)
84
+
85
+ BUNDLED WITH
86
+ 2.4.21
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 masataka kuwayama
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # PythonUmlClass
2
+ Create a python class diagram
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fileutils"
4
+ require "facter"
5
+ require "tmpdir"
6
+ require "json"
7
+
8
+ # tmpdirディレクトリにコピー
9
+ dir = File.dirname(File.expand_path(__FILE__ + "/../"))
10
+ home_dir = ENV["HOME"] + "/" + dir.split("/")[-1].gsub(/-[0-9\.-]+/,"")
11
+ puts "home_dir=#{home_dir}"
12
+ Dir.mktmpdir { |tmpdir|
13
+ outdir = tmpdir + "/" + dir.split("/")[-1]
14
+ FileUtils.mkdir_p outdir
15
+ FileUtils.mkdir_p home_dir
16
+ puts outdir
17
+ Dir.glob("#{dir}/lib/*") do |f|
18
+ if f =~ /config$/
19
+ # configはhomeにコピー
20
+ if !File.exists? "#{home_dir}/config"
21
+ puts "#{f} => #{home_dir}/"
22
+ FileUtils.cp_r f, "#{home_dir}/"
23
+ end
24
+ else
25
+ puts "#{f} => #{outdir}/"
26
+ FileUtils.cp_r f, "#{outdir}/"
27
+ end
28
+ end
29
+ begin
30
+ json = JSON.parse(File.read("#{home_dir}/config/setting.json"))
31
+ old_version = json["version"]
32
+ rescue
33
+ old_version = ""
34
+ end
35
+ json = JSON.parse(File.read("#{dir}/lib/config/setting.json"))
36
+ new_version = json["version"]
37
+ puts "#{old_version} == #{new_version}"
38
+ if old_version.to_s != new_version.to_s
39
+ FileUtils.cp "#{dir}/lib/config/setting.json", "#{home_dir}/config/setting.json"
40
+ end
41
+
42
+ FileUtils.cd "#{outdir}"
43
+ kernel = Facter.value(:kernel)
44
+ if kernel == "windows"
45
+ system "rubyw ./start.rb"
46
+ elsif kernel == "Linux"
47
+ system "ruby ./start.rb"
48
+ else
49
+ system "ruby ./start.rb"
50
+ end
51
+ FileUtils.cd ENV["HOME"]
52
+ }
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fileutils"
4
+ require "facter"
5
+ require "tmpdir"
6
+ require "json"
7
+
8
+ # tmpdirディレクトリにコピー
9
+ dir = File.dirname(File.expand_path(__FILE__ + "/../"))
10
+ home_dir = ENV["HOME"] + "/" + dir.split("/")[-1].gsub(/-[0-9\.-]+/,"")
11
+ puts "home_dir=#{home_dir}"
12
+ Dir.mktmpdir { |tmpdir|
13
+ outdir = tmpdir + "/" + dir.split("/")[-1]
14
+ FileUtils.mkdir_p outdir
15
+ FileUtils.mkdir_p home_dir
16
+ puts outdir
17
+ Dir.glob("#{dir}/lib/*") do |f|
18
+ if f =~ /config$/
19
+ # configはhomeにコピー
20
+ if !File.exists? "#{home_dir}/config"
21
+ puts "#{f} => #{home_dir}/"
22
+ FileUtils.cp_r f, "#{home_dir}/"
23
+ end
24
+ else
25
+ puts "#{f} => #{outdir}/"
26
+ FileUtils.cp_r f, "#{outdir}/"
27
+ end
28
+ end
29
+ begin
30
+ json = JSON.parse(File.read("#{home_dir}/config/setting.json"))
31
+ old_version = json["version"]
32
+ rescue
33
+ old_version = ""
34
+ end
35
+ json = JSON.parse(File.read("#{dir}/lib/config/setting.json"))
36
+ new_version = json["version"]
37
+ puts "#{old_version} == #{new_version}"
38
+ if old_version.to_s != new_version.to_s
39
+ FileUtils.cp "#{dir}/lib/config/setting.json", "#{home_dir}/config/setting.json"
40
+ end
41
+
42
+ FileUtils.cd "#{outdir}"
43
+ kernel = Facter.value(:kernel)
44
+ if kernel == "windows"
45
+ system "rubyw ./start.rb"
46
+ elsif kernel == "Linux"
47
+ system "ruby ./start.rb"
48
+ else
49
+ system "ruby ./start.rb"
50
+ end
51
+ FileUtils.cd ENV["HOME"]
52
+ }
data/lib/app_load.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'python_uml_class.rb'
2
+ $app = PythonUmlClass.new
@@ -0,0 +1,4 @@
1
+ {
2
+ "chrome_win": "start chrome",
3
+ "chrome_linux": "google-chrome"
4
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "version": 0.1,
3
+ "setting_list": [
4
+ {
5
+ "name": "plantuml",
6
+ "value": "plantuml -svg --charset UTF-8",
7
+ "type": "input",
8
+ "select": "",
9
+ "description": "PlantUMLコマンド"
10
+ },
11
+ {
12
+ "name": "formatter_path",
13
+ "value": "./del_comment.py",
14
+ "type": "input",
15
+ "select": "",
16
+ "description": "pylintのパス"
17
+ },
18
+ {
19
+ "name": "editor",
20
+ "value": "code",
21
+ "type": "input",
22
+ "select": "",
23
+ "description": "UMLを開くエディタ"
24
+ },
25
+ {
26
+ "name": "inherit_color",
27
+ "value": "green",
28
+ "type": "input",
29
+ "select": "",
30
+ "description": "継承の線の色"
31
+ },
32
+ {
33
+ "name": "composition_color",
34
+ "value": "blue",
35
+ "type": "input",
36
+ "select": "",
37
+ "description": "コンポジションの線の色"
38
+ },
39
+ {
40
+ "name": "exclude_path",
41
+ "value": "",
42
+ "type": "input",
43
+ "select": "",
44
+ "description": "除外するパス(正規表現)"
45
+ }
46
+ ]
47
+ }
data/lib/config.ru ADDED
@@ -0,0 +1,107 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "sinatra"
3
+ require "sinatra/contrib"
4
+ require "sinatra-websocket"
5
+ require "thin"
6
+ require "json"
7
+
8
+ require "./server"
9
+ require "./wsserver"
10
+
11
+ access_log = File.new("#{$home_dir}/logs/sinatra.log", "a+")
12
+ access_log.sync = true
13
+ use Rack::CommonLogger, access_log
14
+
15
+ get "/" do
16
+ File.read("html/index.html")
17
+ end
18
+
19
+ get "*.html" do |file|
20
+ content_type "text/html", :charset => "utf-8"
21
+ File.read "./html/#{file}.html"
22
+ end
23
+
24
+ get "/css/:name.css" do
25
+ content_type "text/css", :charset => "utf-8"
26
+ puts "css/#{params[:name]}.css"
27
+ File.read "css/#{params[:name]}.css"
28
+ end
29
+
30
+ get "/js/:name.js" do
31
+ content_type "text/javascript", :charset => "utf-8"
32
+ puts "js/#{params[:name]}.js"
33
+ File.read "js/#{params[:name]}.js"
34
+ end
35
+
36
+ get "/config/*.*" do |file, ext|
37
+ content_type "text/json", :charset => "utf-8"
38
+ puts "#{file}.#{ext}"
39
+ File.read "#{$home_dir}/config/#{file}.#{ext}"
40
+ end
41
+
42
+ post "/history/*.*" do |file, ext|
43
+ content_type "text/json", :charset => "utf-8"
44
+ puts "#{file}.#{ext}"
45
+ p = params[:param1]
46
+ begin
47
+ buf = File.read "#{$home_dir}/history/#{file}.#{ext}"
48
+ rescue
49
+ buf = ""
50
+ end
51
+ data = eval(buf)
52
+ if data != nil
53
+ if p != ""
54
+ JSON.generate data.find_all { |d| d =~ Regexp.new(p) }
55
+ else
56
+ JSON.generate data
57
+ end
58
+ end
59
+ end
60
+
61
+ get "/open_dialog" do
62
+ dialog_html = <<'EOS'
63
+ <!DOCTYPE html>
64
+ <html>
65
+ <head>
66
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
67
+ <title>Message Dialog</title>
68
+ <style type="text/css">
69
+ <!--
70
+ body {
71
+ color: #000000;
72
+ background-color: #ffffff;
73
+ overflow: hidden;
74
+ font-size: 12px;
75
+ }
76
+ -->
77
+ </style>
78
+ </head>
79
+ EOS
80
+ dialog_html += "<body>" + params["msg"] + "</body></html>"
81
+ end
82
+
83
+ map "/search" do
84
+ run Search
85
+ end
86
+
87
+ map "/wsserver" do
88
+ res = catch(:halt) do
89
+ run WsServer
90
+ end
91
+ puts res
92
+ end
93
+
94
+ configure do
95
+ set :DoNotReverseLookup, true
96
+ set :logging, true
97
+ set :default_encoding, "utf-8"
98
+ set :server, :thin
99
+
100
+ # Thread.start {
101
+ # }
102
+
103
+ end
104
+
105
+ #\ --port 43883
106
+
107
+ run Sinatra::Application