ruby_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: 01a503898518f63f3cc9cab6fbb4177c118e2ff176a76e3da921f517f3636556
4
+ data.tar.gz: fdbc7f0f98f3bb33de052f3e319d3cfe7064a1aaaa84c2e069741ad2c2574580
5
+ SHA512:
6
+ metadata.gz: 31dbdaed7e24dd2361028eeea88d573632bfe348226017e87626f022b9b58d733a386d11534ca25b9233804150d85ba5b94ec296fea6b736220778740dd44907
7
+ data.tar.gz: 45d2b54b171ceb27444f7da01c612772fbd622d398953307198721a6521740ef4e689b6f8e40830932dc030370913c2dec3ad0b3e38709543f7475b7a6c5a5c9
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
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 ruby_uml_class.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,83 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby_uml_class (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.8.1)
10
+ public_suffix (>= 2.0.2, < 6.0)
11
+ browser_app_base (0.1.7)
12
+ facter
13
+ json
14
+ sinatra
15
+ sinatra-contrib
16
+ sinatra-websocket
17
+ thin
18
+ daemons (1.4.1)
19
+ diff-lcs (1.5.0)
20
+ em-websocket (0.3.8)
21
+ addressable (>= 2.1.1)
22
+ eventmachine (>= 0.12.9)
23
+ eventmachine (1.2.7)
24
+ facter (4.2.14)
25
+ hocon (~> 1.3)
26
+ thor (>= 1.0.1, < 2.0)
27
+ hocon (1.3.1)
28
+ json (2.6.3)
29
+ multi_json (1.15.0)
30
+ mustermann (3.0.0)
31
+ ruby2_keywords (~> 0.0.1)
32
+ public_suffix (5.0.1)
33
+ rack (2.2.5)
34
+ rack-protection (3.0.5)
35
+ rack
36
+ rake (13.0.6)
37
+ rspec (3.11.0)
38
+ rspec-core (~> 3.11.0)
39
+ rspec-expectations (~> 3.11.0)
40
+ rspec-mocks (~> 3.11.0)
41
+ rspec-core (3.11.0)
42
+ rspec-support (~> 3.11.0)
43
+ rspec-expectations (3.11.0)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.11.0)
46
+ rspec-mocks (3.11.1)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.11.0)
49
+ rspec-support (3.11.0)
50
+ ruby2_keywords (0.0.5)
51
+ sinatra (3.0.5)
52
+ mustermann (~> 3.0)
53
+ rack (~> 2.2, >= 2.2.4)
54
+ rack-protection (= 3.0.5)
55
+ tilt (~> 2.0)
56
+ sinatra-contrib (3.0.5)
57
+ multi_json
58
+ mustermann (~> 3.0)
59
+ rack-protection (= 3.0.5)
60
+ sinatra (= 3.0.5)
61
+ tilt (~> 2.0)
62
+ sinatra-websocket (0.3.1)
63
+ em-websocket (~> 0.3.6)
64
+ eventmachine
65
+ thin (>= 1.3.1, < 2.0.0)
66
+ thin (1.8.1)
67
+ daemons (~> 1.0, >= 1.0.9)
68
+ eventmachine (~> 1.0, >= 1.0.4)
69
+ rack (>= 1, < 3)
70
+ thor (1.2.1)
71
+ tilt (2.0.11)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ browser_app_base
78
+ rake (~> 13.0)
79
+ rspec (~> 3.0)
80
+ ruby_uml_class!
81
+
82
+ BUNDLED WITH
83
+ 2.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # RubyUmlClass
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruby_uml_class`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add ruby_uml_class
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install ruby_uml_class
16
+
17
+ ## Usage
18
+
19
+ $ start_ruby_uml_class.rb
20
+
21
+ https://user-images.githubusercontent.com/88954426/211500980-3bb839a9-8cf5-44da-b8f9-733a87f22c96.mp4
22
+
23
+ ## Development
24
+
25
+ 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).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kuwayama1971/RubyUmlClass.
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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
+ }
Binary file
data/lib/app_load.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'ruby_uml_class.rb'
2
+ $app = RubyUmlClass.new
@@ -0,0 +1,4 @@
1
+ {
2
+ "chrome_win": "start chrome",
3
+ "chrome_linux": "google-chrome"
4
+ }
@@ -0,0 +1,19 @@
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": "editor",
13
+ "value": "code",
14
+ "type": "input",
15
+ "select": "",
16
+ "description": "UMLを開くエディタ"
17
+ }
18
+ ]
19
+ }
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 35983
106
+
107
+ run Sinatra::Application