golf 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/lib/golf/compiler.rb +6 -6
  2. data/lib/golf/rack.rb +4 -4
  3. data/lib/golf/version.rb +1 -1
  4. data/test/test_compiler.rb +2 -2
  5. metadata +30 -32
  6. data/templates/twitter/404.txt +0 -1
  7. data/test/twitter_compiled/404.txt +0 -1
  8. /data/templates/new/{components → golfapp/components}/HelloWorld/HelloWorld.html +0 -0
  9. /data/templates/new/{controller.js → golfapp/controller.js} +0 -0
  10. /data/templates/new/{plugins → golfapp/plugins}/mylib.js +0 -0
  11. /data/templates/new/{scripts → golfapp/scripts}/00-myscript.js +0 -0
  12. /data/templates/new/{styles → golfapp/styles}/main.css +0 -0
  13. /data/templates/sinatra/{components → golfapp/components}/RandomNumber/RandomNumber.html +0 -0
  14. /data/templates/sinatra/{controller.js → golfapp/controller.js} +0 -0
  15. /data/templates/sinatra/{plugins → golfapp/plugins}/mylib.js +0 -0
  16. /data/templates/sinatra/{scripts → golfapp/scripts}/00-myscript.js +0 -0
  17. /data/templates/sinatra/{styles → golfapp/styles}/main.css +0 -0
  18. /data/templates/twitter/{components → golfapp/components}/golf/twitter/Search/Search.html +0 -0
  19. /data/templates/twitter/{components → golfapp/components}/golf/twitter/Tweet/Tweet.html +0 -0
  20. /data/templates/twitter/{controller.js → golfapp/controller.js} +0 -0
  21. /data/templates/twitter/{plugins → golfapp/plugins}/twitter.js +0 -0
  22. /data/templates/twitter/{scripts → golfapp/scripts}/00-myscript.js +0 -0
  23. /data/templates/twitter/{styles → golfapp/styles}/main.css +0 -0
  24. /data/test/twitter_compiled/{app_error.html → golfapp/app_error.html} +0 -0
  25. /data/test/twitter_compiled/{components → golfapp/components}/golf/twitter/Search/Search.html +0 -0
  26. /data/test/twitter_compiled/{components → golfapp/components}/golf/twitter/Tweet/Tweet.html +0 -0
  27. /data/test/twitter_compiled/{components.js → golfapp/components.js} +0 -0
  28. /data/test/twitter_compiled/{controller.js → golfapp/controller.js} +0 -0
  29. /data/test/twitter_compiled/{index.html → golfapp/index.html} +0 -0
  30. /data/test/twitter_compiled/{jquery.address.js → golfapp/jquery.address.js} +0 -0
  31. /data/test/twitter_compiled/{jquery.golf.js → golfapp/jquery.golf.js} +0 -0
  32. /data/test/twitter_compiled/{jquery.js → golfapp/jquery.js} +0 -0
  33. /data/test/twitter_compiled/{plugins → golfapp/plugins}/twitter.js +0 -0
  34. /data/test/twitter_compiled/{scripts → golfapp/scripts}/00-myscript.js +0 -0
  35. /data/test/twitter_compiled/{styles → golfapp/styles}/main.css +0 -0
  36. /data/test/twitter_compiled/{welcome2golf.html → golfapp/welcome2golf.html} +0 -0
data/lib/golf/compiler.rb CHANGED
@@ -3,7 +3,7 @@ module Golf
3
3
 
4
4
  def initialize(golfpath = ".")
5
5
  puts "starting up in #{golfpath}"
6
- @golfpath = golfpath
6
+ @golfpath = "#{golfpath}/golfapp"
7
7
  end
8
8
 
9
9
  def generate_componentsjs
@@ -51,12 +51,12 @@ module Golf
51
51
  end
52
52
 
53
53
  def package_name(path)
54
- path_arr = path.split('/')
55
- i = path_arr.index('components')
56
- name_segment = (path_arr.length - 1) - i
57
- path_arr.slice(i + 1, name_segment - 1).join('.')
54
+ if path.include?('golfapp/components')
55
+ path.match(/golfapp\/components\/(.*)/)
56
+ component_path = $1
57
+ component_path.split('/')[0...-1].join('.')
58
+ end
58
59
  end
59
60
 
60
-
61
61
  end
62
62
  end
data/lib/golf/rack.rb CHANGED
@@ -16,17 +16,17 @@ module Golf
16
16
  return [404, { 'Content-Type' => 'text/plain', 'Content-Length' => '9'}, ['not found']]
17
17
  end
18
18
 
19
- if File.exists?(env["PATH_INFO"].sub('/','')) and env["PATH_INFO"] != "/"
19
+ if File.exists?("golfapp/#{env["PATH_INFO"].sub('/','')}") and env["PATH_INFO"] != "/"
20
20
  mime = MIME_TYPES[".#{env["PATH_INFO"].split('.').last}"]
21
- result = File.read(env["PATH_INFO"].sub('/',''))
21
+ result = File.read("golfapp/#{env["PATH_INFO"].sub('/','')}")
22
22
  return [code, { 'Content-Type' => mime, 'Content-Length' => result.length.to_s}, [result]]
23
23
  end
24
24
 
25
25
  case env["PATH_INFO"]
26
26
  when "/"
27
27
  mime = MIME_TYPES[".html"]
28
- if File.exists?('index.html')
29
- result = File.read('index.html')
28
+ if File.exists?('golfapp/index.html')
29
+ result = File.read('golfapp/index.html')
30
30
  else
31
31
  result = @resources["/index.html"]
32
32
  end
data/lib/golf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Golf
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -9,13 +9,13 @@ class CompilerTest < Test::Unit::TestCase
9
9
 
10
10
  def test_componentsjs_generation
11
11
  componentjs = @compiler.generate_componentsjs
12
- known_good = File.read(File.expand_path("../twitter_compiled/components.js", __FILE__))
12
+ known_good = File.read(File.expand_path("../twitter_compiled/golfapp/components.js", __FILE__))
13
13
  assert_equal componentjs.gsub(' ','').gsub('\n','').gsub('\\',''), known_good.gsub(' ','').gsub('\n','').gsub('\\','')
14
14
  end
15
15
 
16
16
 
17
17
  def test_package_name_resolution
18
- result = @compiler.package_name '/asd/asdasd/components/golf/twitter/Tweet/Tweet.html'
18
+ result = @compiler.package_name '/asd/asdasd/golfapp/components/golf/twitter/Tweet/Tweet.html'
19
19
  assert_equal 'golf.twitter.Tweet', result
20
20
 
21
21
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: golf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Micha Niskin, Alan Dipert, Julio Capote
@@ -74,48 +74,46 @@ files:
74
74
  - resources/jquery.js
75
75
  - resources/welcome2golf.html
76
76
  - templates/new/Gemfile
77
- - templates/new/components/HelloWorld/HelloWorld.html
78
77
  - templates/new/config.ru
79
- - templates/new/controller.js
80
- - templates/new/plugins/mylib.js
81
- - templates/new/scripts/00-myscript.js
82
- - templates/new/styles/main.css
78
+ - templates/new/golfapp/components/HelloWorld/HelloWorld.html
79
+ - templates/new/golfapp/controller.js
80
+ - templates/new/golfapp/plugins/mylib.js
81
+ - templates/new/golfapp/scripts/00-myscript.js
82
+ - templates/new/golfapp/styles/main.css
83
83
  - templates/sinatra/Gemfile
84
- - templates/sinatra/components/RandomNumber/RandomNumber.html
85
84
  - templates/sinatra/config.ru
86
- - templates/sinatra/controller.js
87
85
  - templates/sinatra/demo.rb
88
- - templates/sinatra/plugins/mylib.js
89
- - templates/sinatra/scripts/00-myscript.js
90
- - templates/sinatra/styles/main.css
91
- - templates/twitter/404.txt
86
+ - templates/sinatra/golfapp/components/RandomNumber/RandomNumber.html
87
+ - templates/sinatra/golfapp/controller.js
88
+ - templates/sinatra/golfapp/plugins/mylib.js
89
+ - templates/sinatra/golfapp/scripts/00-myscript.js
90
+ - templates/sinatra/golfapp/styles/main.css
92
91
  - templates/twitter/Gemfile
93
- - templates/twitter/components/golf/twitter/Search/Search.html
94
- - templates/twitter/components/golf/twitter/Tweet/Tweet.html
95
92
  - templates/twitter/config.ru
96
- - templates/twitter/controller.js
97
- - templates/twitter/plugins/twitter.js
98
- - templates/twitter/scripts/00-myscript.js
99
- - templates/twitter/styles/main.css
93
+ - templates/twitter/golfapp/components/golf/twitter/Search/Search.html
94
+ - templates/twitter/golfapp/components/golf/twitter/Tweet/Tweet.html
95
+ - templates/twitter/golfapp/controller.js
96
+ - templates/twitter/golfapp/plugins/twitter.js
97
+ - templates/twitter/golfapp/scripts/00-myscript.js
98
+ - templates/twitter/golfapp/styles/main.css
100
99
  - test/test_compiler.rb
101
100
  - test/test_helper.rb
102
101
  - test/test_rack.rb
103
- - test/twitter_compiled/404.txt
104
102
  - test/twitter_compiled/Gemfile
105
- - test/twitter_compiled/app_error.html
106
- - test/twitter_compiled/components.js
107
- - test/twitter_compiled/components/golf/twitter/Search/Search.html
108
- - test/twitter_compiled/components/golf/twitter/Tweet/Tweet.html
109
103
  - test/twitter_compiled/config.ru
110
- - test/twitter_compiled/controller.js
111
- - test/twitter_compiled/index.html
112
- - test/twitter_compiled/jquery.address.js
113
- - test/twitter_compiled/jquery.golf.js
114
- - test/twitter_compiled/jquery.js
115
- - test/twitter_compiled/plugins/twitter.js
116
- - test/twitter_compiled/scripts/00-myscript.js
117
- - test/twitter_compiled/styles/main.css
118
- - test/twitter_compiled/welcome2golf.html
104
+ - test/twitter_compiled/golfapp/app_error.html
105
+ - test/twitter_compiled/golfapp/components.js
106
+ - test/twitter_compiled/golfapp/components/golf/twitter/Search/Search.html
107
+ - test/twitter_compiled/golfapp/components/golf/twitter/Tweet/Tweet.html
108
+ - test/twitter_compiled/golfapp/controller.js
109
+ - test/twitter_compiled/golfapp/index.html
110
+ - test/twitter_compiled/golfapp/jquery.address.js
111
+ - test/twitter_compiled/golfapp/jquery.golf.js
112
+ - test/twitter_compiled/golfapp/jquery.js
113
+ - test/twitter_compiled/golfapp/plugins/twitter.js
114
+ - test/twitter_compiled/golfapp/scripts/00-myscript.js
115
+ - test/twitter_compiled/golfapp/styles/main.css
116
+ - test/twitter_compiled/golfapp/welcome2golf.html
119
117
  has_rdoc: true
120
118
  homepage: http://golf.github.com
121
119
  licenses: []
@@ -1 +0,0 @@
1
- not found
@@ -1 +0,0 @@
1
- not found
File without changes