golf 0.2.4 → 0.2.5

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/lib/golf/cli.rb CHANGED
@@ -11,7 +11,7 @@ module Golf
11
11
  File.expand_path("../../../", __FILE__)
12
12
  end
13
13
 
14
- desc "new [NAME] (optional)[TEMPLATE]", "Creates new golf app, takes NAME and optionally TEMPLATE"
14
+ desc "new [NAME] (optional)[TEMPLATE]", "Creates new, rack-based golf app, takes NAME and optionally TEMPLATE [twitter, sinatra]"
15
15
  def new(name, template = false)
16
16
  unless template
17
17
  directory("templates/new", name)
@@ -20,6 +20,12 @@ module Golf
20
20
  end
21
21
  end
22
22
 
23
+ desc "raw", "Dumps a raw hello world golfapp into current dir"
24
+ def raw
25
+ directory("templates/raw", "golfapp")
26
+ end
27
+
28
+
23
29
  desc "server", "Run the golf app"
24
30
  def server
25
31
  `rackup`
data/lib/golf/rack.rb CHANGED
@@ -12,16 +12,14 @@ module Golf
12
12
  def call(env)
13
13
  code = "200"
14
14
 
15
- if ['Gemfile','config.ru', 'Gemfile.lock'].include?(env["PATH_INFO"])
16
- return [404, { 'Content-Type' => 'text/plain', 'Content-Length' => '9'}, ['not found']]
17
- end
18
-
15
+ #pass through for overrides
19
16
  if File.exists?("golfapp/#{env["PATH_INFO"].sub('/','')}") and env["PATH_INFO"] != "/"
20
17
  mime = MIME_TYPES[".#{env["PATH_INFO"].split('.').last}"]
21
18
  result = File.read("golfapp/#{env["PATH_INFO"].sub('/','')}")
22
19
  return [code, { 'Content-Type' => mime, 'Content-Length' => result.length.to_s}, [result]]
23
20
  end
24
21
 
22
+ #regular handling from gem resources/dynamic compilation
25
23
  case env["PATH_INFO"]
26
24
  when "/"
27
25
  mime = MIME_TYPES[".html"]
data/lib/golf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Golf
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -0,0 +1,13 @@
1
+ <div>
2
+ <style type="text/golf">
3
+ div.container {
4
+ border: 1px solid red;
5
+ }
6
+ </style>
7
+ <script type="text/golf">
8
+ function() {
9
+ $(".container").append("<h1>Hello, world!</h1>");
10
+ }
11
+ </script>
12
+ <div class="container"></div>
13
+ </div>
@@ -0,0 +1,7 @@
1
+ $.golf.controller = [
2
+ { route: ".*",
3
+ action: function(container, params) {
4
+ container.empty().append(new Component.HelloWorld());
5
+ }
6
+ }
7
+ ];
File without changes
File without changes
File without changes
@@ -7,8 +7,8 @@
7
7
 
8
8
  <script type="text/golf">
9
9
  function(tweet) {
10
- $(".user").text(tweet.from_user);
11
- $(".text").text(tweet.text);
10
+ $(".user").html("<span>"+tweet.from_user+"</span>");
11
+ $(".text").html("<span>"+tweet.text+"</span>");
12
12
  }
13
13
  </script>
14
14
 
@@ -3,7 +3,7 @@ $.golf.defaultRoute = "/golf/";
3
3
  $.golf.controller = [
4
4
  { route: "/(.*)/",
5
5
  action: function(container, params) {
6
- container.append(new Component.golf.twitter.Search(unescape(params[1])));
6
+ container.append(new Component.golf.twitter.Search(params[1]));
7
7
  }
8
8
  }
9
9
  ];
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: golf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.4
5
+ version: 0.2.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Micha Niskin, Alan Dipert, Julio Capote
@@ -80,6 +80,11 @@ files:
80
80
  - templates/new/golfapp/plugins/mylib.js
81
81
  - templates/new/golfapp/scripts/00-myscript.js
82
82
  - templates/new/golfapp/styles/main.css
83
+ - templates/raw/golfapp/components/HelloWorld/HelloWorld.html
84
+ - templates/raw/golfapp/controller.js
85
+ - templates/raw/golfapp/plugins/mylib.js
86
+ - templates/raw/golfapp/scripts/00-myscript.js
87
+ - templates/raw/golfapp/styles/main.css
83
88
  - templates/sinatra/Gemfile
84
89
  - templates/sinatra/config.ru
85
90
  - templates/sinatra/demo.rb