tonka 0.0.2 → 0.0.3
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.
- data/lib/tonka.rb +30 -21
- metadata +1 -1
data/lib/tonka.rb
CHANGED
@@ -2,7 +2,12 @@ class Tonka
|
|
2
2
|
|
3
3
|
attr_accessor :options, :site_name, :action, :messages
|
4
4
|
|
5
|
+
attr_reader :version
|
6
|
+
|
5
7
|
def initialize(options=[])
|
8
|
+
|
9
|
+
@version = "0.0.2b1";
|
10
|
+
|
6
11
|
@options = options || ARGV
|
7
12
|
if !@options[0].nil?
|
8
13
|
|
@@ -39,6 +44,10 @@ class Tonka
|
|
39
44
|
|
40
45
|
case @action
|
41
46
|
|
47
|
+
when "-v"
|
48
|
+
|
49
|
+
puts @version
|
50
|
+
|
42
51
|
when "build"
|
43
52
|
#handles the 'build' command
|
44
53
|
|
@@ -87,7 +96,7 @@ class Tonka::HTML
|
|
87
96
|
body = options[3] || ""
|
88
97
|
jquery = true if options[2] == "-jquery"
|
89
98
|
index_html = File.new("#{site_name}/index.html","w")
|
90
|
-
@layout = "<!DOCTYPE html>\n<html>\n<head>\n<title>#{site_name}</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheets/style.css\"
|
99
|
+
@layout = "<!DOCTYPE html>\n<html>\n<head>\n<title>#{site_name}</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheets/style.css\" />#{ "\n<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>" if jquery == true }\n<script type=\"text/javascript\" src=\"javascripts/scripts.js\"></script>\n</head>\n<body>\n#{ body+"\n" }\</body>\n</html>"
|
91
100
|
index_html.puts @layout
|
92
101
|
index_html.close
|
93
102
|
puts "\t\tbuilt ".green+"#{site_name}/index.html"
|
@@ -121,24 +130,24 @@ class Tonka::JS
|
|
121
130
|
end
|
122
131
|
|
123
132
|
class String
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
133
|
+
# text colorization
|
134
|
+
def colorize(color_code)
|
135
|
+
"\e[#{color_code}m#{self}\e[0m"
|
136
|
+
end
|
137
|
+
|
138
|
+
def red
|
139
|
+
colorize(31)
|
140
|
+
end
|
141
|
+
|
142
|
+
def green
|
143
|
+
colorize(32)
|
144
|
+
end
|
145
|
+
|
146
|
+
def yellow
|
147
|
+
colorize(33)
|
148
|
+
end
|
149
|
+
|
150
|
+
def pink
|
151
|
+
colorize(35)
|
152
|
+
end
|
144
153
|
end
|