jim 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/HISTORY +28 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +2 -1
  4. data/jim.gemspec +67 -9
  5. data/lib/jim/bundler.rb +14 -11
  6. data/lib/jim/cli.rb +51 -9
  7. data/lib/jim/index.rb +3 -7
  8. data/lib/jim/installer.rb +140 -22
  9. data/lib/jim/templates/commands +21 -6
  10. data/lib/jim/version_parser.rb +2 -3
  11. data/lib/jim.rb +19 -2
  12. data/test/fixtures/jimfile +3 -3
  13. data/test/fixtures/sammy-0.5.0/HISTORY.md +135 -0
  14. data/test/fixtures/sammy-0.5.0/LICENSE +22 -0
  15. data/test/fixtures/sammy-0.5.0/README.md +81 -0
  16. data/test/fixtures/sammy-0.5.0/Rakefile +174 -0
  17. data/test/fixtures/sammy-0.5.0/examples/backend/README.md +23 -0
  18. data/test/fixtures/sammy-0.5.0/examples/backend/Rakefile +15 -0
  19. data/test/fixtures/sammy-0.5.0/examples/backend/app.rb +17 -0
  20. data/test/fixtures/sammy-0.5.0/examples/backend/app.ru +3 -0
  21. data/test/fixtures/sammy-0.5.0/examples/backend/public/javascripts/app.js +106 -0
  22. data/test/fixtures/sammy-0.5.0/examples/backend/public/javascripts/jquery.cloudkit.js +840 -0
  23. data/test/fixtures/sammy-0.5.0/examples/backend/public/javascripts/jquery.js +19 -0
  24. data/test/fixtures/sammy-0.5.0/examples/backend/public/javascripts/sammy.js +1013 -0
  25. data/test/fixtures/sammy-0.5.0/examples/backend/public/templates/index.html.erb +11 -0
  26. data/test/fixtures/sammy-0.5.0/examples/backend/public/templates/task.html.erb +4 -0
  27. data/test/fixtures/sammy-0.5.0/examples/backend/public/templates/task_details.html.erb +4 -0
  28. data/test/fixtures/sammy-0.5.0/examples/backend/views/app.sass +63 -0
  29. data/test/fixtures/sammy-0.5.0/examples/backend/views/index.haml +18 -0
  30. data/test/fixtures/sammy-0.5.0/examples/form_handling/files/form.html +12 -0
  31. data/test/fixtures/sammy-0.5.0/examples/form_handling/index.html +65 -0
  32. data/test/fixtures/sammy-0.5.0/examples/hello_world/index.html +50 -0
  33. data/test/fixtures/sammy-0.5.0/examples/location_override/README.md +15 -0
  34. data/test/fixtures/sammy-0.5.0/examples/location_override/data.html +110 -0
  35. data/test/fixtures/sammy-0.5.0/examples/location_override/index.html +79 -0
  36. data/test/fixtures/sammy-0.5.0/examples/location_override/test.html +121 -0
  37. data/test/fixtures/sammy-0.5.0/lib/min/sammy-0.5.0.min.js +5 -0
  38. data/test/fixtures/sammy-0.5.0/lib/min/sammy-lastest.min.js +5 -0
  39. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.cache.js +117 -0
  40. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.haml.js +539 -0
  41. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.json.js +362 -0
  42. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.mustache.js +415 -0
  43. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.nested_params.js +118 -0
  44. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.storage.js +515 -0
  45. data/test/fixtures/sammy-0.5.0/lib/plugins/sammy.template.js +117 -0
  46. data/test/fixtures/sammy-0.5.0/lib/sammy.js +1367 -0
  47. data/test/fixtures/sammy-0.5.0/test/fixtures/partial +1 -0
  48. data/test/fixtures/sammy-0.5.0/test/fixtures/partial.html +1 -0
  49. data/test/fixtures/sammy-0.5.0/test/fixtures/partial.noengine +1 -0
  50. data/test/fixtures/sammy-0.5.0/test/fixtures/partial.template +1 -0
  51. data/test/fixtures/sammy-0.5.0/test/index.html +84 -0
  52. data/test/fixtures/sammy-0.5.0/test/test_sammy_application.js +953 -0
  53. data/test/fixtures/sammy-0.5.0/test/test_sammy_event_context.js +252 -0
  54. data/test/fixtures/sammy-0.5.0/test/test_sammy_location_proxy.js +91 -0
  55. data/test/fixtures/sammy-0.5.0/test/test_sammy_plugins.js +296 -0
  56. data/test/fixtures/sammy-0.5.0/test/test_sammy_storage.js +175 -0
  57. data/test/fixtures/sammy-0.5.0/test/test_server +27 -0
  58. data/test/fixtures/sammy-0.5.0/vendor/jquery-1.4.1.js +6078 -0
  59. data/test/fixtures/sammy-0.5.0/vendor/jquery-1.4.1.min.js +152 -0
  60. data/test/fixtures/sammy-0.5.0/vendor/jsdoc/doc.haml +58 -0
  61. data/test/fixtures/sammy-0.5.0/vendor/jsdoc/jsdoc.rb +143 -0
  62. data/test/fixtures/sammy-0.5.0/vendor/jslitmus.js +670 -0
  63. data/test/fixtures/sammy-0.5.0/vendor/qunit/qunit.css +119 -0
  64. data/test/fixtures/sammy-0.5.0/vendor/qunit/qunit.js +1043 -0
  65. data/test/fixtures/sammy-0.5.0/vendor/qunit-spec.js +127 -0
  66. data/test/helper.rb +23 -3
  67. data/test/test_jim_bundler.rb +9 -8
  68. data/test/test_jim_cli.rb +21 -12
  69. data/test/test_jim_installer.rb +152 -35
  70. data/test/test_jim_version_parser.rb +4 -0
  71. metadata +117 -27
  72. data/.document +0 -5
@@ -0,0 +1,106 @@
1
+ ;(function($) {
2
+ var app = new Sammy.Application(function() { with(this) {
3
+ element_selector = '#main';
4
+
5
+ var db, db_loaded;
6
+ db = null;
7
+ db_loaded = false;
8
+
9
+ before(function() { with(this) {
10
+ if (!db_loaded) {
11
+ redirect('#/connecting');
12
+ return false;
13
+ }
14
+ }});
15
+
16
+ // display tasks
17
+ get('#/', function() { with (this) {
18
+ partial('/templates/index.html.erb', function(html) {
19
+ $('#main').html(html);
20
+ this.each(db.collection('tasks').all(), function(i, task) {
21
+ this.log('task', task.json());
22
+ this.partial('/templates/task.html.erb', {task: task}, function(task_html) {
23
+ $(task_html).data('task', task).prependTo('#tasks');
24
+ });
25
+ });
26
+ });
27
+ }});
28
+
29
+ get('#/tasks/:id', function() { with(this) {
30
+ this.task = db.collection('tasks').get(params['id']).json();
31
+ this.partial('/templates/task_details.html.erb')
32
+ }});
33
+
34
+ post('#/tasks', function() { with(this) {
35
+ var context = this;
36
+ var task = {
37
+ entry: params['entry'],
38
+ completed: false,
39
+ created_at: Date()
40
+ };
41
+ db.collection('tasks').create(task, {
42
+ success: function(task) {
43
+ context.partial('/templates/task.html.erb', {task: task}, function(task_html) {
44
+ $('#tasks').prepend(task_html);
45
+ });
46
+ // clear the form
47
+ $('.entry').val('');
48
+ },
49
+ error: function() {
50
+ context.trigger('error', {message: 'Sorry, could not save your task.'})
51
+ }
52
+ });
53
+ return false;
54
+ }});
55
+
56
+ get('#/connecting', function() { with(this) {
57
+ $('#main').html('<span class="loading">... Loading ...</span>');
58
+ }});
59
+
60
+ bind('task-toggle', function(e, data) { with(this) {
61
+ this.log('data', data)
62
+ var $task = data.$task;
63
+ this.task = db.collection('tasks').get($task.attr('id'));
64
+ this.task.attr('completed', function() { return (this == true ? false : true); });
65
+ this.task.update({}, {
66
+ success: function() {
67
+ $task.toggleClass('completed');
68
+ }
69
+ });
70
+ }});
71
+
72
+ bind('run', function() {
73
+ var context = this;
74
+ db = $.cloudkit;
75
+ db.boot({
76
+ success: function() {
77
+ db_loaded = true;
78
+ context.trigger('db-loaded');
79
+ },
80
+ failure: function() {
81
+ db_loaded = false;
82
+ context.trigger('error', {message: 'Could not connect to CloudKit.'})
83
+ }
84
+ });
85
+
86
+ $('li.task :checkbox').live('click', function() {
87
+ var $task = $(this).parents('.task');
88
+ context.trigger('task-toggle', {$task: $task});
89
+ });
90
+ });
91
+
92
+ bind('db-loaded', function() { with(this) {
93
+ redirect('#/')
94
+ }});
95
+
96
+ bind('error', function(e, data) { with(this) {
97
+ render('text', '#error', data.message).show();
98
+ }});
99
+
100
+
101
+ }});
102
+
103
+ $(function() {
104
+ app.run('#/');
105
+ })
106
+ })(jQuery);