golf 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -9,4 +9,5 @@ dist/*
9
9
  docs/api/*
10
10
  docs/api
11
11
  *.gem
12
- *.lock
12
+ coverage
13
+ coverage/*
data/Gemfile CHANGED
@@ -3,4 +3,5 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in golf.gemspec
4
4
  gemspec
5
5
 
6
- gem "rack-test", :require => "rack/test"
6
+ gem "rack-test", :require => "rack/test"
7
+ gem "simplecov"
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ golf (0.3.9)
5
+ json
6
+ rack
7
+ thor
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ json (1.5.1)
13
+ json (1.5.1-java)
14
+ rack (1.2.2)
15
+ rack-test (0.5.7)
16
+ rack (>= 1.0)
17
+ simplecov (0.4.1)
18
+ simplecov-html (~> 0.4.3)
19
+ simplecov-html (0.4.3)
20
+ thor (0.14.6)
21
+
22
+ PLATFORMS
23
+ java
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ golf!
28
+ rack-test
29
+ simplecov
@@ -1,11 +1,15 @@
1
1
  module Golf
2
+
2
3
  class Compiler
3
4
 
5
+ require 'find'
6
+
4
7
  def initialize(golfpath = ".")
5
8
  @golfpath = "#{golfpath}/golfapp"
6
9
  puts "golf #{Golf::VERSION}: starting compiler in #{@golfpath}..."
7
10
  components = "#{@golfpath}/components"
8
11
  puts "golf #{Golf::VERSION}: is valid golfapp?: #{File.exists?(components)}"
12
+ traverse_ls(@golfpath)
9
13
  end
10
14
 
11
15
  def generate_componentsjs
@@ -17,9 +21,24 @@ module Golf
17
21
  end
18
22
 
19
23
  def res_json
20
- results = { "Gemfile" => "Gemfile", "plugins" => {},"config.ru" => "config.ru", "404.txt" => "404.txt" }
21
- Dir["#{@golfpath}/plugins/*.js"].each do |path|
22
- results["plugins"] = results["plugins"].merge({ File.basename(path) => "plugins/#{File.basename(path)}"})
24
+ results = {}
25
+ Find.find(dir) do |path|
26
+ e = path.slice(dir.length,path.length-dir.length)
27
+ f = URI.escape(e)
28
+ g = File.basename(e)
29
+ h = File.dirname(e) == "." ? [] : File.dirname(e).split("/")
30
+ if FileTest.directory?(path)
31
+ next
32
+ else
33
+ r2 = results
34
+ h.each { |i|
35
+ if ! r2[i]
36
+ r2[i] = {}
37
+ end
38
+ r2 = r2[i]
39
+ }
40
+ r2[g] = f
41
+ end
23
42
  end
24
43
  JSON.dump(results)
25
44
  end
@@ -39,7 +58,7 @@ module Golf
39
58
  def traverse(dir, type)
40
59
  results = {}
41
60
  if File.exists?(dir) and File.directory?(dir)
42
- Dir["#{dir}/**/*.#{type}"].each do |path|
61
+ Dir["#{dir}/**/*.#{type}"].sort.reverse.each do |path|
43
62
  if type == "html"
44
63
  name = package_name(path)
45
64
  arr = path.split('/')
@@ -1,3 +1,3 @@
1
1
  module Golf
2
- VERSION = "0.3.9"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,83 @@
1
+ PATH
2
+ remote: ~/Projects/golf
3
+ specs:
4
+ golf (0.3.0)
5
+ json
6
+ rack
7
+ thor
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ abstract (1.0.0)
13
+ actionmailer (3.0.6)
14
+ actionpack (= 3.0.6)
15
+ mail (~> 2.2.15)
16
+ actionpack (3.0.6)
17
+ activemodel (= 3.0.6)
18
+ activesupport (= 3.0.6)
19
+ builder (~> 2.1.2)
20
+ erubis (~> 2.6.6)
21
+ i18n (~> 0.5.0)
22
+ rack (~> 1.2.1)
23
+ rack-mount (~> 0.6.14)
24
+ rack-test (~> 0.5.7)
25
+ tzinfo (~> 0.3.23)
26
+ activemodel (3.0.6)
27
+ activesupport (= 3.0.6)
28
+ builder (~> 2.1.2)
29
+ i18n (~> 0.5.0)
30
+ activerecord (3.0.6)
31
+ activemodel (= 3.0.6)
32
+ activesupport (= 3.0.6)
33
+ arel (~> 2.0.2)
34
+ tzinfo (~> 0.3.23)
35
+ activeresource (3.0.6)
36
+ activemodel (= 3.0.6)
37
+ activesupport (= 3.0.6)
38
+ activesupport (3.0.6)
39
+ arel (2.0.9)
40
+ builder (2.1.2)
41
+ erubis (2.6.6)
42
+ abstract (>= 1.0.0)
43
+ i18n (0.5.0)
44
+ json (1.5.1)
45
+ mail (2.2.15)
46
+ activesupport (>= 2.3.6)
47
+ i18n (>= 0.4.0)
48
+ mime-types (~> 1.16)
49
+ treetop (~> 1.4.8)
50
+ mime-types (1.16)
51
+ polyglot (0.3.1)
52
+ rack (1.2.2)
53
+ rack-mount (0.6.14)
54
+ rack (>= 1.0.0)
55
+ rack-test (0.5.7)
56
+ rack (>= 1.0)
57
+ rails (3.0.6)
58
+ actionmailer (= 3.0.6)
59
+ actionpack (= 3.0.6)
60
+ activerecord (= 3.0.6)
61
+ activeresource (= 3.0.6)
62
+ activesupport (= 3.0.6)
63
+ bundler (~> 1.0)
64
+ railties (= 3.0.6)
65
+ railties (3.0.6)
66
+ actionpack (= 3.0.6)
67
+ activesupport (= 3.0.6)
68
+ rake (>= 0.8.7)
69
+ thor (~> 0.14.4)
70
+ rake (0.8.7)
71
+ sqlite3 (1.3.3)
72
+ thor (0.14.6)
73
+ treetop (1.4.9)
74
+ polyglot (>= 0.3.1)
75
+ tzinfo (0.3.26)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ golf!
82
+ rails (= 3.0.6)
83
+ sqlite3
@@ -0,0 +1,21 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ golf (0.2.0)
5
+ json
6
+ rack
7
+ thor
8
+ json (1.5.1)
9
+ rack (1.2.2)
10
+ sinatra (1.2.2)
11
+ rack (~> 1.1)
12
+ tilt (< 2.0, >= 1.2.2)
13
+ thor (0.14.6)
14
+ tilt (1.2.2)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ golf
21
+ sinatra
@@ -1,6 +1,11 @@
1
1
  $:.push File.expand_path("../../lib", __FILE__)
2
2
 
3
3
  require 'rubygems'
4
+ require 'simplecov'
5
+
6
+ SimpleCov.start
7
+
8
+
4
9
  require 'test/unit'
5
10
  require 'rack/test'
6
11
  require 'golf'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 9
9
- version: 0.3.9
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Micha Niskin, Alan Dipert, Julio Capote
@@ -92,6 +92,7 @@ files:
92
92
  - templates/new/golfapp/scripts/00-myscript.js
93
93
  - templates/new/golfapp/styles/main.css
94
94
  - templates/rails/Gemfile
95
+ - templates/rails/Gemfile.lock
95
96
  - templates/rails/README
96
97
  - templates/rails/Rakefile
97
98
  - templates/rails/app/controllers/application_controller.rb
@@ -147,6 +148,7 @@ files:
147
148
  - templates/raw/scripts/00-myscript.js
148
149
  - templates/raw/styles/main.css
149
150
  - templates/sinatra/Gemfile
151
+ - templates/sinatra/Gemfile.lock
150
152
  - templates/sinatra/config.ru
151
153
  - templates/sinatra/demo.rb
152
154
  - templates/sinatra/golfapp/components/RandomNumber/RandomNumber.html