bellejs 0.3.0 → 0.3.1
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/.gitignore +7 -1
 - data/README.md +3 -28
 - data/lib/bellejs/belle_transpiler.rb +4 -0
 - data/lib/bellejs/version.rb +1 -1
 - data/test/test_files/class_test.js +5 -0
 - data/test/test_files/dingo.min.js +1 -0
 - data/test/test_files/extends_test.js +14 -0
 - data/test/test_files/noncompiled_private_public_test.js +1 -0
 - data/test/test_files/private_public_test.bellejs +1 -0
 - data/test/test_files/private_public_test.js +13 -0
 - metadata +9 -1
 
    
        data/.gitignore
    CHANGED
    
    | 
         @@ -2,12 +2,13 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            *.rbc
         
     | 
| 
       3 
3 
     | 
    
         
             
            .bundle
         
     | 
| 
       4 
4 
     | 
    
         
             
            .config
         
     | 
| 
      
 5 
     | 
    
         
            +
            <<<<<<< HEAD
         
     | 
| 
       5 
6 
     | 
    
         
             
            .yardoc
         
     | 
| 
       6 
7 
     | 
    
         
             
            Gemfile.lock
         
     | 
| 
       7 
8 
     | 
    
         
             
            InstalledFiles
         
     | 
| 
       8 
9 
     | 
    
         
             
            _yardoc
         
     | 
| 
       9 
10 
     | 
    
         
             
            coverage
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
            InstalledFiles
         
     | 
| 
       11 
12 
     | 
    
         
             
            lib/bundler/man
         
     | 
| 
       12 
13 
     | 
    
         
             
            pkg
         
     | 
| 
       13 
14 
     | 
    
         
             
            rdoc
         
     | 
| 
         @@ -15,3 +16,8 @@ spec/reports 
     | 
|
| 
       15 
16 
     | 
    
         
             
            test/tmp
         
     | 
| 
       16 
17 
     | 
    
         
             
            test/version_tmp
         
     | 
| 
       17 
18 
     | 
    
         
             
            tmp
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            # YARD artifacts
         
     | 
| 
      
 21 
     | 
    
         
            +
            .yardoc
         
     | 
| 
      
 22 
     | 
    
         
            +
            _yardoc
         
     | 
| 
      
 23 
     | 
    
         
            +
            doc/
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,29 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            bellejs
         
     | 
| 
      
 2 
     | 
    
         
            +
            =======
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            ## Installation
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            Add this line to your application's Gemfile:
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                gem 'bellejs'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            And then execute:
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                $ bundle
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            Or install it yourself as:
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                $ gem install bellejs
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            ## Usage
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            TODO: Write usage instructions here
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            1. Fork it
         
     | 
| 
       26 
     | 
    
         
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
       27 
     | 
    
         
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
       28 
     | 
    
         
            -
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       29 
     | 
    
         
            -
            5. Create new Pull Request
         
     | 
| 
      
 4 
     | 
    
         
            +
            A language transpiler written in ruby that turns Bellejs into valid javascript.
         
     | 
| 
         @@ -75,6 +75,10 @@ class BelleTranspiler 
     | 
|
| 
       75 
75 
     | 
    
         
             
                js_decl_statement = var_statement.var_statement.value.first
         
     | 
| 
       76 
76 
     | 
    
         
             
                var_name = js_decl_statement.name
         
     | 
| 
       77 
77 
     | 
    
         
             
                var_value = (js_decl_statement.value == nil ? nil : js_decl_statement.value.value.value)
         
     | 
| 
      
 78 
     | 
    
         
            +
                if var_value.class == RBelly::Nodes::ResolveNode
         
     | 
| 
      
 79 
     | 
    
         
            +
                   #object declaration
         
     | 
| 
      
 80 
     | 
    
         
            +
                  var_value = "new " + var_value.value.to_s
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
       78 
82 
     | 
    
         
             
                var_value = js_decl_statement.value.value.to_ecma if var_value.class == Array
         
     | 
| 
       79 
83 
     | 
    
         
             
                var_value_statement = (var_value.nil? ? ";" : " = " + var_value.to_s + ";")
         
     | 
| 
       80 
84 
     | 
    
         
             
                is_constant = js_decl_statement.constant?
         
     | 
    
        data/lib/bellejs/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            function Dog(){}
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            function Animal(){
         
     | 
| 
      
 2 
     | 
    
         
            +
              this.makeNoise = function() {
         
     | 
| 
      
 3 
     | 
    
         
            +
                alert("-rustle-");
         
     | 
| 
      
 4 
     | 
    
         
            +
              };
         
     | 
| 
      
 5 
     | 
    
         
            +
            }
         
     | 
| 
      
 6 
     | 
    
         
            +
            function Wolf(){
         
     | 
| 
      
 7 
     | 
    
         
            +
              this.howl = function() {
         
     | 
| 
      
 8 
     | 
    
         
            +
                alert("Hooooooowlllllll!");
         
     | 
| 
      
 9 
     | 
    
         
            +
              };
         
     | 
| 
      
 10 
     | 
    
         
            +
              this.makeNoise = function() {
         
     | 
| 
      
 11 
     | 
    
         
            +
                this.howl();
         
     | 
| 
      
 12 
     | 
    
         
            +
              };
         
     | 
| 
      
 13 
     | 
    
         
            +
            }
         
     | 
| 
      
 14 
     | 
    
         
            +
            Wolf.prototype = new Animal();
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            function Alligator(){
         
     | 
| 
      
 2 
     | 
    
         
            +
                var tooth;
         
     | 
| 
      
 3 
     | 
    
         
            +
                var eye = new Eye();
         
     | 
| 
      
 4 
     | 
    
         
            +
                var genitals = "thing";
         
     | 
| 
      
 5 
     | 
    
         
            +
                this.face = 2345;
         
     | 
| 
      
 6 
     | 
    
         
            +
                this.tail = ['scaly', 'green', 'long'];
         
     | 
| 
      
 7 
     | 
    
         
            +
                  function pickNose(){
         
     | 
| 
      
 8 
     | 
    
         
            +
                alert("adsf");
         
     | 
| 
      
 9 
     | 
    
         
            +
              }
         
     | 
| 
      
 10 
     | 
    
         
            +
                this.walk = function(arg1, arg2) {
         
     | 
| 
      
 11 
     | 
    
         
            +
                alert(this.face);
         
     | 
| 
      
 12 
     | 
    
         
            +
              };
         
     | 
| 
      
 13 
     | 
    
         
            +
            }
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bellejs
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -97,13 +97,17 @@ files: 
     | 
|
| 
       97 
97 
     | 
    
         
             
            - test/test_belle_transpiler_import.rb
         
     | 
| 
       98 
98 
     | 
    
         
             
            - test/test_bellejs.rb
         
     | 
| 
       99 
99 
     | 
    
         
             
            - test/test_files/class_test.bellejs
         
     | 
| 
      
 100 
     | 
    
         
            +
            - test/test_files/class_test.js
         
     | 
| 
      
 101 
     | 
    
         
            +
            - test/test_files/dingo.min.js
         
     | 
| 
       100 
102 
     | 
    
         
             
            - test/test_files/extends_test.bellejs
         
     | 
| 
      
 103 
     | 
    
         
            +
            - test/test_files/extends_test.js
         
     | 
| 
       101 
104 
     | 
    
         
             
            - test/test_files/import_test.bellejs
         
     | 
| 
       102 
105 
     | 
    
         
             
            - test/test_files/import_test.js
         
     | 
| 
       103 
106 
     | 
    
         
             
            - test/test_files/non_compiled_extends_test.js
         
     | 
| 
       104 
107 
     | 
    
         
             
            - test/test_files/non_complied_class_test.js
         
     | 
| 
       105 
108 
     | 
    
         
             
            - test/test_files/noncompiled_private_public_test.js
         
     | 
| 
       106 
109 
     | 
    
         
             
            - test/test_files/private_public_test.bellejs
         
     | 
| 
      
 110 
     | 
    
         
            +
            - test/test_files/private_public_test.js
         
     | 
| 
       107 
111 
     | 
    
         
             
            - test/test_files/recursive_double_import.bellejs
         
     | 
| 
       108 
112 
     | 
    
         
             
            - test/test_files/recursive_double_import.js
         
     | 
| 
       109 
113 
     | 
    
         
             
            - test/test_files/recursive_import_test.bellejs
         
     | 
| 
         @@ -146,13 +150,17 @@ test_files: 
     | 
|
| 
       146 
150 
     | 
    
         
             
            - test/test_belle_transpiler_import.rb
         
     | 
| 
       147 
151 
     | 
    
         
             
            - test/test_bellejs.rb
         
     | 
| 
       148 
152 
     | 
    
         
             
            - test/test_files/class_test.bellejs
         
     | 
| 
      
 153 
     | 
    
         
            +
            - test/test_files/class_test.js
         
     | 
| 
      
 154 
     | 
    
         
            +
            - test/test_files/dingo.min.js
         
     | 
| 
       149 
155 
     | 
    
         
             
            - test/test_files/extends_test.bellejs
         
     | 
| 
      
 156 
     | 
    
         
            +
            - test/test_files/extends_test.js
         
     | 
| 
       150 
157 
     | 
    
         
             
            - test/test_files/import_test.bellejs
         
     | 
| 
       151 
158 
     | 
    
         
             
            - test/test_files/import_test.js
         
     | 
| 
       152 
159 
     | 
    
         
             
            - test/test_files/non_compiled_extends_test.js
         
     | 
| 
       153 
160 
     | 
    
         
             
            - test/test_files/non_complied_class_test.js
         
     | 
| 
       154 
161 
     | 
    
         
             
            - test/test_files/noncompiled_private_public_test.js
         
     | 
| 
       155 
162 
     | 
    
         
             
            - test/test_files/private_public_test.bellejs
         
     | 
| 
      
 163 
     | 
    
         
            +
            - test/test_files/private_public_test.js
         
     | 
| 
       156 
164 
     | 
    
         
             
            - test/test_files/recursive_double_import.bellejs
         
     | 
| 
       157 
165 
     | 
    
         
             
            - test/test_files/recursive_double_import.js
         
     | 
| 
       158 
166 
     | 
    
         
             
            - test/test_files/recursive_import_test.bellejs
         
     |