gluby-tk 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gluby-tk.rb +1 -0
- data/lib/gluby-tk/file_operator.rb +38 -0
- data/lib/gluby-tk/generator.rb +5 -19
- data/lib/gluby-tk/tweeter.rb +1 -1
- data/lib/gluby-tk/version.rb +2 -1
- 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: 04a9d5feb2582bd6a2ad93c493264a379db2c62b
|
4
|
+
data.tar.gz: ec51208086f8b60c5329947e013413d0b4bbb915
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4885d5302d4f4995c466d296c5a02c9593e4fbad0ced1bcc6e521217533d9d2f931915206c9779e141f432e7034ac8d56d880f4659fa5e77fe16eec929a272e0
|
7
|
+
data.tar.gz: 655f3ecefd9bfddb8b32b2f103afaf16da392cc4a256935bc560659e0282ccebff71191fe2599c1838af1c97460e1535f8178b811fd6f15958bc2a188d59a3a5
|
data/lib/gluby-tk.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
module GlubyTK
|
2
|
+
class FileOperator
|
3
|
+
def self.add_lines_to_file(path, lines = [], after_line_match = nil)
|
4
|
+
unless after_line_match.nil?
|
5
|
+
new_contents = ""
|
6
|
+
get_io_contents(path).each do |line|
|
7
|
+
new_contents << line
|
8
|
+
if line.include?(after_line_match)
|
9
|
+
lines.each do |l|
|
10
|
+
new_contents << l
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
write_file path, new_contents
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.file_contains_line?(path, line_match)
|
19
|
+
get_io_contents(path).each do |line|
|
20
|
+
return true if line.include?(line_match)
|
21
|
+
end
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.get_io_contents(path)
|
28
|
+
if File.exist?(path)
|
29
|
+
return StringIO.open(File.read(path))
|
30
|
+
end
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.write_file(path, contents)
|
35
|
+
File.open(path, "wb").write contents
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/gluby-tk/generator.rb
CHANGED
@@ -72,34 +72,20 @@ module GlubyTK
|
|
72
72
|
rebuild(root)
|
73
73
|
|
74
74
|
# Add in example code
|
75
|
-
|
75
|
+
GlubyTK::FileOperator.add_lines_to_file("#{root}/#{DIR_SRC}/application_window.rb", SAMPLE_CODE_LINES.map{|scl| "\t\t#{scl}\n"}, "super(args")
|
76
76
|
|
77
77
|
GlubyTK.gputs "Finished creating #{module_name}"
|
78
78
|
GlubyTK.gputs "Done!"
|
79
79
|
end
|
80
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
|
-
|
98
81
|
def self.rebuild(root = nil)
|
99
82
|
GlubyTK.gputs "Constructing gresource file..."
|
100
83
|
root = root || Dir.pwd
|
101
84
|
|
102
85
|
interface_files = Dir["#{root}/interface/*.glade"]
|
86
|
+
|
87
|
+
gluby_class_matcher = "#{root}/src/gluby/gluby_*.rb"
|
88
|
+
system("rm #{gluby_class_matcher}") if Dir[gluby_class_matcher].any?
|
103
89
|
|
104
90
|
gresource_file_contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
105
91
|
gresource_file_contents += "<gresources>\n"
|
@@ -174,7 +160,7 @@ module GlubyTK
|
|
174
160
|
}
|
175
161
|
end
|
176
162
|
|
177
|
-
File.open("#{gluby_file_dir}/gluby_includes.rb", "
|
163
|
+
File.open("#{gluby_file_dir}/gluby_includes.rb", "w+") { |file|
|
178
164
|
contents = file.read
|
179
165
|
g_req = "require 'gluby_#{base_file_name}'"
|
180
166
|
req = "require '#{base_file_name}'"
|
data/lib/gluby-tk/tweeter.rb
CHANGED
@@ -15,7 +15,7 @@ module GlubyTK
|
|
15
15
|
config.access_token = ENV["ACCESS_TOKEN"]
|
16
16
|
config.access_token_secret = ENV["ACCESS_SECRET"]
|
17
17
|
end
|
18
|
-
client.update("
|
18
|
+
client.update("#{GlubyTK::VERSION} changes: #{GlubyTK::RELEASE_NOTES}")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/gluby-tk/version.rb
CHANGED
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.9
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- bin/gluby
|
134
134
|
- lib/core_ext/string.rb
|
135
135
|
- lib/gluby-tk.rb
|
136
|
+
- lib/gluby-tk/file_operator.rb
|
136
137
|
- lib/gluby-tk/generator.rb
|
137
138
|
- lib/gluby-tk/listener.rb
|
138
139
|
- lib/gluby-tk/logger.rb
|