golf 0.4.12 → 0.4.13
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/Gemfile.lock +1 -2
- data/lib/golf/cli.rb +18 -3
- data/lib/golf/compiler.rb +39 -3
- data/lib/golf/version.rb +1 -1
- data/test/test_compiler.rb +1 -0
- metadata +13 -24
data/Gemfile.lock
CHANGED
data/lib/golf/cli.rb
CHANGED
@@ -49,10 +49,25 @@ module Golf
|
|
49
49
|
end
|
50
50
|
|
51
51
|
desc "compile [DESTINATION]", "Compile the app into a directory"
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
# move resources into destination from gem
|
53
|
+
# move golfapp/ over destination
|
54
|
+
# drop component.js into destination
|
55
55
|
|
56
|
+
def compile(dir)
|
57
|
+
if Golf::Compiler.valid?('.')
|
58
|
+
compiler = Golf::Compiler.new
|
59
|
+
gem_resources = File.expand_path("../../../resources", __FILE__)
|
60
|
+
directory(gem_resources, dir)
|
61
|
+
directory('golfapp/', dir)
|
62
|
+
create_file "#{dir}/components.js" do
|
63
|
+
compiler.generate_componentsjs
|
64
|
+
end
|
65
|
+
else
|
66
|
+
puts "golfapp/components not found"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
56
71
|
desc "version", "Output the version number"
|
57
72
|
def version
|
58
73
|
puts Golf::VERSION
|
data/lib/golf/compiler.rb
CHANGED
@@ -7,12 +7,16 @@ module Golf
|
|
7
7
|
def initialize(golfpath = ".")
|
8
8
|
@golfpath = "#{golfpath}/golfapp"
|
9
9
|
puts "golf #{Golf::VERSION}: starting compiler in #{@golfpath}..."
|
10
|
-
|
11
|
-
puts "golf #{Golf::VERSION}: is valid golfapp?: #{File.exists?(components)}"
|
10
|
+
puts "golf #{Golf::VERSION}: is valid golfapp?: #{Golf::Compiler.valid?(@golfpath)}"
|
12
11
|
end
|
13
12
|
|
13
|
+
def self.valid?(dir)
|
14
|
+
File.exists?("#{dir}/golfapp/components")
|
15
|
+
end
|
16
|
+
|
17
|
+
|
14
18
|
def generate_componentsjs
|
15
|
-
"jQuery.golf.components=#{component_json}
|
19
|
+
"jQuery.golf.components=#{component_json};;jQuery.golf.res=#{res_json};;jQuery.golf.plugins=#{plugin_json};;jQuery.golf.scripts=#{script_json};;jQuery.golf.styles=#{style_json};;jQuery.golf.setupComponents();"
|
16
20
|
end
|
17
21
|
|
18
22
|
def component_json
|
@@ -23,6 +27,38 @@ module Golf
|
|
23
27
|
JSON.dump(compile_res(@golfpath))
|
24
28
|
end
|
25
29
|
|
30
|
+
# compile_res: This function creates a hash representation of
|
31
|
+
# the file structure relative to <dir>. The values are either
|
32
|
+
# hashes (for directories) or strings (for files). The string
|
33
|
+
# values are the path to the file relative to @golfpath.
|
34
|
+
#
|
35
|
+
# Example: compile_res("#{@golfpath}/dir1")
|
36
|
+
#
|
37
|
+
# @golfpath/
|
38
|
+
# |--dir1/
|
39
|
+
# | |--file1
|
40
|
+
# | |--file2
|
41
|
+
# | +--dir2/
|
42
|
+
# | |--file3
|
43
|
+
# | |--file4
|
44
|
+
# | +--dir3/
|
45
|
+
# | |--file5
|
46
|
+
# | +--file6
|
47
|
+
# +--dir4/
|
48
|
+
#
|
49
|
+
# {
|
50
|
+
# file1 => "dir1/file1",
|
51
|
+
# file2 => "dir1/file2",
|
52
|
+
# dir2 => {
|
53
|
+
# file3 => "dir1/dir2/file3",
|
54
|
+
# file4 => "dir1/dir2/file4"
|
55
|
+
# dir3 => {
|
56
|
+
# file5 => "dir1/dir2/dir3/file5",
|
57
|
+
# file6 => "dir1/dir2/dir3/file6"
|
58
|
+
# }
|
59
|
+
# }
|
60
|
+
# }
|
61
|
+
#
|
26
62
|
def compile_res(dir)
|
27
63
|
results = {}
|
28
64
|
mypath = dir.split('').last == "/" ? dir : dir+"/"
|
data/lib/golf/version.rb
CHANGED
data/test/test_compiler.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 13
|
10
|
+
version: 0.4.13
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Micha Niskin, Alan Dipert, Julio Capote
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-13 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
@@ -38,6 +40,7 @@ dependencies:
|
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
41
44
|
segments:
|
42
45
|
- 0
|
43
46
|
version: "0"
|
@@ -51,6 +54,7 @@ dependencies:
|
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
54
58
|
segments:
|
55
59
|
- 0
|
56
60
|
version: "0"
|
@@ -196,6 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
200
|
requirements:
|
197
201
|
- - ">="
|
198
202
|
- !ruby/object:Gem::Version
|
203
|
+
hash: 3
|
199
204
|
segments:
|
200
205
|
- 0
|
201
206
|
version: "0"
|
@@ -204,32 +209,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
209
|
requirements:
|
205
210
|
- - ">="
|
206
211
|
- !ruby/object:Gem::Version
|
212
|
+
hash: 3
|
207
213
|
segments:
|
208
214
|
- 0
|
209
215
|
version: "0"
|
210
216
|
requirements: []
|
211
217
|
|
212
218
|
rubyforge_project: golf
|
213
|
-
rubygems_version: 1.
|
219
|
+
rubygems_version: 1.6.2
|
214
220
|
signing_key:
|
215
221
|
specification_version: 3
|
216
222
|
summary: Component based front end JS Framework
|
217
|
-
test_files:
|
218
|
-
|
219
|
-
- test/test_helper.rb
|
220
|
-
- test/test_rack.rb
|
221
|
-
- test/twitter_compiled/Gemfile
|
222
|
-
- test/twitter_compiled/config.ru
|
223
|
-
- test/twitter_compiled/golfapp/app_error.html
|
224
|
-
- test/twitter_compiled/golfapp/components.js
|
225
|
-
- test/twitter_compiled/golfapp/components/golf/twitter/Search/Search.html
|
226
|
-
- test/twitter_compiled/golfapp/components/golf/twitter/Tweet/Tweet.html
|
227
|
-
- test/twitter_compiled/golfapp/controller.js
|
228
|
-
- test/twitter_compiled/golfapp/index.html
|
229
|
-
- test/twitter_compiled/golfapp/jquery.address.js
|
230
|
-
- test/twitter_compiled/golfapp/jquery.golf.js
|
231
|
-
- test/twitter_compiled/golfapp/jquery.js
|
232
|
-
- test/twitter_compiled/golfapp/plugins/twitter.js
|
233
|
-
- test/twitter_compiled/golfapp/scripts/00-myscript.js
|
234
|
-
- test/twitter_compiled/golfapp/styles/main.css
|
235
|
-
- test/twitter_compiled/golfapp/welcome2golf.html
|
223
|
+
test_files: []
|
224
|
+
|