judojs 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/LICENSE.markdown +29 -0
  2. data/bin/jpm +52 -0
  3. data/bin/judojs +52 -0
  4. data/lib/judojs/command.rb +136 -0
  5. data/lib/judojs/configuration.rb +77 -0
  6. data/lib/judojs/dependencies.rb +14 -0
  7. data/lib/judojs/helpers.rb +16 -0
  8. data/lib/judojs/jpm.rb +62 -0
  9. data/lib/judojs/project.rb +193 -0
  10. data/lib/judojs.rb +31 -0
  11. data/repository/jquery/1.1.4.js +2508 -0
  12. data/repository/jquery/1.2.6.js +32 -0
  13. data/repository/jquery/1.3.2.js +19 -0
  14. data/repository/jquery/1.4.2.js +154 -0
  15. data/repository/jquery/latest.js +1 -0
  16. data/repository/judojs/core/existence.js +41 -0
  17. data/repository/judojs/core/extend.js +22 -0
  18. data/repository/judojs/core/judo.js +26 -0
  19. data/repository/judojs/tests/index.html +21 -0
  20. data/repository/judojs/tests/judojs.test.js +109 -0
  21. data/repository/judojs/tests/judojs.utilities.test.js +149 -0
  22. data/repository/judojs/utilities/all.js +2 -0
  23. data/repository/judojs/utilities/array.js +34 -0
  24. data/repository/judojs/utilities/string.js +66 -0
  25. data/repository/modernizr/1.5.js +28 -0
  26. data/repository/modernizr/latest.js +1 -0
  27. data/repository/selectivizr/1.0.js +5 -0
  28. data/repository/selectivizr/latest.js +1 -0
  29. data/tests/fixtures/global.js +6 -0
  30. data/tests/fixtures/global.module.js +3 -0
  31. data/tests/fixtures/judojs.conf +5 -0
  32. data/tests/fixtures/myapplication.js +90 -0
  33. data/tests/fixtures/test.elements.js +4 -0
  34. data/tests/fixtures/test.js +2 -0
  35. data/tests/fixtures/test.model.js +3 -0
  36. data/tests/fixtures/test.module.js +12 -0
  37. data/tests/fixtures/update.judojs.conf +4 -0
  38. data/tests/fixtures/updated.myapplication.js +27 -0
  39. data/tests/fixtures/utilities.js +100 -0
  40. data/tests/jpm_test.rb +10 -0
  41. data/tests/judo_test.rb +12 -0
  42. data/tests/project_test.rb +91 -0
  43. data/tests/update_test.rb +70 -0
  44. metadata +165 -0
@@ -0,0 +1,91 @@
1
+ require 'test/unit'
2
+ require '../lib/judojs.rb'
3
+
4
+ class TC_TestProject < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @test_project = Judojs::Project.new('MyApplication', 'js')
8
+ @path = File.dirname(__FILE__)
9
+ end
10
+
11
+ def test_can_initialize_project
12
+ assert_equal('myapplication', @test_project.app_filename, 'test_project.app_filename')
13
+ assert_equal('/Volumes/Storage/Development/judojs/tests/js/', @test_project.project_path, 'test_project.project_path')
14
+ assert_equal('MyApplication', @test_project.config.name, 'test_project.name')
15
+ assert_equal('expanded', @test_project.config.output, 'test_project.config.output')
16
+ assert_equal(Array.new, @test_project.config.autoload, 'test_project.config.autoload')
17
+ end
18
+
19
+ def test_can_init_with_config
20
+ test_project = Judojs::Project.init_with_config '/Volumes/Storage/Development/judojs/tests/js/'
21
+ assert_equal('myapplication', test_project.app_filename, 'test_project.app_filename')
22
+ assert_equal('/Volumes/Storage/Development/judojs/tests/js/', test_project.project_path, 'test_project.project_path')
23
+ assert_equal('MyApplication', test_project.config.name, 'test_project.name')
24
+ assert_equal('expanded', test_project.config.output, 'test_project.config.output')
25
+ assert_equal(Array.new, test_project.config.autoload, 'test_project.config.autoload')
26
+ end
27
+
28
+ def test_can_create_project
29
+ @test_project.create
30
+ assert(File.exists?("/Volumes/Storage/Development/judojs/tests/js"), 'project_dir was created successfully')
31
+ @test_project.manifest.each do |folder|
32
+ assert(File.exists?("/Volumes/Storage/Development/judojs/tests/js/#{folder}"), "#{folder} was created successfully")
33
+ end
34
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/judojs.conf'), 'judojs.conf was created successfully')
35
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/myapplication.js'), 'application/myapplication.js was created successfully')
36
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/lib/judojs.js'), 'lib/judosj.js was created successfully')
37
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/lib/utilities.js'), 'lib/utilities.js was created successfully')
38
+ assert(File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/index.html"), "tests/index.html was created successfully")
39
+ assert(File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.test.js"), "tests/judojs.test.js was created successfully")
40
+ assert(File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.utilities.test.js"), "tests/judo.utilities.test.js was created successfully")
41
+ end
42
+
43
+ def test_judo_conf_content
44
+ expected_conf_lib_file = File.open("/Volumes/Storage/Development/judo/tests/fixtures/judo.conf", "r")
45
+ judo_conf_file = File.open("/Volumes/Storage/Development/judo/tests/js/judo.conf", "r")
46
+ assert_equal(expected_conf_lib_file.readlines, judo_conf_file.readlines, "judo.conf file has correct contents")
47
+ judo_conf_file.close
48
+ expected_conf_lib_file.close
49
+ end
50
+
51
+ def test_judo_application_content
52
+ expected_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/myapplication.js", "r")
53
+ actual_file = File.open("/Volumes/Storage/Development/judojs/tests/js/application/myapplication.js", "r")
54
+ expected_content = expected_file.readlines
55
+ expected_content.shift
56
+ actual_content = actual_file.readlines
57
+ actual_content.shift
58
+ assert_equal(expected_content, actual_content, "myapplication.js file has correct contents")
59
+ actual_file.close
60
+ expected_file.close
61
+ end
62
+
63
+ def test_library_files_content
64
+ expected_judo_lib_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/judojs.js", "r")
65
+ judo_lib_file = File.open("/Volumes/Storage/Development/judojs/tests/js/lib/judojs.js", "r")
66
+ assert_equal(expected_judo_lib_file.readlines, judo_lib_file.readlines, "lib/judojs.js file has correct contents")
67
+ judo_lib_file.close
68
+ expected_judo_lib_file.close
69
+
70
+ expected_utility_lib_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/utilities.js", "r")
71
+ utility_lib_file = File.open("/Volumes/Storage/Development/judojs/tests/js/lib/utilities.js", "r")
72
+ assert_equal(expected_utility_lib_file.readlines, utility_lib_file.readlines, "lib/utilites.js file has correct contents")
73
+ utility_lib_file.close
74
+ expected_utility_lib_file.close
75
+ end
76
+
77
+ def test_can_initialize_configuration
78
+ test_config = Judojs::Configuration.new '/Volumes/Storage/Development/judojs/tests/js/', 'MyApplication'
79
+ test_config.read
80
+ assert_equal(test_config.project_path, '/Volumes/Storage/Development/judojs/tests/js/')
81
+ assert_equal('MyApplication', test_config.name, 'test_config.name')
82
+ assert_equal('myapplication', test_config.app_filename, 'test_config.app_filename')
83
+ assert_equal('expanded', test_config.output, 'test_config.output' )
84
+ assert_equal(Array.new, test_config.autoload, 'test_config.autoload')
85
+ end
86
+
87
+ def teardown
88
+
89
+ end
90
+
91
+ end
@@ -0,0 +1,70 @@
1
+ require 'test/unit'
2
+ require '../lib/judojs.rb'
3
+
4
+ class TC_TestProject < Test::Unit::TestCase
5
+
6
+ def setup
7
+
8
+ end
9
+
10
+ def test_can_update_project
11
+ @path = File.dirname(__FILE__)
12
+ File.copy("#{@path}/fixtures/global.module.js", "#{@path}/js/modules")
13
+ File.copy("#{@path}/fixtures/test.module.js", "#{@path}/js/modules")
14
+ File.copy("#{@path}/fixtures/test.elements.js", "#{@path}/js/elements")
15
+ File.copy("#{@path}/fixtures/test.model.js", "#{@path}/js/models")
16
+ File.copy("#{@path}/fixtures/update.judojs.conf", "#{@path}/js/judojs.conf")
17
+
18
+ @test_project = Judojs::Project.init_with_config('/Volumes/Storage/Development/judojs/tests/js/')
19
+ @test_project.update
20
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/global.js'), 'application/global.js created')
21
+ assert(File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/test.js'), 'application/test.js created')
22
+
23
+ expected_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/global.js", "r")
24
+ actual_file = File.open("/Volumes/Storage/Development/judojs/tests/js/application/global.js", "r")
25
+ expected_content = expected_file.readlines
26
+ actual_content = actual_file.readlines
27
+ assert_equal(expected_content, actual_content, "global.js file has correct contents")
28
+ actual_file.close
29
+ expected_file.close
30
+
31
+ expected_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/test.js", "r")
32
+ actual_file = File.open("/Volumes/Storage/Development/judojs/tests/js/application/test.js", "r")
33
+ expected_content = expected_file.readlines
34
+ actual_content = actual_file.readlines
35
+ assert_equal(expected_content, actual_content, "test.js file has correct contents")
36
+ actual_file.close
37
+ expected_file.close
38
+
39
+ expected_file = File.open("/Volumes/Storage/Development/judojs/tests/fixtures/update.judojs.conf", "r")
40
+ actual_file = File.open("/Volumes/Storage/Development/judojs/tests/js/judojs.conf", "r")
41
+ expected_content = expected_file.readlines
42
+ actual_content = actual_file.readlines
43
+ assert_equal(expected_content, actual_content, "test.js file has correct contents")
44
+ actual_file.close
45
+ expected_file.close
46
+ end
47
+
48
+ def teardown
49
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/judojs.conf') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/judojs.conf')
50
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/application/myapplication.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/myapplication.js')
51
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/application/global.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/global.js')
52
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/application/test.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/application/test.js')
53
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/elements/test.elements.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/elements/test.elements.js')
54
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/models/test.model.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/models/test.model.js')
55
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/lib/judojs.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/lib/judojs.js')
56
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/lib/utilities.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/lib/utilities.js')
57
+ File.delete("/Volumes/Storage/Development/judojs/tests/js/tests/index.html") if File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/index.html")
58
+ File.delete("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.test.js") if File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.test.js")
59
+ File.delete("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.utilities.test.js") if File.exists?("/Volumes/Storage/Development/judojs/tests/js/tests/judojs.utilities.test.js")
60
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/modules/global.module.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/modules/global.module.js')
61
+ File.delete('/Volumes/Storage/Development/judojs/tests/js/modules/test.module.js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js/modules/test.module.js')
62
+
63
+ @test_project.manifest.each do |folder|
64
+ Dir.delete("/Volumes/Storage/Development/judojs/tests/js/#{folder}") if File.exists? "/Volumes/Storage/Development/judojs/tests/js/#{folder}"
65
+ end
66
+
67
+ Dir.delete('/Volumes/Storage/Development/judojs/tests/js') if File.exists?('/Volumes/Storage/Development/judojs/tests/js')
68
+ end
69
+
70
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: judojs
3
+ version: !ruby/object:Gem::Version
4
+ hash: 63
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 2
10
+ version: 0.9.2
11
+ platform: ruby
12
+ authors:
13
+ - Dayton Nolan
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-25 00:00:00 -05:00
19
+ default_executable: bin/judojs
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: fssm
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: yaml
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: jsmin
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: sprockets
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ description: judojs is a javascript meta framework. judojs uses the Sprockets engine (http://getsprockets.org/) to allow you to create modular javascript applications.
78
+ email: daytonn@gmail.com
79
+ executables:
80
+ - judojs
81
+ - jpm
82
+ extensions: []
83
+
84
+ extra_rdoc_files: []
85
+
86
+ files:
87
+ - bin/jpm
88
+ - bin/judojs
89
+ - lib/judojs.rb
90
+ - lib/judojs/command.rb
91
+ - lib/judojs/configuration.rb
92
+ - lib/judojs/dependencies.rb
93
+ - lib/judojs/helpers.rb
94
+ - lib/judojs/jpm.rb
95
+ - lib/judojs/project.rb
96
+ - LICENSE.markdown
97
+ - repository/jquery/1.1.4.js
98
+ - repository/jquery/1.2.6.js
99
+ - repository/jquery/1.3.2.js
100
+ - repository/jquery/1.4.2.js
101
+ - repository/jquery/latest.js
102
+ - repository/judojs/core/existence.js
103
+ - repository/judojs/core/extend.js
104
+ - repository/judojs/core/judo.js
105
+ - repository/judojs/tests/index.html
106
+ - repository/judojs/tests/judojs.test.js
107
+ - repository/judojs/tests/judojs.utilities.test.js
108
+ - repository/judojs/utilities/all.js
109
+ - repository/judojs/utilities/array.js
110
+ - repository/judojs/utilities/string.js
111
+ - repository/modernizr/1.5.js
112
+ - repository/modernizr/latest.js
113
+ - repository/selectivizr/1.0.js
114
+ - repository/selectivizr/latest.js
115
+ - tests/jpm_test.rb
116
+ - tests/judo_test.rb
117
+ - tests/project_test.rb
118
+ - tests/update_test.rb
119
+ - tests/fixtures/global.js
120
+ - tests/fixtures/global.module.js
121
+ - tests/fixtures/judojs.conf
122
+ - tests/fixtures/myapplication.js
123
+ - tests/fixtures/test.elements.js
124
+ - tests/fixtures/test.js
125
+ - tests/fixtures/test.model.js
126
+ - tests/fixtures/test.module.js
127
+ - tests/fixtures/update.judojs.conf
128
+ - tests/fixtures/updated.myapplication.js
129
+ - tests/fixtures/utilities.js
130
+ has_rdoc: true
131
+ homepage: http://textnotspeech.github.com/judojs/
132
+ licenses: []
133
+
134
+ post_install_message:
135
+ rdoc_options: []
136
+
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ requirements: []
158
+
159
+ rubyforge_project:
160
+ rubygems_version: 1.3.7
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: judojs is a command line application to help you write clean, modular javascript applications.
164
+ test_files: []
165
+