emberjs-couchapp 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +36 -0
  4. data/LICENSE +13 -0
  5. data/README.md +52 -0
  6. data/Rakefile +17 -0
  7. data/bin/emberjs-couchapp +5 -0
  8. data/emberjs-couchapp.gemspec +23 -0
  9. data/lib/emberjs-couchapp.rb +5 -0
  10. data/lib/emberjs-couchapp/app_generator.rb +25 -0
  11. data/lib/emberjs-couchapp/cli.rb +13 -0
  12. data/lib/emberjs-couchapp/templates/app/.couchappignore +7 -0
  13. data/lib/emberjs-couchapp/templates/app/.couchapprc.tt +10 -0
  14. data/lib/emberjs-couchapp/templates/app/.gitignore +3 -0
  15. data/lib/emberjs-couchapp/templates/app/Assetfile.tt +136 -0
  16. data/lib/emberjs-couchapp/templates/app/Gemfile +19 -0
  17. data/lib/emberjs-couchapp/templates/app/Guardfile +3 -0
  18. data/lib/emberjs-couchapp/templates/app/LICENSE +13 -0
  19. data/lib/emberjs-couchapp/templates/app/README.md +58 -0
  20. data/lib/emberjs-couchapp/templates/app/Rakefile.tt +34 -0
  21. data/lib/emberjs-couchapp/templates/app/_id.tt +1 -0
  22. data/lib/emberjs-couchapp/templates/app/app/css/bootstrap.css +4983 -0
  23. data/lib/emberjs-couchapp/templates/app/app/css/main.css +11 -0
  24. data/lib/emberjs-couchapp/templates/app/app/index.html.tt +24 -0
  25. data/lib/emberjs-couchapp/templates/app/app/lib/controllers/.empty_directory +0 -0
  26. data/lib/emberjs-couchapp/templates/app/app/lib/core.js.tt +11 -0
  27. data/lib/emberjs-couchapp/templates/app/app/lib/ext.js.tt +20 -0
  28. data/lib/emberjs-couchapp/templates/app/app/lib/main.js.tt +3 -0
  29. data/lib/emberjs-couchapp/templates/app/app/lib/models/.empty_directory +0 -0
  30. data/lib/emberjs-couchapp/templates/app/app/lib/state_manager.js.tt +11 -0
  31. data/lib/emberjs-couchapp/templates/app/app/lib/states/start.js.tt +9 -0
  32. data/lib/emberjs-couchapp/templates/app/app/lib/store.js.tt +5 -0
  33. data/lib/emberjs-couchapp/templates/app/app/lib/views/.empty_directory +0 -0
  34. data/lib/emberjs-couchapp/templates/app/app/modules/.empty_directory +0 -0
  35. data/lib/emberjs-couchapp/templates/app/app/plugins/loader.js +60 -0
  36. data/lib/emberjs-couchapp/templates/app/app/static/img/glyphicons-halflings-white.png +0 -0
  37. data/lib/emberjs-couchapp/templates/app/app/static/img/glyphicons-halflings.png +0 -0
  38. data/lib/emberjs-couchapp/templates/app/app/templates/main_page.handlebars.tt +1 -0
  39. data/lib/emberjs-couchapp/templates/app/app/tests/%name%_tests.js.tt +5 -0
  40. data/lib/emberjs-couchapp/templates/app/app/vendor/ember-data.js +3787 -0
  41. data/lib/emberjs-couchapp/templates/app/app/vendor/ember.js +20148 -0
  42. data/lib/emberjs-couchapp/templates/app/app/vendor/jquery.js +9404 -0
  43. data/lib/emberjs-couchapp/templates/app/config.ru.tt +18 -0
  44. data/lib/emberjs-couchapp/templates/app/couchapp.json.tt +4 -0
  45. data/lib/emberjs-couchapp/templates/app/filters/my_filter.js +3 -0
  46. data/lib/emberjs-couchapp/templates/app/language +1 -0
  47. data/lib/emberjs-couchapp/templates/app/lists/my_list.js +3 -0
  48. data/lib/emberjs-couchapp/templates/app/shows/my_show.js +3 -0
  49. data/lib/emberjs-couchapp/templates/app/tests/index.html +42 -0
  50. data/lib/emberjs-couchapp/templates/app/tests/qunit/qunit.css +235 -0
  51. data/lib/emberjs-couchapp/templates/app/tests/qunit/qunit.js +1669 -0
  52. data/lib/emberjs-couchapp/templates/app/tests/run-tests.js +93 -0
  53. data/lib/emberjs-couchapp/templates/app/views/my_view/map.js +3 -0
  54. data/lib/emberjs-couchapp/templates/app/views/my_view/reduce.js +3 -0
  55. data/lib/emberjs-couchapp/version.rb +3 -0
  56. data/spec/ember/cli_spec.rb +128 -0
  57. data/spec/spec_helper.rb +44 -0
  58. metadata +175 -0
@@ -0,0 +1,93 @@
1
+ // PhantomJS QUnit Test Runner
2
+
3
+ var args = phantom.args;
4
+ if (args.length < 1 || args.length > 2) {
5
+ console.log("Usage: " + phantom.scriptName + " <URI> <timeout>");
6
+ phantom.exit(1);
7
+ }
8
+
9
+ var page = require('webpage').create();
10
+
11
+ var depRe = /^DEPRECATION:/;
12
+ page.onConsoleMessage = function(msg) {
13
+ if (!depRe.test(msg)) console.log(msg);
14
+ };
15
+
16
+ var uri = args[0];
17
+ page.open(uri, function(status) {
18
+ if (status !== 'success') {
19
+ console.error("Unable to access: " + uri + " [" + status + "]");
20
+ phantom.exit(1);
21
+ } else {
22
+ page.evaluate(addLogging);
23
+
24
+ var timeout = parseInt(args[1] || 30000, 10);
25
+ var start = Date.now();
26
+ var interval = setInterval(function() {
27
+ if (Date.now() > start + timeout) {
28
+ console.error("Tests timed out");
29
+ phantom.exit(1);
30
+ } else {
31
+ var qunitDone = page.evaluate(function() {
32
+ return window.qunitDone;
33
+ });
34
+
35
+ if (qunitDone) {
36
+ clearInterval(interval);
37
+ if (qunitDone.failed > 0) {
38
+ phantom.exit(1);
39
+ } else {
40
+ phantom.exit();
41
+ }
42
+ }
43
+ }
44
+ }, 500);
45
+ }
46
+ });
47
+
48
+ function addLogging() {
49
+ var testErrors = [];
50
+ var assertionErrors = [];
51
+
52
+ QUnit.moduleDone(function(context) {
53
+ if (context.failed) {
54
+ var msg = "Module Failed: " + context.name + "\n" + testErrors.join("\n");
55
+ console.error(msg);
56
+ testErrors = [];
57
+ }
58
+ });
59
+
60
+ QUnit.testDone(function(context) {
61
+ if (context.failed) {
62
+ var msg = " Test Failed: " + context.name + assertionErrors.join(" ");
63
+ testErrors.push(msg);
64
+ assertionErrors = [];
65
+ }
66
+ });
67
+
68
+ QUnit.log(function(context) {
69
+ if (context.result) return;
70
+
71
+ var msg = "\n Assertion Failed:";
72
+ if (context.message) {
73
+ msg += " " + context.message;
74
+ }
75
+
76
+ if (context.expected) {
77
+ msg += "\n Expected: " + context.expected + ", Actual: " + context.actual;
78
+ }
79
+
80
+ assertionErrors.push(msg);
81
+ });
82
+
83
+ QUnit.done(function(context) {
84
+ var stats = [
85
+ "Time: " + context.runtime + "ms",
86
+ "Total: " + context.total,
87
+ "Passed: " + context.passed,
88
+ "Failed: " + context.failed
89
+ ];
90
+ console.log(stats.join(", "));
91
+ window.qunitDone = context;
92
+ });
93
+ }
@@ -0,0 +1,3 @@
1
+ function(doc) {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ function(keys, values, rereduce) {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ module EmberjsCouchapp
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,128 @@
1
+ require 'spec_helper'
2
+ require 'emberjs-couchapp/cli'
3
+
4
+ describe EmberjsCouchapp::CLI do
5
+ def ember(*args)
6
+ capture_io {
7
+ EmberjsCouchapp::CLI.start(args)
8
+ }
9
+ end
10
+
11
+ describe "new" do
12
+ shared_examples "a new app" do
13
+ before do
14
+ ember('new', app_path)
15
+ end
16
+
17
+ def path(*segments)
18
+ Pathname.new(File.join(tmp, app_path, *segments))
19
+ end
20
+
21
+ let(:app_name) { File.basename(app_path) }
22
+
23
+ it 'creates root files' do
24
+ path.should exist
25
+ path('.gitignore').should exist
26
+ path('Assetfile').should exist
27
+ path('config.ru').should exist
28
+ path('Gemfile').should exist
29
+ path('Guardfile').should exist
30
+ path('LICENSE').should exist
31
+ path('Rakefile').should exist
32
+ path('README.md').should exist
33
+ end
34
+
35
+ it 'creates couchapp specific root files' do
36
+ path('_id').should exist
37
+ path('.couchappignore').should exist
38
+ path('.couchapprc').should exist
39
+ path('couchapp.json').should exist
40
+ path('language').should exist
41
+ end
42
+
43
+ it 'creates a sample CouchDB filter, list, show and view' do
44
+ path('filters/my_filter.js').should exist
45
+ path('lists/my_list.js').should exist
46
+ path('shows/my_show.js').should exist
47
+ path('views/my_view/map.js').should exist
48
+ path('views/my_view/reduce.js').should exist
49
+ end
50
+
51
+ it 'creates app root files' do
52
+ path('app/index.html').should exist
53
+ end
54
+
55
+ it 'creates app/css files' do
56
+ path('app/css').should exist
57
+ path('app/css/bootstrap.css').should exist
58
+ path('app/css/main.css').should exist
59
+ end
60
+
61
+ it 'creates app/lib files' do
62
+ path('app/lib').should exist
63
+ path('app/lib/controllers').should exist
64
+ path('app/lib/core.js').should exist
65
+ path('app/lib/ext.js').should exist
66
+ path('app/lib/main.js').should exist
67
+ path('app/lib/models').should exist
68
+ path('app/lib/state_manager.js').should exist
69
+ path('app/lib/states').should exist
70
+ path('app/lib/states/start.js').should exist
71
+ path('app/lib/store.js').should exist
72
+ path('app/lib/views').should exist
73
+ end
74
+
75
+ it 'creates app/modules files' do
76
+ path('app/modules').should exist
77
+ end
78
+
79
+ it 'creates app/plugins files' do
80
+ path('app/plugins').should exist
81
+ path('app/plugins/loader.js').should exist
82
+ end
83
+
84
+ it 'creates app/static files' do
85
+ path('app/static').should exist
86
+ path('app/static/img').should exist
87
+ path('app/static/img/glyphicons-halflings.png').should exist
88
+ path('app/static/img/glyphicons-halflings-white.png').should exist
89
+ end
90
+
91
+ it 'creates app/templates files' do
92
+ path('app/templates').should exist
93
+ path('app/templates/main_page.handlebars').should exist
94
+ end
95
+
96
+ it 'creates app/tests files' do
97
+ path('app/tests').should exist
98
+ path("app/tests/#{app_name}_tests.js").should exist
99
+ end
100
+
101
+ it 'creates app/vendor files' do
102
+ path('app/vendor').should exist
103
+ path('app/vendor/ember-data.js').should exist
104
+ path('app/vendor/ember.js').should exist
105
+ path('app/vendor/jquery.js').should exist
106
+ end
107
+
108
+ it 'creates tests/ files' do
109
+ path('tests').should exist
110
+ path('tests/qunit').should exist
111
+ path('tests/qunit/qunit.css').should exist
112
+ path('tests/qunit/qunit.js').should exist
113
+ path('tests/index.html').should exist
114
+ path('tests/run-tests.js').should exist
115
+ end
116
+ end
117
+
118
+ context "given a name" do
119
+ let(:app_path) { "inky" }
120
+ include_examples "a new app"
121
+ end
122
+
123
+ context "given a path" do
124
+ let(:app_path) { "path/to/inky" }
125
+ include_examples "a new app"
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,44 @@
1
+ require 'pry'
2
+ require 'stringio'
3
+
4
+ module EmberSpecHelpers
5
+ def capture_io
6
+ original_stdout, original_stderr = $stdout, $stderr
7
+ $stdout, $stderr = StringIO.new, StringIO.new
8
+ yield
9
+ return $stdout.string, $stderr.string
10
+ ensure
11
+ $stdout, $stderr = original_stdout, original_stderr
12
+ end
13
+
14
+ end
15
+
16
+ RSpec::Matchers.define :have_contents do |expected|
17
+ match do |file|
18
+ actual = file.read
19
+ case expected
20
+ when String; expected == actual
21
+ when Regexp; expected =~ actual
22
+ end
23
+ end
24
+ end
25
+
26
+ RSpec.configure do |c|
27
+ c.include EmberSpecHelpers
28
+
29
+ original = Dir.pwd
30
+
31
+ def tmp
32
+ File.expand_path("../tmp", __FILE__)
33
+ end
34
+
35
+ c.before do
36
+ FileUtils.rm_rf(tmp)
37
+ FileUtils.mkdir_p(tmp)
38
+ Dir.chdir(tmp)
39
+ end
40
+
41
+ c.after do
42
+ Dir.chdir(original)
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: emberjs-couchapp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Clemens Müller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
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: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '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: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: pry
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Create CouchApp which uses Ember.js
79
+ email:
80
+ - cmueller.418@gmail.com
81
+ executables:
82
+ - emberjs-couchapp
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - Gemfile.lock
89
+ - LICENSE
90
+ - README.md
91
+ - Rakefile
92
+ - bin/emberjs-couchapp
93
+ - emberjs-couchapp.gemspec
94
+ - lib/emberjs-couchapp.rb
95
+ - lib/emberjs-couchapp/app_generator.rb
96
+ - lib/emberjs-couchapp/cli.rb
97
+ - lib/emberjs-couchapp/templates/app/.couchappignore
98
+ - lib/emberjs-couchapp/templates/app/.couchapprc.tt
99
+ - lib/emberjs-couchapp/templates/app/.gitignore
100
+ - lib/emberjs-couchapp/templates/app/Assetfile.tt
101
+ - lib/emberjs-couchapp/templates/app/Gemfile
102
+ - lib/emberjs-couchapp/templates/app/Guardfile
103
+ - lib/emberjs-couchapp/templates/app/LICENSE
104
+ - lib/emberjs-couchapp/templates/app/README.md
105
+ - lib/emberjs-couchapp/templates/app/Rakefile.tt
106
+ - lib/emberjs-couchapp/templates/app/_id.tt
107
+ - lib/emberjs-couchapp/templates/app/app/css/bootstrap.css
108
+ - lib/emberjs-couchapp/templates/app/app/css/main.css
109
+ - lib/emberjs-couchapp/templates/app/app/index.html.tt
110
+ - lib/emberjs-couchapp/templates/app/app/lib/controllers/.empty_directory
111
+ - lib/emberjs-couchapp/templates/app/app/lib/core.js.tt
112
+ - lib/emberjs-couchapp/templates/app/app/lib/ext.js.tt
113
+ - lib/emberjs-couchapp/templates/app/app/lib/main.js.tt
114
+ - lib/emberjs-couchapp/templates/app/app/lib/models/.empty_directory
115
+ - lib/emberjs-couchapp/templates/app/app/lib/state_manager.js.tt
116
+ - lib/emberjs-couchapp/templates/app/app/lib/states/start.js.tt
117
+ - lib/emberjs-couchapp/templates/app/app/lib/store.js.tt
118
+ - lib/emberjs-couchapp/templates/app/app/lib/views/.empty_directory
119
+ - lib/emberjs-couchapp/templates/app/app/modules/.empty_directory
120
+ - lib/emberjs-couchapp/templates/app/app/plugins/loader.js
121
+ - lib/emberjs-couchapp/templates/app/app/static/img/glyphicons-halflings-white.png
122
+ - lib/emberjs-couchapp/templates/app/app/static/img/glyphicons-halflings.png
123
+ - lib/emberjs-couchapp/templates/app/app/templates/main_page.handlebars.tt
124
+ - lib/emberjs-couchapp/templates/app/app/tests/%name%_tests.js.tt
125
+ - lib/emberjs-couchapp/templates/app/app/vendor/ember-data.js
126
+ - lib/emberjs-couchapp/templates/app/app/vendor/ember.js
127
+ - lib/emberjs-couchapp/templates/app/app/vendor/jquery.js
128
+ - lib/emberjs-couchapp/templates/app/config.ru.tt
129
+ - lib/emberjs-couchapp/templates/app/couchapp.json.tt
130
+ - lib/emberjs-couchapp/templates/app/filters/my_filter.js
131
+ - lib/emberjs-couchapp/templates/app/language
132
+ - lib/emberjs-couchapp/templates/app/lists/my_list.js
133
+ - lib/emberjs-couchapp/templates/app/shows/my_show.js
134
+ - lib/emberjs-couchapp/templates/app/tests/index.html
135
+ - lib/emberjs-couchapp/templates/app/tests/qunit/qunit.css
136
+ - lib/emberjs-couchapp/templates/app/tests/qunit/qunit.js
137
+ - lib/emberjs-couchapp/templates/app/tests/run-tests.js
138
+ - lib/emberjs-couchapp/templates/app/views/my_view/map.js
139
+ - lib/emberjs-couchapp/templates/app/views/my_view/reduce.js
140
+ - lib/emberjs-couchapp/version.rb
141
+ - spec/ember/cli_spec.rb
142
+ - spec/spec_helper.rb
143
+ homepage: https://github.com/pangratz/emberjs-couchapp-gem
144
+ licenses: []
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ segments:
156
+ - 0
157
+ hash: 2091285936960838770
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ! '>='
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ segments:
165
+ - 0
166
+ hash: 2091285936960838770
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 1.8.24
170
+ signing_key:
171
+ specification_version: 3
172
+ summary: CouchApp using Ember.js
173
+ test_files:
174
+ - spec/ember/cli_spec.rb
175
+ - spec/spec_helper.rb