golf 0.0.4 → 0.0.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/golf.gemspec +2 -0
- data/lib/golf/compiler.rb +14 -4
- data/lib/golf/rack.rb +3 -1
- data/lib/golf/version.rb +1 -1
- data/lib/golf.rb +1 -0
- data/template/config.ru +1 -1
- data/template/golfapp/components/HelloWorld/HelloWorld.html +13 -0
- data/template/golfapp/controller.js +1 -4
- data/test/data/app_error.html +60 -0
- data/test/data/components/HelloWorld/HelloWorld.html +13 -0
- data/test/data/components.js +1 -0
- data/test/data/controller.js +7 -0
- data/test/data/index.html +61 -0
- data/test/data/jquery.address.js +439 -0
- data/test/data/jquery.golf.js +942 -0
- data/test/data/jquery.js +4376 -0
- data/test/data/welcome2golf.html +50 -0
- data/test/test_compiler.rb +11 -3
- metadata +31 -4
- data/template/golfapp/components/Test/Test.html +0 -22
- data/template/golfapp/components/Test/Test.res/myfile.txt +0 -1
- data/template/golfapp/plugins/mylib.js +0 -12
| @@ -0,0 +1,50 @@ | |
| 1 | 
            +
            <style type="text/css">
         | 
| 2 | 
            +
              * {
         | 
| 3 | 
            +
                font-family: sans-serif;
         | 
| 4 | 
            +
                margin: 0;
         | 
| 5 | 
            +
                padding: 0;
         | 
| 6 | 
            +
                color: #222;
         | 
| 7 | 
            +
              }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              h1 {
         | 
| 10 | 
            +
                padding: .5em 20px .5em 20px;
         | 
| 11 | 
            +
                background: cadetblue;
         | 
| 12 | 
            +
                margin: 2px;
         | 
| 13 | 
            +
              }
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              h3 {
         | 
| 16 | 
            +
                padding: .5em 20px .5em 20px;
         | 
| 17 | 
            +
                background: yellowgreen;
         | 
| 18 | 
            +
                margin: 2px;
         | 
| 19 | 
            +
              }
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              p {
         | 
| 22 | 
            +
                padding: .75em 20px .75em 20px;
         | 
| 23 | 
            +
                background: orange;
         | 
| 24 | 
            +
                margin: 2px;
         | 
| 25 | 
            +
              }
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              a, a:visited {
         | 
| 28 | 
            +
                color: darkblue;
         | 
| 29 | 
            +
              }
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              a:hover {
         | 
| 32 | 
            +
                color: white;
         | 
| 33 | 
            +
              }
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              .content {
         | 
| 36 | 
            +
                position: relative;
         | 
| 37 | 
            +
                top: 5em;
         | 
| 38 | 
            +
                width: 35em;
         | 
| 39 | 
            +
                margin: 0 auto;
         | 
| 40 | 
            +
              }
         | 
| 41 | 
            +
            </style>
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            <div class="content">
         | 
| 44 | 
            +
              <h1>Hi there!</h1>
         | 
| 45 | 
            +
              <h3>Your Golf Web Application Server is up and running.</h3>
         | 
| 46 | 
            +
              <p>
         | 
| 47 | 
            +
                Look at the <a href="http://golf.github.com/">documentation</a> to
         | 
| 48 | 
            +
                get started!
         | 
| 49 | 
            +
              </p>
         | 
| 50 | 
            +
            </div>
         | 
    
        data/test/test_compiler.rb
    CHANGED
    
    | @@ -2,9 +2,17 @@ require 'test_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            class CompilerTest < Test::Unit::TestCase
         | 
| 4 4 |  | 
| 5 | 
            -
              def  | 
| 6 | 
            -
                 | 
| 7 | 
            -
             | 
| 5 | 
            +
              def setup
         | 
| 6 | 
            +
                @compiler = Golf::Compiler.new(File.expand_path("../data/components", __FILE__))
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
             | 
| 10 | 
            +
              def test_componentsjs_generation
         | 
| 11 | 
            +
                componentjs = @compiler.generate_componentsjs
         | 
| 12 | 
            +
                known_good = 'jQuery.golf.components={"HelloWorld":{"name":"HelloWorld","html":"<div><styletype=\"text/golf\">div.container{border:1pxsolidred;}</style><scripttype=\"text/golf\">function(){$(\".container\").append(\"<h1>Hello,world!</h1>\");}</script><divclass=\"container\"></div></div>"}};jQuery.golf.res={};jQuery.golf.plugins={};jQuery.golf.scripts={};jQuery.golf.styles={};jQuery.golf.setupComponents();'
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                assert_equal componentjs.gsub(' ','').gsub('\n',''), known_good.gsub(' ','').gsub('\n','')
         | 
| 15 | 
            +
                
         | 
| 8 16 | 
             
              end
         | 
| 9 17 |  | 
| 10 18 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: golf
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.0. | 
| 5 | 
            +
              version: 0.0.5
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors: 
         | 
| 8 8 | 
             
              - Micha Niskin, Alan Dipert, Julio Capote
         | 
| @@ -24,6 +24,17 @@ dependencies: | |
| 24 24 | 
             
                        version: "0"
         | 
| 25 25 | 
             
                type: :runtime
         | 
| 26 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
         | 
| 27 38 | 
             
            description: Golf lets you write your interface in terms of reusable, simple components.
         | 
| 28 39 | 
             
            email: 
         | 
| 29 40 | 
             
              - michaniskin@gmail.com
         | 
| @@ -48,10 +59,17 @@ files: | |
| 48 59 | 
             
              - template/404.txt
         | 
| 49 60 | 
             
              - template/Gemfile
         | 
| 50 61 | 
             
              - template/config.ru
         | 
| 51 | 
            -
              - template/golfapp/components/ | 
| 52 | 
            -
              - template/golfapp/components/Test/Test.res/myfile.txt
         | 
| 62 | 
            +
              - template/golfapp/components/HelloWorld/HelloWorld.html
         | 
| 53 63 | 
             
              - template/golfapp/controller.js
         | 
| 54 | 
            -
              -  | 
| 64 | 
            +
              - test/data/app_error.html
         | 
| 65 | 
            +
              - test/data/components.js
         | 
| 66 | 
            +
              - test/data/components/HelloWorld/HelloWorld.html
         | 
| 67 | 
            +
              - test/data/controller.js
         | 
| 68 | 
            +
              - test/data/index.html
         | 
| 69 | 
            +
              - test/data/jquery.address.js
         | 
| 70 | 
            +
              - test/data/jquery.golf.js
         | 
| 71 | 
            +
              - test/data/jquery.js
         | 
| 72 | 
            +
              - test/data/welcome2golf.html
         | 
| 55 73 | 
             
              - test/test_compiler.rb
         | 
| 56 74 | 
             
              - test/test_helper.rb
         | 
| 57 75 | 
             
              - test/test_rack.rb
         | 
| @@ -84,6 +102,15 @@ signing_key: | |
| 84 102 | 
             
            specification_version: 3
         | 
| 85 103 | 
             
            summary: Component based front end JS Framework
         | 
| 86 104 | 
             
            test_files: 
         | 
| 105 | 
            +
              - test/data/app_error.html
         | 
| 106 | 
            +
              - test/data/components.js
         | 
| 107 | 
            +
              - test/data/components/HelloWorld/HelloWorld.html
         | 
| 108 | 
            +
              - test/data/controller.js
         | 
| 109 | 
            +
              - test/data/index.html
         | 
| 110 | 
            +
              - test/data/jquery.address.js
         | 
| 111 | 
            +
              - test/data/jquery.golf.js
         | 
| 112 | 
            +
              - test/data/jquery.js
         | 
| 113 | 
            +
              - test/data/welcome2golf.html
         | 
| 87 114 | 
             
              - test/test_compiler.rb
         | 
| 88 115 | 
             
              - test/test_helper.rb
         | 
| 89 116 | 
             
              - test/test_rack.rb
         | 
| @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            <div>
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              <style type="text/golf">
         | 
| 4 | 
            -
              </style>
         | 
| 5 | 
            -
             | 
| 6 | 
            -
              <script type="text/golf">
         | 
| 7 | 
            -
                function() {
         | 
| 8 | 
            -
                  var MyThing = $.require("mylib").MyThing;
         | 
| 9 | 
            -
                  var m = new MyThing();
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  $("p").text("this is awesome");
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  this.update_p = function(what) {
         | 
| 14 | 
            -
                    $("p").text(what);
         | 
| 15 | 
            -
                  }
         | 
| 16 | 
            -
                }
         | 
| 17 | 
            -
              </script>
         | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
              <h1>Hello, world.</h1>
         | 
| 21 | 
            -
              <p>This is a test!</p>
         | 
| 22 | 
            -
            </div>
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            hi
         |