appjs-rails 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +15 -1
- data/Rakefile +2 -0
- data/app/assets/images/MnyxU.gif +0 -0
- data/app/assets/javascripts/app.js +25 -5
- data/appjs-rails.gemspec +4 -0
- data/lib/appjs/rails/version.rb +1 -1
- data/spec/javascripts/appSpec.js +15 -0
- data/spec/javascripts/support/jasmine.yml +113 -0
- data/spec/javascripts/support/jasmine_helper.rb +11 -0
- metadata +43 -4
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Appjs::Rails
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/appjs-rails.png)](http://badge.fury.io/rb/appjs-rails)
|
2
3
|
|
3
4
|
The additional library for javaScript
|
4
5
|
|
@@ -18,8 +19,10 @@ Or install it yourself as:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
22
|
+
Creation new singleton
|
23
|
+
|
21
24
|
```javascript
|
22
|
-
app.
|
25
|
+
app._addSingleton('example', function() {
|
23
26
|
return {
|
24
27
|
toString: 'Class Example'
|
25
28
|
}
|
@@ -27,3 +30,14 @@ app.addClass('Example', function() {
|
|
27
30
|
app.example.init();
|
28
31
|
app.example.toString; // 'Class Example'
|
29
32
|
```
|
33
|
+
Generaion UUID
|
34
|
+
|
35
|
+
```javascript
|
36
|
+
app._uuid(); //6b644386-6ccb-98af-1144-6b8de194387a
|
37
|
+
```
|
38
|
+
|
39
|
+
# License
|
40
|
+
|
41
|
+
appjs-rails uses the MIT license. Please check the [LICENSE][] file for more details.
|
42
|
+
|
43
|
+
[license]: https://github.com/raglub/appjs-rails/blob/master/LICENSE
|
data/Rakefile
CHANGED
Binary file
|
@@ -1,6 +1,26 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
app
|
4
|
-
|
5
|
-
|
6
|
-
}
|
3
|
+
var app = (function() {
|
4
|
+
var s4 = function () {
|
5
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
6
|
+
};
|
7
|
+
|
8
|
+
return {
|
9
|
+
_addSingleton: function(name, fn) {
|
10
|
+
app[name] = fn;
|
11
|
+
app[name].init = function(){ };
|
12
|
+
},
|
13
|
+
// free generator http://ajaxload.info/
|
14
|
+
_ajax: {
|
15
|
+
addEvent: {
|
16
|
+
lockAfterClick: function() {
|
17
|
+
$("a[data-remote='true']").bind('ajax:')
|
18
|
+
}
|
19
|
+
}
|
20
|
+
},
|
21
|
+
_uuid: function(){
|
22
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
})();
|
data/appjs-rails.gemspec
CHANGED
@@ -19,5 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "jasmine"
|
23
|
+
spec.add_development_dependency "rails", '>= 3.0.0'
|
22
24
|
spec.add_development_dependency "rake"
|
23
25
|
end
|
26
|
+
|
27
|
+
|
data/lib/appjs/rails/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
describe("app", function() {
|
2
|
+
|
3
|
+
beforeEach(function() {
|
4
|
+
app._addSingleton('example', function(){});
|
5
|
+
});
|
6
|
+
|
7
|
+
it("should be able to create example singleton", function() {
|
8
|
+
expect(app.example).not.toEqual(undefined);
|
9
|
+
});
|
10
|
+
|
11
|
+
it("should generate an uuid", function() {
|
12
|
+
expect(app._uuid()).toMatch(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/);
|
13
|
+
});
|
14
|
+
|
15
|
+
});
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- public/javascripts/**/*.js
|
15
|
+
- app/assets/javascripts/**/*.js
|
16
|
+
|
17
|
+
# stylesheets
|
18
|
+
#
|
19
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
20
|
+
# Default: []
|
21
|
+
#
|
22
|
+
# EXAMPLE:
|
23
|
+
#
|
24
|
+
# stylesheets:
|
25
|
+
# - css/style.css
|
26
|
+
# - stylesheets/*.css
|
27
|
+
#
|
28
|
+
stylesheets:
|
29
|
+
- stylesheets/**/*.css
|
30
|
+
|
31
|
+
# helpers
|
32
|
+
#
|
33
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
34
|
+
# Default: ["helpers/**/*.js"]
|
35
|
+
#
|
36
|
+
# EXAMPLE:
|
37
|
+
#
|
38
|
+
# helpers:
|
39
|
+
# - helpers/**/*.js
|
40
|
+
#
|
41
|
+
helpers:
|
42
|
+
- 'helpers/**/*.js'
|
43
|
+
|
44
|
+
# spec_files
|
45
|
+
#
|
46
|
+
# Return an array of filepaths relative to spec_dir to include.
|
47
|
+
# Default: ["**/*[sS]pec.js"]
|
48
|
+
#
|
49
|
+
# EXAMPLE:
|
50
|
+
#
|
51
|
+
# spec_files:
|
52
|
+
# - **/*[sS]pec.js
|
53
|
+
#
|
54
|
+
spec_files:
|
55
|
+
- '**/*[sS]pec.js'
|
56
|
+
|
57
|
+
# src_dir
|
58
|
+
#
|
59
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
60
|
+
# Default: project root
|
61
|
+
#
|
62
|
+
# EXAMPLE:
|
63
|
+
#
|
64
|
+
# src_dir: public
|
65
|
+
#
|
66
|
+
src_dir:
|
67
|
+
|
68
|
+
# spec_dir
|
69
|
+
#
|
70
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
71
|
+
# Default: spec/javascripts
|
72
|
+
#
|
73
|
+
# EXAMPLE:
|
74
|
+
#
|
75
|
+
# spec_dir: spec/javascripts
|
76
|
+
#
|
77
|
+
spec_dir:
|
78
|
+
|
79
|
+
# spec_helper
|
80
|
+
#
|
81
|
+
# Ruby file that Jasmine server will require before starting.
|
82
|
+
# Returned relative to your root path
|
83
|
+
# Default spec/javascripts/support/jasmine_helper.rb
|
84
|
+
#
|
85
|
+
# EXAMPLE:
|
86
|
+
#
|
87
|
+
# spec_helper: spec/javascripts/support/jasmine_helper.rb
|
88
|
+
#
|
89
|
+
spec_helper: spec/javascripts/support/jasmine_helper.rb
|
90
|
+
|
91
|
+
# boot_dir
|
92
|
+
#
|
93
|
+
# Boot directory path. Your boot_files must be returned relative to this path.
|
94
|
+
# Default: Built in boot file
|
95
|
+
#
|
96
|
+
# EXAMPLE:
|
97
|
+
#
|
98
|
+
boot_dir: spec/javascripts/support/boot
|
99
|
+
#
|
100
|
+
boot_dir:
|
101
|
+
|
102
|
+
# boot_files
|
103
|
+
#
|
104
|
+
# Return an array of filepaths relative to boot_dir to include in order to boot Jasmine
|
105
|
+
# Default: Built in boot file
|
106
|
+
#
|
107
|
+
# EXAMPLE
|
108
|
+
#
|
109
|
+
# boot_files:
|
110
|
+
# - '**/*.js'
|
111
|
+
|
112
|
+
boot_files:
|
113
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#Use this file to set/override Jasmine configuration options
|
2
|
+
#You can remove it if you don't need it.
|
3
|
+
#This file is loaded *after* jasmine.yml is interpreted.
|
4
|
+
#
|
5
|
+
#Example: using a different boot file.
|
6
|
+
#Jasmine.configure do |config|
|
7
|
+
# config.boot_dir = '/absolute/path/to/boot_dir'
|
8
|
+
# config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -27,6 +27,38 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jasmine
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
30
62
|
- !ruby/object:Gem::Dependency
|
31
63
|
name: rake
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,13 +84,17 @@ extra_rdoc_files: []
|
|
52
84
|
files:
|
53
85
|
- .gitignore
|
54
86
|
- Gemfile
|
55
|
-
- LICENSE
|
87
|
+
- LICENSE
|
56
88
|
- README.md
|
57
89
|
- Rakefile
|
90
|
+
- app/assets/images/MnyxU.gif
|
58
91
|
- app/assets/javascripts/app.js
|
59
92
|
- appjs-rails.gemspec
|
60
93
|
- lib/appjs/rails.rb
|
61
94
|
- lib/appjs/rails/version.rb
|
95
|
+
- spec/javascripts/appSpec.js
|
96
|
+
- spec/javascripts/support/jasmine.yml
|
97
|
+
- spec/javascripts/support/jasmine_helper.rb
|
62
98
|
homepage: https://github.com/raglub/appjs-rails
|
63
99
|
licenses:
|
64
100
|
- MIT
|
@@ -84,4 +120,7 @@ rubygems_version: 1.8.25
|
|
84
120
|
signing_key:
|
85
121
|
specification_version: 3
|
86
122
|
summary: Library for javaScript.
|
87
|
-
test_files:
|
123
|
+
test_files:
|
124
|
+
- spec/javascripts/appSpec.js
|
125
|
+
- spec/javascripts/support/jasmine.yml
|
126
|
+
- spec/javascripts/support/jasmine_helper.rb
|