tonka 0.0.0 → 0.0.1

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.
Files changed (2) hide show
  1. data/lib/tonka.rb +40 -8
  2. metadata +1 -1
data/lib/tonka.rb CHANGED
@@ -1,7 +1,6 @@
1
- # make index page.
2
1
  class Tonka
3
2
 
4
- attr_accessor :options, :site_name, :action
3
+ attr_accessor :options, :site_name, :action, :messages
5
4
 
6
5
  def initialize(options=[])
7
6
  @options = options || ARGV
@@ -18,9 +17,10 @@ class Tonka
18
17
  if !Dir.exist? site_name
19
18
  Dir.mkdir site_name
20
19
  Dir.mkdir "#{site_name}/stylesheets"
21
- Dir.mkdir "#{site_name}/javascripts"
20
+ puts "\t\tbuilt ".green+"#{site_name}/stylesheets/"
22
21
 
23
- puts "#{site_name} was successfully created!"
22
+ Dir.mkdir "#{site_name}/javascripts"
23
+ puts "\t\tbuilt ".green+"#{site_name}/javascripts/"
24
24
  else
25
25
  puts "a '#{site_name}' directory already exists!"
26
26
  display_usage
@@ -50,15 +50,21 @@ class Tonka
50
50
  make_directories(@site_name)
51
51
  make_files(@site_name)
52
52
 
53
+ puts "\n\t\tthe construction of "+"#{@site_name}".green+" is now complete!"
54
+
53
55
  when "destroy"
54
- #handles the 'build' command
56
+ #handles the 'destroy' command
55
57
 
56
58
  @site_name = @options[1] || 'sites'
57
-
58
- system("rm -rf #{@site_name}")
59
+ if Dir.exist? @site_name
60
+ system("rm -rf #{@site_name}")
61
+ puts "\t\tdemolished ".red+"#{@site_name}"
62
+ else
63
+ "Oops! There is no directory called #{@site_name}!"
64
+ end
59
65
 
60
66
  when "add"
61
- #handles the 'build' command
67
+ #handles the 'add' command
62
68
 
63
69
  else
64
70
  puts "Oops! I don't know that one."
@@ -84,6 +90,7 @@ class Tonka::HTML
84
90
  @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/javascripts\" src=\"/javascripts/scripts.js\"></script>#{ "\n<script type=\"text/javascripts\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>" if jquery == true }\n</head>\n<body>\n#{ body+"\n" }\</body>\n</html>"
85
91
  index_html.puts @layout
86
92
  index_html.close
93
+ puts "\t\tbuilt ".green+"#{site_name}/index.html"
87
94
  end
88
95
  end
89
96
 
@@ -96,6 +103,7 @@ class Tonka::CSS
96
103
  style_css_content = "/* html5doctor.com Reset v1.6.1 - http://cssreset.com */\nhtml,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}nav ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}input,select{vertical-align:middle}"
97
104
  style_css.puts style_css_content
98
105
  style_css.close
106
+ puts "\t\tbuilt ".green+"#{site_name}/stylesheets/style.css"
99
107
  end
100
108
  end
101
109
 
@@ -108,5 +116,29 @@ class Tonka::JS
108
116
  scripts_js_content = "console.log('feed me javascripts')"
109
117
  scripts_js.puts scripts_js_content
110
118
  scripts_js.close
119
+ puts "\t\tbuilt ".green+"#{site_name}/javascripts/scripts.js"
111
120
  end
121
+ end
122
+
123
+ class String
124
+ # text colorization
125
+ def colorize(color_code)
126
+ "\e[#{color_code}m#{self}\e[0m"
127
+ end
128
+
129
+ def red
130
+ colorize(31)
131
+ end
132
+
133
+ def green
134
+ colorize(32)
135
+ end
136
+
137
+ def yellow
138
+ colorize(33)
139
+ end
140
+
141
+ def pink
142
+ colorize(35)
143
+ end
112
144
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tonka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: