social_cheesecake 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +2 -0
  2. data/Rakefile +111 -0
  3. data/app/assets/javascripts/kinetic.js +448 -407
  4. data/app/assets/javascripts/social_cheesecake.js +1 -2
  5. data/app/assets/javascripts/socialcheesecake/_header.js +28 -0
  6. data/app/assets/javascripts/socialcheesecake/actor.js +104 -41
  7. data/app/assets/javascripts/socialcheesecake/cheesecake.js +26 -31
  8. data/app/assets/javascripts/socialcheesecake/grid.js +53 -12
  9. data/app/assets/javascripts/socialcheesecake/sector.js +108 -93
  10. data/app/assets/javascripts/socialcheesecake/text.js +39 -36
  11. data/lib/generators/social_cheesecake/install_generator.rb +10 -0
  12. data/lib/social_cheesecake/version.rb +1 -1
  13. data/social_cheesecake.gemspec +1 -0
  14. data/test/dummy/.gitignore +15 -0
  15. data/test/dummy/Gemfile +34 -0
  16. data/test/dummy/README +261 -0
  17. data/test/dummy/Rakefile +7 -0
  18. data/test/dummy/app/assets/images/beatriz.png +0 -0
  19. data/test/dummy/app/assets/images/rails.png +0 -0
  20. data/test/dummy/app/assets/images/youngAlberto.png +0 -0
  21. data/test/dummy/app/assets/javascripts/application.js +10 -0
  22. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  23. data/test/dummy/app/controllers/application_controller.rb +3 -0
  24. data/test/dummy/app/helpers/application_helper.rb +2 -0
  25. data/test/dummy/app/mailers/.gitkeep +0 -0
  26. data/test/dummy/app/models/.gitkeep +0 -0
  27. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/test/dummy/config/application.rb +48 -0
  29. data/test/dummy/config/boot.rb +6 -0
  30. data/test/dummy/config/database.yml +25 -0
  31. data/test/dummy/config/environment.rb +5 -0
  32. data/test/dummy/config/environments/development.rb +30 -0
  33. data/test/dummy/config/environments/production.rb +60 -0
  34. data/test/dummy/config/environments/test.rb +39 -0
  35. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/test/dummy/config/initializers/inflections.rb +10 -0
  37. data/test/dummy/config/initializers/mime_types.rb +5 -0
  38. data/test/dummy/config/initializers/secret_token.rb +7 -0
  39. data/test/dummy/config/initializers/session_store.rb +8 -0
  40. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  41. data/test/dummy/config/locales/en.yml +5 -0
  42. data/test/dummy/config/routes.rb +58 -0
  43. data/test/dummy/config.ru +4 -0
  44. data/test/dummy/db/seeds.rb +7 -0
  45. data/test/dummy/doc/README_FOR_APP +2 -0
  46. data/test/dummy/lib/assets/.gitkeep +0 -0
  47. data/test/dummy/lib/tasks/.gitkeep +0 -0
  48. data/test/dummy/log/.gitkeep +0 -0
  49. data/test/dummy/public/404.html +26 -0
  50. data/test/dummy/public/422.html +26 -0
  51. data/test/dummy/public/500.html +26 -0
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/dummy/public/index.html +133 -0
  54. data/test/dummy/public/robots.txt +5 -0
  55. data/test/dummy/script/rails +6 -0
  56. data/test/dummy/test/fixtures/.gitkeep +0 -0
  57. data/test/dummy/test/functional/.gitkeep +0 -0
  58. data/test/dummy/test/integration/.gitkeep +0 -0
  59. data/test/dummy/test/performance/browsing_test.rb +12 -0
  60. data/test/dummy/test/test_helper.rb +13 -0
  61. data/test/dummy/test/unit/.gitkeep +0 -0
  62. data/test/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  63. data/test/dummy/vendor/plugins/.gitkeep +0 -0
  64. metadata +114 -29
  65. data/app/assets/javascripts/socialCheesecake.js +0 -161
@@ -1,161 +0,0 @@
1
- var socialCheesecake = socialCheesecake || {};
2
-
3
- (function() {
4
- var scripts = document.head.getElementsByTagName('script');
5
- var rootPath = null;
6
- for(var i in scripts){
7
- if((scripts[i].getAttribute)&&(scripts[i].getAttribute('src').match("socialCheesecake.js"))){
8
- rootPath = scripts[i].getAttribute('src').replace("socialCheesecake.js", "");
9
- }else if((scripts[i].getAttribute)&&(scripts[i].getAttribute('src').match("application.js"))){
10
- //In case you are using rails, a compiled application.js is required instead of socialCheesecake.js
11
- rootPath = scripts[i].getAttribute('src').replace("application.js", "");
12
- }
13
- }
14
- if((rootPath)||(rootPath=="")){
15
- rootPath = rootPath.replace(/\s/g, "");
16
- if(rootPath==""){
17
- var href = document.location.href;
18
- rootPath = href.slice(0, href.lastIndexOf("/")+1);
19
- }
20
- }
21
- socialCheesecake = {
22
- modules : {},
23
- currentModule : undefined,
24
- moduleQueue : [],
25
- rootPath : rootPath || 'static/',
26
- log: function(message, level){
27
- var now = new Date();
28
- var timestamp = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + "," + now.getMilliseconds();
29
- if(level!=undefined){
30
- level=level.toUpperCase() + ": ";
31
- }else{
32
- level="";
33
- }
34
- console.log("#" + timestamp + " >> " + level + message)
35
- },
36
- defineModule : function(name) {
37
- if(socialCheesecake.modules[name] && socialCheesecake.modules[name].isDefined()) {
38
- socialCheesecake.log("You are redefining module '" + name + "'. This may break the game.", "warning");
39
- }
40
- socialCheesecake.currentModule = new socialCheesecake.Module(name);
41
- socialCheesecake.modules[name] = socialCheesecake.currentModule;
42
- socialCheesecake.moduleQueue.push(socialCheesecake.currentModule);
43
- return socialCheesecake;
44
- },
45
- dependsOn : function() {
46
- socialCheesecake.currentModule.dependencies = [].splice.call(arguments, 0);
47
- if(socialCheesecake.currentModule.isDefined()) {
48
- socialCheesecake._activateModules();
49
- } else {
50
- return socialCheesecake;
51
- }
52
- },
53
- withCode : function(code) {
54
- socialCheesecake.currentModule.code = code;
55
- if(socialCheesecake.currentModule.isDefined()) {
56
- socialCheesecake._activateModules();
57
- } else {
58
- return socialCheesecake;
59
- }
60
- },
61
- _downloadModule : function(name, origin) {
62
- if(socialCheesecake.modules[name] == undefined) {
63
- socialCheesecake.modules[name] = new socialCheesecake.Module(name);
64
- }
65
-
66
- var scriptTag = document.createElement("script");
67
- scriptTag.type = 'text/javascript';
68
- scriptTag.src = socialCheesecake.rootPath + name.toLowerCase().split("#").join("/") + '.js';
69
- scriptTag.onload = function() {
70
- socialCheesecake.log(name + " module downloaded.")
71
- socialCheesecake._activateModules();
72
- };
73
- scriptTag.onerror = function() {
74
- throw ('Module ' + name + ' (' + scriptTag.src + ') required from ' + origin + ' failed to load.');
75
- };
76
- document.getElementsByTagName("head")[0].appendChild(scriptTag);
77
- },
78
- _activateModules : function() {
79
- var modsReady = false;
80
- for(var i in socialCheesecake.moduleQueue) {
81
- var mod = socialCheesecake.moduleQueue[i];
82
- var depsReady = true;
83
-
84
- for(var j in mod.dependencies) {
85
- var depName = mod.dependencies[j];
86
- if(!socialCheesecake.modules[depName]) {
87
- depsReady = false;
88
- socialCheesecake._downloadModule(depName, mod.name);
89
- } else if(!socialCheesecake.modules[depName].ready) {
90
- depsReady = false;
91
- }
92
- }
93
-
94
- if(depsReady && mod.isDefined()) {
95
- socialCheesecake.moduleQueue.splice(i, 1);
96
- mod.ready = true;
97
- mod.execute();
98
- modsReady = true;
99
- i--;
100
- }
101
- }
102
-
103
- if(modsReady) {
104
- socialCheesecake._activateModules();
105
- }
106
-
107
- // Check everything correct
108
- }
109
- }
110
-
111
- /*************************************************************************************************
112
- * SocialCheesecake Module prototype
113
- *************************************************************************************************/
114
- socialCheesecake.Module = function(name) {
115
- this.name = name;
116
- this.dependencies = [];
117
- this.code = undefined;
118
- this.ready = false;
119
- }
120
- socialCheesecake.Module.prototype.isDefined = function() {
121
- return this.code != undefined;
122
- }
123
- socialCheesecake.Module.prototype.execute = function() {
124
- if(this.isDefined()){
125
- socialCheesecake.log(this.name + " module executed.");
126
- return this.code();
127
- }else{
128
- throw(this.name + " module is undefined and can't be executed.'");
129
- }
130
- }
131
- })();
132
-
133
- socialCheesecake.defineModule(
134
- 'SocialCheesecake#SocialCheesecake'
135
- )
136
- .dependsOn(
137
- 'SocialCheesecake#Actor',
138
- 'SocialCheesecake#Cheesecake',
139
- 'SocialCheesecake#Grid',
140
- 'SocialCheesecake#Sector',
141
- 'SocialCheesecake#Text'
142
- )
143
- .withCode(function() {
144
-
145
- });
146
-
147
- /*
148
- socialCheesecake.defineModule(
149
- 'SocialCheesecake#X'
150
- )
151
- .dependsOn(
152
-
153
- )
154
- .withCode(function() {
155
-
156
- });
157
- */
158
-
159
-
160
-
161
-