gluby-tk 0.1.5 → 0.1.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 +4 -4
- data/lib/gluby-tk/generator.rb +43 -5
- data/lib/gluby-tk/version.rb +1 -1
- data/templates/SpecBox.glade.template +28 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc0b9cefc4a89f8e30a991fa0f099da12f56a51
|
4
|
+
data.tar.gz: f021961d4812ce0fa39925db51119ea6ee2e1539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 625ab788cae865d64a6f8a14b4fe0988b50a9ad65ef78f7742823c1f7e3afb1e16a87be049f3b8ac8478f4c8e738f5bd12d51512a15e976911bc04e81f78316d
|
7
|
+
data.tar.gz: 1b92411ef8537a5220affdfd4032bfa83703d94764b580e15012d182c114d9016506c7116bee7ae85e2d30d64a31e12cc055ec6a5b9572ef421be60dd518a8f6
|
data/lib/gluby-tk/generator.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
+
require 'stringio'
|
1
2
|
require 'nokogiri'
|
2
3
|
|
3
4
|
module GlubyTK
|
4
5
|
|
5
6
|
class Generator
|
7
|
+
DIR_ASSETS = "assets"
|
8
|
+
DIR_ASSETS_IMAGES = "#{DIR_ASSETS}/images"
|
9
|
+
DIR_INTERFACE = "interface"
|
10
|
+
DIR_SRC = "src"
|
11
|
+
DIR_SRC_GLUBY = "#{DIR_SRC}/gluby"
|
12
|
+
|
6
13
|
DIRECTORIES = [
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
DIR_ASSETS,
|
15
|
+
DIR_ASSETS_IMAGES,
|
16
|
+
DIR_INTERFACE,
|
17
|
+
DIR_SRC,
|
18
|
+
DIR_SRC_GLUBY
|
12
19
|
]
|
13
20
|
|
14
21
|
TEMPLATES = [
|
@@ -18,6 +25,15 @@ module GlubyTK
|
|
18
25
|
{:name => "ApplicationWindow.glade", :path => "interface"}
|
19
26
|
]
|
20
27
|
|
28
|
+
SAMPLE_CODE_LINES = [
|
29
|
+
"# Start GlubyTK sample code",
|
30
|
+
"# Label Reference: https://ruby-gnome2.osdn.jp/hiki.cgi?pango-markup",
|
31
|
+
"welcome_label.margin = 100",
|
32
|
+
"welcome_label.use_markup = true",
|
33
|
+
"welcome_label.markup = '<span weight=\"heavy\" foreground=\"white\" size=\"x-large\"><b>Generated with GlubyTK</b></span>'",
|
34
|
+
"# End GlubyTK sample code"
|
35
|
+
]
|
36
|
+
|
21
37
|
def self.create app_name
|
22
38
|
if File.exist?(app_name)
|
23
39
|
GlubyTK.gputs "#{app_name} already exists!"
|
@@ -52,11 +68,33 @@ module GlubyTK
|
|
52
68
|
}
|
53
69
|
end
|
54
70
|
|
71
|
+
# Construct gresource file & ruby classes
|
55
72
|
rebuild(root)
|
73
|
+
|
74
|
+
# Add in example code
|
75
|
+
add_sample_code_to_new_project root
|
76
|
+
|
56
77
|
GlubyTK.gputs "Finished creating #{module_name}"
|
57
78
|
GlubyTK.gputs "Done!"
|
58
79
|
end
|
59
80
|
|
81
|
+
def self.add_sample_code_to_new_project(root)
|
82
|
+
app_window_path = "#{root}/#{DIR_SRC}/application_window.rb"
|
83
|
+
contents = StringIO.open(File.read(app_window_path))
|
84
|
+
new_contents = ""
|
85
|
+
contents.each do |line|
|
86
|
+
new_contents << line
|
87
|
+
if line.include?("super(args)")
|
88
|
+
tab = "\t\t"
|
89
|
+
nl = "\n"
|
90
|
+
SAMPLE_CODE_LINES.each do |scl|
|
91
|
+
new_contents << "#{tab}#{scl}#{nl}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
File.open(app_window_path, "wb").write new_contents
|
96
|
+
end
|
97
|
+
|
60
98
|
def self.rebuild(root = nil)
|
61
99
|
GlubyTK.gputs "Constructing gresource file..."
|
62
100
|
root = root || Dir.pwd
|
data/lib/gluby-tk/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Generated with glade 3.20.0 -->
|
3
|
+
<interface>
|
4
|
+
<requires lib="gtk+" version="3.20"/>
|
5
|
+
<template class="SpecBox" parent="GtkBox">
|
6
|
+
<property name="visible">True</property>
|
7
|
+
<property name="can_focus">False</property>
|
8
|
+
<property name="orientation">vertical</property>
|
9
|
+
<child>
|
10
|
+
<object class="GtkLabel" id="label">
|
11
|
+
<property name="visible">True</property>
|
12
|
+
<property name="can_focus">False</property>
|
13
|
+
<property name="label" translatable="yes">label</property>
|
14
|
+
</object>
|
15
|
+
<packing>
|
16
|
+
<property name="expand">False</property>
|
17
|
+
<property name="fill">True</property>
|
18
|
+
<property name="position">0</property>
|
19
|
+
</packing>
|
20
|
+
</child>
|
21
|
+
<child>
|
22
|
+
<placeholder/>
|
23
|
+
</child>
|
24
|
+
<child>
|
25
|
+
<placeholder/>
|
26
|
+
</child>
|
27
|
+
</template>
|
28
|
+
</interface>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gluby-tk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- i2097i
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/gluby-tk/logger.rb
|
125
125
|
- lib/gluby-tk/version.rb
|
126
126
|
- templates/ApplicationWindow.glade.template
|
127
|
+
- templates/SpecBox.glade.template
|
127
128
|
- templates/application.rb.template
|
128
129
|
- templates/includes.rb.template
|
129
130
|
- templates/main.rb.template
|