golf 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/golf.gemspec +1 -0
- data/lib/golf/rack.rb +3 -1
- data/lib/golf/version.rb +1 -1
- data/templates/new/config.ru +2 -5
- data/templates/twitter/Gemfile +6 -0
- data/templates/twitter/components/golf/twitter/Search/Search.html +29 -0
- data/templates/twitter/components/golf/twitter/Tweet/Tweet.html +16 -0
- data/templates/twitter/config.ru +7 -0
- data/templates/twitter/controller.js +9 -0
- data/templates/twitter/plugins/twitter.js +14 -0
- data/templates/twitter/scripts/00-myscript.js +0 -0
- data/templates/twitter/styles/main.css +0 -0
- data/test/test_rack.rb +17 -1
- metadata +93 -85
- /data/templates/{new → twitter}/404.txt +0 -0
data/golf.gemspec
CHANGED
data/lib/golf/rack.rb
CHANGED
@@ -10,6 +10,7 @@ module Golf
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call(env)
|
13
|
+
code = "200"
|
13
14
|
case env["PATH_INFO"]
|
14
15
|
when "/"
|
15
16
|
mime = MIME_TYPES[".html"]
|
@@ -23,9 +24,10 @@ module Golf
|
|
23
24
|
unless result
|
24
25
|
mime = 'text/plain'
|
25
26
|
result = 'not found'
|
27
|
+
code = "404"
|
26
28
|
end
|
27
29
|
end
|
28
|
-
return [
|
30
|
+
return [code, { 'Content-Type' => mime, 'Content-Length' => result.length.to_s}, [result]]
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
data/lib/golf/version.rb
CHANGED
data/templates/new/config.ru
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
<div>
|
2
|
+
<style type="text/golf">
|
3
|
+
</style>
|
4
|
+
|
5
|
+
<script type="text/golf">
|
6
|
+
function(query) {
|
7
|
+
var search = $.require("twitter").search;
|
8
|
+
|
9
|
+
search(query, function(i, tweet) {
|
10
|
+
$(".results").append(new Component.golf.twitter.Tweet(tweet));
|
11
|
+
$(".numresults").text(i+1);
|
12
|
+
});
|
13
|
+
|
14
|
+
$("form").submit(function() {
|
15
|
+
$.golf.location("/"+$("input[name='query']").val()+"/");
|
16
|
+
});
|
17
|
+
}
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<div class="content">
|
21
|
+
<h1>Twitter Search</h1>
|
22
|
+
<form>
|
23
|
+
<input type="text" name="query"/>
|
24
|
+
<input type="submit"/>
|
25
|
+
</form>
|
26
|
+
<p><span class="numresults">0</span> results:</p>
|
27
|
+
<ul class="results"/>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<li>
|
2
|
+
<style type="text/golf">
|
3
|
+
span.user {
|
4
|
+
color: green;
|
5
|
+
}
|
6
|
+
</style>
|
7
|
+
|
8
|
+
<script type="text/golf">
|
9
|
+
function(tweet) {
|
10
|
+
$(".user").text(tweet.from_user);
|
11
|
+
$(".text").text(tweet.text);
|
12
|
+
}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<span class="user">A user</span> says: <span class="text">Some things.</span>
|
16
|
+
</li>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
exports.search = function(query, callback) {
|
4
|
+
$.getJSON(
|
5
|
+
"http://search.twitter.com/search.json?q="+escape(query)+"&callback=?",
|
6
|
+
function(data) {
|
7
|
+
$.each(data.results, function(i, tweet) {
|
8
|
+
callback(i, tweet);
|
9
|
+
});
|
10
|
+
}
|
11
|
+
);
|
12
|
+
};
|
13
|
+
|
14
|
+
})();
|
File without changes
|
File without changes
|
data/test/test_rack.rb
CHANGED
@@ -9,18 +9,34 @@ class RackTest < Test::Unit::TestCase
|
|
9
9
|
|
10
10
|
def test_component_regeneration
|
11
11
|
get "/components.js"
|
12
|
+
assert_equal last_response.original_headers["Content-Type"], "application/javascript"
|
12
13
|
assert last_response.ok?
|
13
14
|
end
|
14
15
|
|
15
|
-
def
|
16
|
+
def test_js_serving
|
16
17
|
get "/jquery.js"
|
18
|
+
assert last_response.body.include?('John Resig')
|
19
|
+
assert_equal last_response.original_headers["Content-Type"], "application/javascript"
|
17
20
|
assert last_response.ok?
|
18
21
|
|
19
22
|
get "/jquery.golf.js"
|
23
|
+
assert last_response.body.include?('golf')
|
24
|
+
assert_equal last_response.original_headers["Content-Type"], "application/javascript"
|
20
25
|
assert last_response.ok?
|
21
26
|
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_root
|
22
30
|
get "/"
|
31
|
+
assert last_response.body.include?('html')
|
32
|
+
assert last_response.original_headers["Content-Type"] == "text/html"
|
23
33
|
assert last_response.ok?
|
24
34
|
end
|
25
35
|
|
36
|
+
def test_not_found
|
37
|
+
get "/asdasdasdsdsds"
|
38
|
+
assert last_response.body.include?('not found')
|
39
|
+
assert_equal last_response.status, 404
|
40
|
+
end
|
41
|
+
|
26
42
|
end
|
metadata
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
name: golf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
|
8
|
+
- Micha Niskin, Alan Dipert, Julio Capote
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
@@ -13,76 +13,95 @@ cert_chain: []
|
|
13
13
|
date: 2011-04-10 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: thor
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rack
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
38
49
|
description: Golf lets you write your interface in terms of reusable, simple components.
|
39
50
|
email:
|
40
|
-
|
51
|
+
- michaniskin@gmail.com
|
41
52
|
executables:
|
42
|
-
|
53
|
+
- golf
|
43
54
|
extensions: []
|
44
55
|
|
45
56
|
extra_rdoc_files: []
|
46
57
|
|
47
58
|
files:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- Gemfile.lock
|
62
|
+
- Rakefile
|
63
|
+
- bin/golf
|
64
|
+
- golf.gemspec
|
65
|
+
- lib/golf.rb
|
66
|
+
- lib/golf/cli.rb
|
67
|
+
- lib/golf/compiler.rb
|
68
|
+
- lib/golf/rack.rb
|
69
|
+
- lib/golf/version.rb
|
70
|
+
- resources/app_error.html
|
71
|
+
- resources/controller.js
|
72
|
+
- resources/index.html
|
73
|
+
- resources/jquery.address.js
|
74
|
+
- resources/jquery.golf.js
|
75
|
+
- resources/jquery.js
|
76
|
+
- resources/welcome2golf.html
|
77
|
+
- templates/new/Gemfile
|
78
|
+
- templates/new/components/HelloWorld/HelloWorld.html
|
79
|
+
- templates/new/config.ru
|
80
|
+
- templates/new/controller.js
|
81
|
+
- templates/new/plugins/mylib.js
|
82
|
+
- templates/new/scripts/00-myscript.js
|
83
|
+
- templates/new/styles/main.css
|
84
|
+
- templates/twitter/404.txt
|
85
|
+
- templates/twitter/Gemfile
|
86
|
+
- templates/twitter/components/golf/twitter/Search/Search.html
|
87
|
+
- templates/twitter/components/golf/twitter/Tweet/Tweet.html
|
88
|
+
- templates/twitter/config.ru
|
89
|
+
- templates/twitter/controller.js
|
90
|
+
- templates/twitter/plugins/twitter.js
|
91
|
+
- templates/twitter/scripts/00-myscript.js
|
92
|
+
- templates/twitter/styles/main.css
|
93
|
+
- test/data/app_error.html
|
94
|
+
- test/data/components.js
|
95
|
+
- test/data/components/HelloWorld/HelloWorld.html
|
96
|
+
- test/data/controller.js
|
97
|
+
- test/data/index.html
|
98
|
+
- test/data/jquery.address.js
|
99
|
+
- test/data/jquery.golf.js
|
100
|
+
- test/data/jquery.js
|
101
|
+
- test/data/welcome2golf.html
|
102
|
+
- test/test_compiler.rb
|
103
|
+
- test/test_helper.rb
|
104
|
+
- test/test_rack.rb
|
86
105
|
has_rdoc: true
|
87
106
|
homepage: http://golf.github.com
|
88
107
|
licenses: []
|
@@ -91,36 +110,25 @@ post_install_message:
|
|
91
110
|
rdoc_options: []
|
92
111
|
|
93
112
|
require_paths:
|
94
|
-
|
113
|
+
- lib
|
95
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
115
|
none: false
|
97
116
|
requirements:
|
98
|
-
|
99
|
-
|
100
|
-
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "0"
|
101
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
121
|
none: false
|
103
122
|
requirements:
|
104
|
-
|
105
|
-
|
106
|
-
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
107
126
|
requirements: []
|
108
127
|
|
109
128
|
rubyforge_project: golf
|
110
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.6.1
|
111
130
|
signing_key:
|
112
131
|
specification_version: 3
|
113
132
|
summary: Component based front end JS Framework
|
114
|
-
test_files:
|
115
|
-
|
116
|
-
- test/data/components.js
|
117
|
-
- test/data/components/HelloWorld/HelloWorld.html
|
118
|
-
- test/data/controller.js
|
119
|
-
- test/data/index.html
|
120
|
-
- test/data/jquery.address.js
|
121
|
-
- test/data/jquery.golf.js
|
122
|
-
- test/data/jquery.js
|
123
|
-
- test/data/welcome2golf.html
|
124
|
-
- test/test_compiler.rb
|
125
|
-
- test/test_helper.rb
|
126
|
-
- test/test_rack.rb
|
133
|
+
test_files: []
|
134
|
+
|
File without changes
|