appjs-rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Appjs::Rails
2
2
  [![Gem Version](https://badge.fury.io/rb/appjs-rails.png)](http://badge.fury.io/rb/appjs-rails)
3
+ [![Dependency Status](https://gemnasium.com/raglub/appjs-rails.png)](https://gemnasium.com/raglub/appjs-rails)
3
4
 
4
5
  The additional library for javaScript
5
6
 
@@ -19,10 +20,14 @@ Or install it yourself as:
19
20
 
20
21
  ## Usage
21
22
 
23
+ The app file will be added to the asset pipeline when you in file ```app/assets/javascripts/application.js``` add this line:
24
+
25
+ //= require app
26
+
22
27
  Creation new singleton
23
28
 
24
29
  ```javascript
25
- app._addSingleton('example', function() {
30
+ app._singleton.add('example', function() {
26
31
  return {
27
32
  toString: 'Class Example'
28
33
  }
@@ -30,7 +35,7 @@ app._addSingleton('example', function() {
30
35
  app.example.init();
31
36
  app.example.toString; // 'Class Example'
32
37
  ```
33
- Generaion UUID
38
+ Generation UUID
34
39
 
35
40
  ```javascript
36
41
  app._uuid(); //6b644386-6ccb-98af-1144-6b8de194387a
@@ -5,10 +5,25 @@ var app = (function() {
5
5
  return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
6
6
  };
7
7
 
8
+ var singletons = []
9
+
8
10
  return {
9
- _addSingleton: function(name, fn) {
10
- app[name] = fn;
11
- app[name].init = function(){ };
11
+ _singleton: {
12
+ add: function(name, fn) {
13
+ app[name] = fn;
14
+ singletons.push(name);
15
+ app[name].init = function(){
16
+ app[name] = app[name]();
17
+ if(app[name] == undefined) {
18
+ app[name] = {};
19
+ }
20
+ app[name].init = function(){
21
+ return app[name];
22
+ }
23
+ return app[name];
24
+ };
25
+ },
26
+ defined: singletons
12
27
  },
13
28
  // free generator http://ajaxload.info/
14
29
  _ajax: {
@@ -22,5 +37,4 @@ var app = (function() {
22
37
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
23
38
  }
24
39
  }
25
-
26
40
  })();
data/lib/appjs/rails.rb CHANGED
@@ -1,7 +1,8 @@
1
+ require "appjs/rails/engine"
1
2
  require "appjs/rails/version"
2
3
 
3
4
  module Appjs
4
5
  module Rails
5
- # Your code goes here...
6
+
6
7
  end
7
8
  end
@@ -0,0 +1,8 @@
1
+ # Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
2
+ # get the minified version of the scripts included into the layout in production.
3
+ module Appjs
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  module Appjs
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  describe("app", function() {
2
2
 
3
3
  beforeEach(function() {
4
- app._addSingleton('example', function(){});
4
+ app._singleton.add('example', function(){});
5
5
  });
6
6
 
7
7
  it("should be able to create example singleton", function() {
@@ -9,3 +9,5 @@
9
9
  #end
10
10
  #
11
11
 
12
+ # rake jasmine
13
+ # http://localhost:8888
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: 1.0.0
4
+ version: 1.0.1
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-20 00:00:00.000000000 Z
12
+ date: 2014-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -91,6 +91,7 @@ files:
91
91
  - app/assets/javascripts/app.js
92
92
  - appjs-rails.gemspec
93
93
  - lib/appjs/rails.rb
94
+ - lib/appjs/rails/engine.rb
94
95
  - lib/appjs/rails/version.rb
95
96
  - spec/javascripts/appSpec.js
96
97
  - spec/javascripts/support/jasmine.yml