bellejs 0.0.3 → 0.1.0

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.
Files changed (39) hide show
  1. data/Rakefile +8 -0
  2. data/bellejs.gemspec +2 -0
  3. data/bin/bellejs +12 -0
  4. data/lib/bellejs/belle_transpiler.rb +72 -0
  5. data/lib/bellejs/version.rb +2 -2
  6. data/lib/bellejs.rb +53 -2
  7. data/test/test_belle_transpiler_class.rb +15 -0
  8. data/test/test_belle_transpiler_import.rb +36 -0
  9. data/test/test_bellejs.rb +65 -0
  10. data/test/test_files/class_test.bellejs +6 -0
  11. data/test/test_files/import_test.bellejs +1 -0
  12. data/test/test_files/import_test.js +15 -0
  13. data/test/test_files/non_complied_class_test.js +5 -0
  14. data/test/test_files/recursive_double_import.bellejs +2 -0
  15. data/test/test_files/recursive_double_import.js +30 -0
  16. data/test/test_files/recursive_import_test.bellejs +1 -0
  17. data/test/test_files/recursive_import_test.js +15 -0
  18. data/test/test_files/simple_javascript.bellejs +15 -0
  19. data/test/test_files/simple_javascript.js +15 -0
  20. data/test/test_files/subdir/13617/output_test2.js +15 -0
  21. data/test/test_files/subdir/17210/output_test2.js +15 -0
  22. data/test/test_files/subdir/31452/output_test2.js +15 -0
  23. data/test/test_files/subdir/327/output_test2.js +15 -0
  24. data/test/test_files/subdir/3631/output_test2.js +15 -0
  25. data/test/test_files/subdir/51024/output_test2.js +15 -0
  26. data/test/test_files/subdir/57182/output_test2.js +15 -0
  27. data/test/test_files/subdir/60145/output_test2.js +15 -0
  28. data/test/test_files/subdir/72175/output_test2.js +15 -0
  29. data/test/test_files/subdir/73350/output_test2.js +15 -0
  30. data/test/test_files/subdir/81401/output_test2.js +15 -0
  31. data/test/test_files/subdir/84914/output_test2.js +15 -0
  32. data/test/test_files/subdir/91780/output_test2.js +15 -0
  33. data/test/test_files/subdir/99826/output_test2.js +15 -0
  34. data/test/test_files/subdir/output_test.js +15 -0
  35. data/test/test_files/subdir/test_file_NaME.js +15 -0
  36. data/test/test_files/subdir_import_test.bellejs +1 -0
  37. data/test/test_files/subdir_import_test.js +15 -0
  38. data/test/test_files/test_file_NaME.js +15 -0
  39. metadata +103 -4
data/Rakefile CHANGED
@@ -1,3 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'bundler'
3
+ require 'rake/testtask'
3
4
  Bundler::GemHelper.install_tasks
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'test'
8
+ end
9
+
10
+ desc "Run tests"
11
+ task :default => :test
data/bellejs.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency "rbelly"
22
+ spec.add_runtime_dependency "uglifier"
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  end
data/bin/bellejs ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bellejs'
4
+
5
+ # get args
6
+ args = ARGV.dup
7
+ ARGV.clear
8
+ input = args[0]
9
+ output = args[1] unless args[1].to_s[0] == "-"
10
+ minify = (args.include?("-m") or args.include?("-M"))
11
+
12
+ Bellejs.new(input, output, minify)
@@ -0,0 +1,72 @@
1
+ require "rbelly" # javascript parser
2
+
3
+ class BelleTranspiler
4
+
5
+ BELLEJS_NODE_CLASSES = [RBelly::Nodes::ImportNode, RBelly::Nodes::ClassNode]
6
+ LINE_END = RBelly::Nodes::ExpressionStatementNode
7
+
8
+ def initialize(file_contents, local_dir)
9
+ @local_dir = local_dir
10
+ @raw_file_contents = file_contents
11
+ @parser = RBelly::Parser.new
12
+ end
13
+
14
+ def transpile
15
+ ast = @parser.parse @raw_file_contents
16
+ pure_js_tree = replace_bellejs(ast)
17
+ pure_js_tree.to_ecma
18
+ end
19
+
20
+ private
21
+
22
+ def replace_bellejs(parse_tree)
23
+ parse_tree.each do |node|
24
+ if node.class == RBelly::Nodes::SourceElementsNode
25
+ i = 0
26
+ source_array = node.value
27
+ source_array.each do |element|
28
+ if BELLEJS_NODE_CLASSES.include?(element.class)
29
+ node.value[i] =evaluate(node.value[i])
30
+ end
31
+ i+=1
32
+ end
33
+ end
34
+ end
35
+ parse_tree
36
+ end
37
+
38
+ def evaluate(bellejs_statement)
39
+ case bellejs_statement
40
+ when RBelly::Nodes::ImportNode
41
+ process_import bellejs_statement
42
+ when RBelly::Nodes::ClassNode
43
+ process_class bellejs_statement
44
+ else
45
+ bellejs_statement
46
+ end
47
+ end
48
+
49
+ def process_import(import_statement)
50
+ file_name = @local_dir + "/" + import_statement.value.value.gsub("\"", '').gsub("\'", '')
51
+ ast = @parser.parse File.read(file_name)
52
+ replace_bellejs ast
53
+ end
54
+
55
+ def process_class(class_statement)
56
+ class_as_function = @parser.parse("function #{class_statement.value}() #{class_statement.class_body.to_ecma}")
57
+ end
58
+
59
+ # debug helpers:
60
+
61
+ def print_tree(tree)
62
+ tree.each do |node|
63
+ puts node.value
64
+ end
65
+ end
66
+
67
+ def print_result(tree)
68
+ puts tree.to_ecma
69
+ end
70
+
71
+
72
+ end
@@ -1,3 +1,3 @@
1
- module Bellejs
2
- VERSION = "0.0.3"
1
+ class Bellejs
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/bellejs.rb CHANGED
@@ -1,5 +1,56 @@
1
1
  require "bellejs/version"
2
+ require 'bellejs/belle_transpiler'
3
+ require 'uglifier'
4
+
5
+ class Bellejs
6
+
7
+ def initialize(input_file, output_file = nil, minify = false)
8
+ @local_dir = File.dirname(input_file)
9
+ @output_path = get_output_path(input_file, output_file)
10
+ @file_contents = get_file_contents(input_file)
11
+ @compiled_js = compile(@file_contents)
12
+ uglify_js if minify
13
+ write
14
+ end
15
+
16
+ private
17
+
18
+ def get_output_path(input, output)
19
+ if output.nil?
20
+ File.dirname(input) + "/" + File.basename(input, ".bellejs") + ".js"
21
+ else
22
+ if File.directory?(output)
23
+ output + (output[-1, 1] == "/" ? "" : "/") + File.basename(input, ".bellejs") + ".js"
24
+ else
25
+ raise ArgumentError, 'Output parameter is invalid.' unless output.downcase[-3, 3] == ".js"
26
+ if File.basename(output) == output # no directory attached
27
+ File.dirname(input) + "/" + output
28
+ else
29
+ output
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ def get_file_contents(input)
36
+ raise IOError, 'Input file does not exist.' unless File.exists?(input)
37
+ raise IOError, 'Input file is an invalid format. Only .bellejs and .js files are allowed.' unless
38
+ input.downcase[-8,8] == ".bellejs" or input.downcase[-3,3] == ".js"
39
+ File.read(input)
40
+ end
41
+
42
+ def compile(file_contents)
43
+ transpiler = BelleTranspiler.new(file_contents, @local_dir)
44
+ transpiler.transpile # <-- where the magic happens
45
+ end
46
+
47
+ def uglify_js
48
+ @compiled_js = Uglifier.compile(@compiled_js, :mangle => false)
49
+ end
50
+
51
+ def write
52
+ FileUtils.mkdir_p(File.dirname(@output_path))
53
+ File.open(@output_path, 'w') { |file| file.write(@compiled_js) }
54
+ end
2
55
 
3
- module Bellejs
4
- # Your code goes here...
5
56
  end
@@ -0,0 +1,15 @@
1
+ require 'test/unit'
2
+ require 'bellejs/belle_transpiler'
3
+
4
+ class TestBelleTranspilerClass < Test::Unit::TestCase
5
+
6
+ TEST_FILE_DIRECTORY = './test/test_files/'
7
+
8
+ def test_simple_class
9
+ # simple class conversion
10
+ file_path = TEST_FILE_DIRECTORY + 'class_test.bellejs'
11
+ bellejs = Bellejs.new(file_path)
12
+ assert_equal File.read("#{TEST_FILE_DIRECTORY}class_test.js"), File.read("#{TEST_FILE_DIRECTORY}non_complied_class_test.js")
13
+ end
14
+
15
+ end
@@ -0,0 +1,36 @@
1
+ require 'test/unit'
2
+ require 'bellejs/belle_transpiler'
3
+
4
+ class TestBelleTranspilerImport < Test::Unit::TestCase
5
+
6
+ TEST_FILE_DIRECTORY = './test/test_files/'
7
+
8
+ def test_import
9
+ # only contains an import statement that imports the simple_javascript.js file
10
+ file_path = TEST_FILE_DIRECTORY + 'import_test.bellejs'
11
+ bellejs = Bellejs.new(file_path)
12
+ assert_equal File.read("#{TEST_FILE_DIRECTORY}import_test.js"), File.read("#{TEST_FILE_DIRECTORY}simple_javascript.js")
13
+ end
14
+
15
+ def test_import_recursive
16
+ # import a file with an import statement that imports the simple_javascript.js file
17
+ file_path = TEST_FILE_DIRECTORY + 'recursive_import_test.bellejs'
18
+ bellejs = Bellejs.new(file_path)
19
+ assert_equal File.read("#{TEST_FILE_DIRECTORY}recursive_import_test.js"), File.read("#{TEST_FILE_DIRECTORY}simple_javascript.js")
20
+ end
21
+
22
+ def test_double_import_recursive
23
+ # 2 import statements one recursive both import the simple_javascript.js file... woa
24
+ file_path = TEST_FILE_DIRECTORY + 'recursive_double_import.bellejs'
25
+ bellejs = Bellejs.new(file_path)
26
+ assert_equal File.read("#{TEST_FILE_DIRECTORY}recursive_double_import.js"), (File.read("#{TEST_FILE_DIRECTORY}simple_javascript.js")+"\n"+File.read("#{TEST_FILE_DIRECTORY}simple_javascript.js"))
27
+ end
28
+
29
+ def test_subdir_import
30
+ # try to import a file in a different directory
31
+ file_path = TEST_FILE_DIRECTORY + "subdir_import_test.bellejs"
32
+ bellejs = Bellejs.new(file_path)
33
+ assert_equal File.read("#{TEST_FILE_DIRECTORY}subdir_import_test.js"), File.read("#{TEST_FILE_DIRECTORY}subdir/test_file_NaME.js")
34
+ end
35
+
36
+ end
@@ -0,0 +1,65 @@
1
+ require 'test/unit'
2
+ require 'bellejs'
3
+ require 'rbelly'
4
+
5
+ class TestBellejs < Test::Unit::TestCase
6
+
7
+ TEST_FILE_DIRECTORY = './test/test_files/'
8
+ SIMPLE_FILE_PATH = TEST_FILE_DIRECTORY + 'simple_javascript.bellejs'
9
+
10
+ def test_file_read
11
+ # valid file
12
+ file_path = TEST_FILE_DIRECTORY + 'simple_javascript.bellejs'
13
+ bellejs = Bellejs.new(file_path)
14
+ assert_equal bellejs.instance_variable_get(:@file_contents), File.read(file_path)
15
+
16
+ # file doesn't exist
17
+ assert_raise IOError do
18
+ bellejs = Bellejs.new(TEST_FILE_DIRECTORY + '/non-existant-dir/fake.bellejs')
19
+ end
20
+
21
+ # invalid file type
22
+ assert_raise IOError do
23
+ bellejs = Bellejs.new(TEST_FILE_DIRECTORY + 'cc.png')
24
+ end
25
+
26
+ end
27
+
28
+ def test_output_path
29
+ # no output specified
30
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH)
31
+ assert_equal bellejs.instance_variable_get(:@output_path), "./test/test_files/simple_javascript.js"
32
+
33
+ # output is a directory
34
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, TEST_FILE_DIRECTORY)
35
+ assert_equal bellejs.instance_variable_get(:@output_path), "./test/test_files/simple_javascript.js"
36
+
37
+ # output is just a .js file
38
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, "test_file_NaME.js")
39
+ assert_equal bellejs.instance_variable_get(:@output_path), "./test/test_files/test_file_NaME.js"
40
+
41
+ # output is a .js file with a directory
42
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, "./test/test_files/subdir/test_file_NaME.js")
43
+ assert_equal bellejs.instance_variable_get(:@output_path), "./test/test_files/subdir/test_file_NaME.js"
44
+
45
+ # output is invalid
46
+ assert_raise ArgumentError do
47
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, "./badFile.png")
48
+ end
49
+
50
+ end
51
+
52
+ def test_file_write
53
+ # output is a .js file with an existing directory
54
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, "./test/test_files/subdir/output_test.js")
55
+ assert_equal File.read("./test/test_files/subdir/output_test.js"), RBelly::Parser.new.parse(File.read(SIMPLE_FILE_PATH)).to_ecma
56
+
57
+ #output to a non-existant folder
58
+ random_folder_name = Random.new.rand(0...99999).to_s
59
+ bellejs = Bellejs.new(SIMPLE_FILE_PATH, "./test/test_files/subdir/#{random_folder_name}/output_test2.js")
60
+ assert_equal File.read("./test/test_files/subdir/#{random_folder_name}/output_test2.js"), RBelly::Parser.new.parse(File.read(SIMPLE_FILE_PATH)).to_ecma
61
+
62
+ end
63
+
64
+
65
+ end
@@ -0,0 +1,6 @@
1
+ class Dog {
2
+
3
+ function bark() {
4
+ alert("woof woof!");
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ import "simple_javascript.bellejs";
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ function Dog(){
2
+ function bark(){
3
+ alert("woof woof!");
4
+ }
5
+ }
@@ -0,0 +1,2 @@
1
+ import "import_test.bellejs";
2
+ import "simple_javascript.bellejs";
@@ -0,0 +1,30 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
16
+ alert("Hey this is an alert");
17
+ $(document).ready(doStuff);
18
+ $('a.important_tag').click(function() {
19
+ if(doStuff()) {
20
+ $(this).attr("href", "www.google.com/");
21
+ }
22
+ });
23
+ function doStuff(){
24
+ var number = 9 * 12 - 19 + 2;
25
+ if(number == 200) {
26
+ return true;
27
+ } else {
28
+ return false;
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ import "import_test.bellejs";
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/")
6
+ }
7
+ });
8
+ function doStuff() {
9
+ var number = 9*12-19+2
10
+ if (number == 200){
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ import "subdir/test_file_NaME.js";
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ alert("Hey this is an alert");
2
+ $(document).ready(doStuff);
3
+ $('a.important_tag').click(function() {
4
+ if(doStuff()) {
5
+ $(this).attr("href", "www.google.com/");
6
+ }
7
+ });
8
+ function doStuff(){
9
+ var number = 9 * 12 - 19 + 2;
10
+ if(number == 200) {
11
+ return true;
12
+ } else {
13
+ return false;
14
+ }
15
+ }
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.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-20 00:00:00.000000000 Z
12
+ date: 2013-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rbelly
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: uglifier
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  - !ruby/object:Gem::Dependency
15
47
  name: bundler
16
48
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +78,8 @@ dependencies:
46
78
  description: Better Object Oriented Javascript Transpiler
47
79
  email:
48
80
  - repp@redtettemer.com
49
- executables: []
81
+ executables:
82
+ - bellejs
50
83
  extensions: []
51
84
  extra_rdoc_files: []
52
85
  files:
@@ -56,8 +89,42 @@ files:
56
89
  - README.md
57
90
  - Rakefile
58
91
  - bellejs.gemspec
92
+ - bin/bellejs
59
93
  - lib/bellejs.rb
94
+ - lib/bellejs/belle_transpiler.rb
60
95
  - lib/bellejs/version.rb
96
+ - test/test_belle_transpiler_class.rb
97
+ - test/test_belle_transpiler_import.rb
98
+ - test/test_bellejs.rb
99
+ - test/test_files/class_test.bellejs
100
+ - test/test_files/import_test.bellejs
101
+ - test/test_files/import_test.js
102
+ - test/test_files/non_complied_class_test.js
103
+ - test/test_files/recursive_double_import.bellejs
104
+ - test/test_files/recursive_double_import.js
105
+ - test/test_files/recursive_import_test.bellejs
106
+ - test/test_files/recursive_import_test.js
107
+ - test/test_files/simple_javascript.bellejs
108
+ - test/test_files/simple_javascript.js
109
+ - test/test_files/subdir/13617/output_test2.js
110
+ - test/test_files/subdir/17210/output_test2.js
111
+ - test/test_files/subdir/31452/output_test2.js
112
+ - test/test_files/subdir/327/output_test2.js
113
+ - test/test_files/subdir/3631/output_test2.js
114
+ - test/test_files/subdir/51024/output_test2.js
115
+ - test/test_files/subdir/57182/output_test2.js
116
+ - test/test_files/subdir/60145/output_test2.js
117
+ - test/test_files/subdir/72175/output_test2.js
118
+ - test/test_files/subdir/73350/output_test2.js
119
+ - test/test_files/subdir/81401/output_test2.js
120
+ - test/test_files/subdir/84914/output_test2.js
121
+ - test/test_files/subdir/91780/output_test2.js
122
+ - test/test_files/subdir/99826/output_test2.js
123
+ - test/test_files/subdir/output_test.js
124
+ - test/test_files/subdir/test_file_NaME.js
125
+ - test/test_files/subdir_import_test.bellejs
126
+ - test/test_files/subdir_import_test.js
127
+ - test/test_files/test_file_NaME.js
61
128
  homepage: ''
62
129
  licenses:
63
130
  - MIT
@@ -84,4 +151,36 @@ signing_key:
84
151
  specification_version: 3
85
152
  summary: This gem takes bellejs formatted code and transpiles it into valid mimified
86
153
  javascript.
87
- test_files: []
154
+ test_files:
155
+ - test/test_belle_transpiler_class.rb
156
+ - test/test_belle_transpiler_import.rb
157
+ - test/test_bellejs.rb
158
+ - test/test_files/class_test.bellejs
159
+ - test/test_files/import_test.bellejs
160
+ - test/test_files/import_test.js
161
+ - test/test_files/non_complied_class_test.js
162
+ - test/test_files/recursive_double_import.bellejs
163
+ - test/test_files/recursive_double_import.js
164
+ - test/test_files/recursive_import_test.bellejs
165
+ - test/test_files/recursive_import_test.js
166
+ - test/test_files/simple_javascript.bellejs
167
+ - test/test_files/simple_javascript.js
168
+ - test/test_files/subdir/13617/output_test2.js
169
+ - test/test_files/subdir/17210/output_test2.js
170
+ - test/test_files/subdir/31452/output_test2.js
171
+ - test/test_files/subdir/327/output_test2.js
172
+ - test/test_files/subdir/3631/output_test2.js
173
+ - test/test_files/subdir/51024/output_test2.js
174
+ - test/test_files/subdir/57182/output_test2.js
175
+ - test/test_files/subdir/60145/output_test2.js
176
+ - test/test_files/subdir/72175/output_test2.js
177
+ - test/test_files/subdir/73350/output_test2.js
178
+ - test/test_files/subdir/81401/output_test2.js
179
+ - test/test_files/subdir/84914/output_test2.js
180
+ - test/test_files/subdir/91780/output_test2.js
181
+ - test/test_files/subdir/99826/output_test2.js
182
+ - test/test_files/subdir/output_test.js
183
+ - test/test_files/subdir/test_file_NaME.js
184
+ - test/test_files/subdir_import_test.bellejs
185
+ - test/test_files/subdir_import_test.js
186
+ - test/test_files/test_file_NaME.js