scalerui 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/scalerui +6 -0
- data/lib/scalerui.rb +239 -0
- data/scalerui.gemspec +59 -0
- data/src/scalerui-0.1.1.tar.gz +0 -0
- metadata +7 -4
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/tolatomeow/scalerui"
|
12
12
|
gem.authors = ["Simon Chiu"]
|
13
13
|
gem.add_development_dependency "shoulda", ">= 0"
|
14
|
+
gem.files.include %w( src/* )
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/scalerui
ADDED
data/lib/scalerui.rb
CHANGED
@@ -0,0 +1,239 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'shell'
|
6
|
+
require 'tmpdir'
|
7
|
+
|
8
|
+
class Scalerui
|
9
|
+
def initialize(args)
|
10
|
+
|
11
|
+
@args = args
|
12
|
+
|
13
|
+
# Default Options
|
14
|
+
@options = {
|
15
|
+
:install => false,
|
16
|
+
:upgrade => false,
|
17
|
+
:version => "latest",
|
18
|
+
:assets => nil
|
19
|
+
}
|
20
|
+
|
21
|
+
# Option Parser
|
22
|
+
optparse = OptionParser.new do |opts|
|
23
|
+
opts.banner = <<-EOF
|
24
|
+
|
25
|
+
Scaler UI Framework
|
26
|
+
(c) Copyright 2009 Simon Chiu, Scaler Apps http://ui.scalerapps.com
|
27
|
+
---------------------------------------------------------------------------------------------------------
|
28
|
+
|
29
|
+
Usage: scalerui [options] [framework directory]
|
30
|
+
|
31
|
+
Description:
|
32
|
+
Enables you to easily install, remove, or upgrade Scaler UI for Rails
|
33
|
+
|
34
|
+
Options:
|
35
|
+
|
36
|
+
EOF
|
37
|
+
|
38
|
+
opts.on_tail('--help', "Displays this screen") do
|
39
|
+
puts opts
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on('--install', "Installs the UI") do
|
44
|
+
@options[:install] = true
|
45
|
+
end
|
46
|
+
|
47
|
+
opts.on('--remove', "Removes the UI") do
|
48
|
+
@options[:install] = false
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.on('--version n', "Installs a specific UI version") do |version|
|
52
|
+
@options[:version] = version
|
53
|
+
end
|
54
|
+
|
55
|
+
opts.on('--dir INSTALL-DIRECTORY', "Rails directoryw here you want to install UI") do |dir|
|
56
|
+
@options[:install_dir] = dir
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on('--assets ASSETS-LOCATION', "URL of where your assets are hosted, eg. CDN") do |url|
|
60
|
+
@options[:assets] = url
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.parse!(@args)
|
64
|
+
|
65
|
+
# Sets some instance variables
|
66
|
+
@install = @options[:install]
|
67
|
+
@install_dir = @options[:install_dir]
|
68
|
+
@assets_dir = @options[:assets] || File.join(@install_dir, "public")
|
69
|
+
@scalerui_dir = File.join(@assets_dir, "scalerui")
|
70
|
+
@images_dir = File.join(@scalerui_dir, "images")
|
71
|
+
@js_dir = File.join(@scalerui_dir, "javascript")
|
72
|
+
@css_dir = File.join(@scalerui_dir, "css")
|
73
|
+
@src_dir = File.join(File.dirname(__FILE__) + "/../src")
|
74
|
+
|
75
|
+
process
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
protected
|
81
|
+
|
82
|
+
def process
|
83
|
+
raise NoTargetDirectoryError if @install_dir.nil?
|
84
|
+
|
85
|
+
if @install
|
86
|
+
# -- Begin of Installation
|
87
|
+
|
88
|
+
# Creates the appropriate directory for the framework files ------------------------------
|
89
|
+
begin
|
90
|
+
# Checks to see whether an existing scalerui is installed
|
91
|
+
if File.exist?(@scalerui_dir)
|
92
|
+
print "Existing Scaler UI detected. Installer will delete all files in existing Scaler UI directory. Do you want to continue? (y/n): "
|
93
|
+
response = gets.chomp
|
94
|
+
if response == 'n'
|
95
|
+
puts "Aborted"
|
96
|
+
return
|
97
|
+
else
|
98
|
+
cleanup
|
99
|
+
end
|
100
|
+
end
|
101
|
+
print "Creating directory structure: #{@scalerui_dir}..."
|
102
|
+
FileUtils.mkdir_p @scalerui_dir
|
103
|
+
FileUtils.mkdir_p @images_dir
|
104
|
+
FileUtils.mkdir_p @js_dir
|
105
|
+
FileUtils.mkdir_p @css_dir
|
106
|
+
puts "done"
|
107
|
+
rescue Exception => e
|
108
|
+
puts "An error has occurred while creating the directories"
|
109
|
+
cleanup
|
110
|
+
return
|
111
|
+
end
|
112
|
+
|
113
|
+
# Copies the files ------------------------------------------------------------------------
|
114
|
+
begin
|
115
|
+
all_source_files = Dir[File.join(@src_dir, "/*")]
|
116
|
+
version = @options[:version]
|
117
|
+
case version
|
118
|
+
when "latest"
|
119
|
+
@file_source = all_source_files.sort.last
|
120
|
+
else
|
121
|
+
@file_source = File.join(@src_dir, "/scalerui-#{version}.tar.gz")
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if file exists
|
125
|
+
raise NoSourceFileError unless File.exist?(@file_source)
|
126
|
+
|
127
|
+
# Untar and copies files over
|
128
|
+
copy_files
|
129
|
+
|
130
|
+
rescue NoSourceFileError => e
|
131
|
+
puts "Source file is missing. Please install the gem again."
|
132
|
+
cleanup
|
133
|
+
return
|
134
|
+
end
|
135
|
+
|
136
|
+
puts "Scaler UI Framework has been installed into this Rails app: #{@install_dir}"
|
137
|
+
puts ""
|
138
|
+
puts "Put the following lines into your template headers: "
|
139
|
+
puts '
|
140
|
+
<link href="/scalerui/css/reset.css" rel="stylesheet" type="text/css">
|
141
|
+
<link href="/scalerui/css/base.css" rel="stylesheet" type="text/css">
|
142
|
+
<link href="/scalerui/css/layout.css" rel="stylesheet" type="text/css">
|
143
|
+
<link href="/scalerui/css/components.css" rel="stylesheet" type="text/css">
|
144
|
+
|
145
|
+
<script src="http://www.google.com/jsapi"></script>
|
146
|
+
<script type="text/javascript">
|
147
|
+
// Load jQuery
|
148
|
+
google.load("jquery", "1.3.2");
|
149
|
+
google.load("jqueryui", "1.7.2");
|
150
|
+
</script>
|
151
|
+
<script type="text/javascript" src="javascript/scalerapps/ui-0.1.js"></script>
|
152
|
+
<!--[if IE 6]>
|
153
|
+
<link href="css/ie6.css" rel="stylesheet" type="text/css">
|
154
|
+
|
155
|
+
<script type="text/javascript" src="javascript/ie6/DD_belatedPNG_0.0.8a.js"></script>
|
156
|
+
<script type="text/javascript">
|
157
|
+
DD_belatedPNG.fix("span.icon, span.big-icon, img");
|
158
|
+
</script>
|
159
|
+
<![endif]-->
|
160
|
+
|
161
|
+
<!--[if IE]>
|
162
|
+
<link href="css/ie.css" rel="stylesheet" type="text/css">
|
163
|
+
<![endif]-->
|
164
|
+
'
|
165
|
+
|
166
|
+
# -- End of Installation
|
167
|
+
else
|
168
|
+
# -- Begin of Removal
|
169
|
+
cleanup
|
170
|
+
# -- End of Removal
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
def copy_files
|
176
|
+
decompress_source
|
177
|
+
copy_css
|
178
|
+
copy_images
|
179
|
+
copy_js
|
180
|
+
clean_source
|
181
|
+
end
|
182
|
+
|
183
|
+
def decompress_source
|
184
|
+
@tmpdir = Dir.mktmpdir
|
185
|
+
Shell.def_system_command "decompress", "tar xzf #{@file_source} -C #{@tmpdir}"
|
186
|
+
sh = Shell.new
|
187
|
+
|
188
|
+
print "Decompressing framework source files..."
|
189
|
+
sh.transact do
|
190
|
+
decompress
|
191
|
+
end
|
192
|
+
puts "done"
|
193
|
+
end
|
194
|
+
|
195
|
+
def clean_source
|
196
|
+
FileUtils.remove_dir(@tmpdir, true)
|
197
|
+
end
|
198
|
+
|
199
|
+
def copy_css
|
200
|
+
print "Copying CSS files..."
|
201
|
+
css_dir = File.join(@tmpdir, "css")
|
202
|
+
Dir.chdir(css_dir)
|
203
|
+
FileUtils.mv Dir.glob("*"), @css_dir
|
204
|
+
puts "done"
|
205
|
+
end
|
206
|
+
|
207
|
+
def copy_images
|
208
|
+
print "Copying images"
|
209
|
+
images_dir = File.join(@tmpdir, "images")
|
210
|
+
Dir.chdir(images_dir)
|
211
|
+
FileUtils.mv Dir.glob("*"), @images_dir
|
212
|
+
puts "done"
|
213
|
+
end
|
214
|
+
|
215
|
+
def copy_js
|
216
|
+
print "Copying Javascript files..."
|
217
|
+
js_dir = File.join(@tmpdir, "javascript")
|
218
|
+
Dir.chdir(js_dir)
|
219
|
+
FileUtils.mv Dir.glob("*"), @js_dir
|
220
|
+
puts "done"
|
221
|
+
end
|
222
|
+
|
223
|
+
# Cleans up after messy installations, uninstallation, etc...
|
224
|
+
def cleanup
|
225
|
+
if File.exist?(@scalerui_dir)
|
226
|
+
print "Cleaning up directories..."
|
227
|
+
FileUtils.rm_r(@scalerui_dir)
|
228
|
+
puts "done"
|
229
|
+
else
|
230
|
+
puts "Nothing to clean up!"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
# Error Classes
|
237
|
+
class ScaleruiError < StandardError; end;
|
238
|
+
class NoTargetDirectoryError < ScaleruiError; end;
|
239
|
+
class NoSourceFileError < ScaleruiError; end;
|
data/scalerui.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{scalerui}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Simon Chiu"]
|
12
|
+
s.date = %q{2009-11-05}
|
13
|
+
s.default_executable = %q{scalerui}
|
14
|
+
s.description = %q{ A basic UI layout and object oriented CSS components we use for rapid development. Basically, this saves us time from having to rehash everything over, and over, and over... }
|
15
|
+
s.email = %q{dev@scalerapps.com}
|
16
|
+
s.executables = ["scalerui"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/scalerui",
|
29
|
+
"lib/scalerui.rb",
|
30
|
+
"scalerui.gemspec",
|
31
|
+
"src/scalerui-0.1.1.tar.gz",
|
32
|
+
"src/scalerui-0.1.1.tar.gz",
|
33
|
+
"test/helper.rb",
|
34
|
+
"test/test_scalerui.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/tolatomeow/scalerui}
|
37
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.3.5}
|
40
|
+
s.summary = %q{Our internal UI framework for rapid wireframing and web development}
|
41
|
+
s.test_files = [
|
42
|
+
"test/helper.rb",
|
43
|
+
"test/test_scalerui.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalerui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiu
|
@@ -10,7 +10,7 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
|
12
12
|
date: 2009-11-05 00:00:00 -05:00
|
13
|
-
default_executable:
|
13
|
+
default_executable: scalerui
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: shoulda
|
@@ -24,8 +24,8 @@ dependencies:
|
|
24
24
|
version:
|
25
25
|
description: " A basic UI layout and object oriented CSS components we use for rapid development. Basically, this saves us time from having to rehash everything over, and over, and over... "
|
26
26
|
email: dev@scalerapps.com
|
27
|
-
executables:
|
28
|
-
|
27
|
+
executables:
|
28
|
+
- scalerui
|
29
29
|
extensions: []
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
@@ -38,7 +38,10 @@ files:
|
|
38
38
|
- README.rdoc
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
|
+
- bin/scalerui
|
41
42
|
- lib/scalerui.rb
|
43
|
+
- scalerui.gemspec
|
44
|
+
- src/scalerui-0.1.1.tar.gz
|
42
45
|
- test/helper.rb
|
43
46
|
- test/test_scalerui.rb
|
44
47
|
has_rdoc: true
|