mockup 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +20 -10
- data/build.version +1 -1
- data/lib/mockup/options.rb +8 -0
- data/lib/mockup/parse_options.rb +12 -23
- data/lib/mockup/project.rb +34 -4
- metadata +3 -3
data/README.textile
CHANGED
@@ -14,16 +14,26 @@ From the terminal do 'mockup help' to see:
|
|
14
14
|
|
15
15
|
Mockup Options:
|
16
16
|
|
17
|
-
create:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
create: The name of the mockup project.
|
18
|
+
e.g. mockup create project
|
19
|
+
|
20
|
+
-l: Specify a location to create your mockup project.
|
21
|
+
e.g. mockup create project -l /path/to/mockup
|
22
|
+
|
23
|
+
convert: Convert an existing Compass project to a mockup project.
|
24
|
+
e.g. mockup convert
|
25
|
+
|
26
|
+
with-jquery Install jQuery and jQuery UI
|
27
|
+
e.g. mockup create project with-jquery
|
28
|
+
|
29
|
+
with-mootools Install Mootools
|
30
|
+
e.g. mockup create project with-mootools
|
31
|
+
|
32
|
+
with-prototype Install Prototype and Scriptaculous
|
33
|
+
e.g. mockup create project with-prototype
|
34
|
+
|
35
|
+
help View the Help Screen
|
36
|
+
version View the current version of mockup
|
27
37
|
|
28
38
|
</code></pre>
|
29
39
|
|
data/build.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/mockup/options.rb
CHANGED
@@ -21,6 +21,14 @@ module Mockup
|
|
21
21
|
opts.boolean('with-jquery') do |jquery|
|
22
22
|
options.jquery = !!jquery
|
23
23
|
end
|
24
|
+
|
25
|
+
opts.boolean('with-mootools') do |mootools|
|
26
|
+
options.mootools = !!mootools
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.boolean('with-prototype') do |prototype|
|
30
|
+
options.prototype = !!prototype
|
31
|
+
end
|
24
32
|
|
25
33
|
opts.help('help', '-h') do
|
26
34
|
puts <<-HELP
|
data/lib/mockup/parse_options.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
+
# ParseOptions
|
2
|
+
#
|
3
|
+
# A bit more flexible than OptionParser from the ruby standard library.
|
4
|
+
#
|
1
5
|
class ParseOptions
|
2
|
-
def initialize(args, &block)
|
3
|
-
@args = args
|
4
|
-
instance_eval(&block) if block_given?
|
5
|
-
end
|
6
|
-
|
7
6
|
|
8
7
|
##
|
9
|
-
#
|
8
|
+
# Initialize
|
10
9
|
#
|
11
|
-
def
|
12
|
-
|
10
|
+
def initialize(args, &block)
|
11
|
+
@args = args
|
12
|
+
instance_eval(&block) if block_given?
|
13
13
|
end
|
14
14
|
|
15
15
|
|
@@ -17,8 +17,9 @@ class ParseOptions
|
|
17
17
|
# Help Menu
|
18
18
|
#
|
19
19
|
def help(value, value2='', &block)
|
20
|
-
puts yield(block) if display_message(value, value2)
|
20
|
+
puts yield(block) if display_message?(value, value2)
|
21
21
|
end
|
22
|
+
alias_method :version, :help
|
22
23
|
|
23
24
|
|
24
25
|
##
|
@@ -44,20 +45,8 @@ class ParseOptions
|
|
44
45
|
next if found
|
45
46
|
found = true if (v1.to_s == value.to_s || v2.to_s == value.to_s)
|
46
47
|
end
|
47
|
-
yield found
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
##
|
52
|
-
# Display Message
|
53
|
-
#
|
54
|
-
def display_message(value, value2)
|
55
|
-
found = false
|
56
|
-
@args.each do |arg|
|
57
|
-
next if found
|
58
|
-
found = true if (value.to_s == arg.to_s || value2.to_s == arg.to_s)
|
59
|
-
end
|
60
|
-
found
|
48
|
+
block_given? ? yield(found) : found
|
61
49
|
end
|
50
|
+
alias_method :display_message?, :boolean
|
62
51
|
|
63
52
|
end
|
data/lib/mockup/project.rb
CHANGED
@@ -16,7 +16,8 @@ module Mockup
|
|
16
16
|
FileUtils.mkdir_p(File.join(@location, 'public/stylesheets'))
|
17
17
|
File.open(File.join(@location, "compass.config"), 'w+') { |f| f.puts compass_config }
|
18
18
|
|
19
|
-
|
19
|
+
|
20
|
+
install_javascript(options)
|
20
21
|
end
|
21
22
|
|
22
23
|
|
@@ -53,7 +54,7 @@ module Mockup
|
|
53
54
|
FileUtils.mv(File.join(@location, 'src'), File.join(@location, 'sass'))
|
54
55
|
FileUtils.cp(File.join(@location, 'config.rb'), File.join(@location, 'compass.config'))
|
55
56
|
|
56
|
-
|
57
|
+
install_javascript(options)
|
57
58
|
end
|
58
59
|
|
59
60
|
|
@@ -171,11 +172,40 @@ pkg
|
|
171
172
|
IGNORE
|
172
173
|
end
|
173
174
|
|
175
|
+
def install_javascript(options)
|
176
|
+
install_jquery if options.jquery
|
177
|
+
install_mootools if options.mootools
|
178
|
+
install_prototype if options.prototype
|
179
|
+
end
|
180
|
+
|
174
181
|
|
175
182
|
def install_jquery
|
183
|
+
get_javascript_file('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js')
|
184
|
+
get_javascript_file('jquery_ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js')
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
def install_mootools
|
189
|
+
get_javascript_file('mootools', 'http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js')
|
190
|
+
end
|
191
|
+
|
192
|
+
|
193
|
+
def install_prototype
|
194
|
+
get_javascript_file('prototype', 'http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js')
|
195
|
+
get_javascript_file('scriptaculous', 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js')
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
def get_javascript_file(name, path)
|
201
|
+
create_javascript_dir
|
202
|
+
filename = File.join(@location, "public/javascripts/#{name}.js")
|
203
|
+
`curl -o #{filename} #{path}`
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
def create_javascript_dir
|
176
208
|
FileUtils.mkdir_p(File.join(@location, 'public/javascripts')) unless File.exists?(File.join(@location, 'javascripts'))
|
177
|
-
`curl -o #{File.join(@location, 'public/javascripts/jquery.js')} http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js`
|
178
|
-
`curl -o #{File.join(@location, 'public/javascripts/jquery_ui.js')} http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js`
|
179
209
|
FileUtils.touch(File.join(@location, 'public/javascripts/application.js'))
|
180
210
|
end
|
181
211
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mockup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robert R Evans
|