emberjs-couchapp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ tmp/
3
+ pkg/
4
+
5
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ emberjs-couchapp (0.0.1)
5
+ thor
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ coderay (1.0.6)
11
+ diff-lcs (1.1.3)
12
+ method_source (0.7.1)
13
+ pry (0.9.9.6)
14
+ coderay (~> 1.0.5)
15
+ method_source (~> 0.7.1)
16
+ slop (>= 2.4.4, < 3)
17
+ rake (0.9.2.2)
18
+ rspec (2.10.0)
19
+ rspec-core (~> 2.10.0)
20
+ rspec-expectations (~> 2.10.0)
21
+ rspec-mocks (~> 2.10.0)
22
+ rspec-core (2.10.1)
23
+ rspec-expectations (2.10.0)
24
+ diff-lcs (~> 1.1.3)
25
+ rspec-mocks (2.10.1)
26
+ slop (2.4.4)
27
+ thor (0.15.2)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ emberjs-couchapp!
34
+ pry
35
+ rake
36
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) Clemens Müller
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ Gem to create a CouchApp using Ember.js
2
+ =======================================
3
+
4
+ Installation
5
+ ------------
6
+
7
+ $ gem install emberjs-couchapp
8
+
9
+ Usage
10
+ -----
11
+
12
+ $ emberjs-couchapp new appname
13
+
14
+ Created App Structure
15
+ ---------------------
16
+
17
+ appname
18
+ ├── Assetfile - App build file
19
+ ├── Gemfile - Package dependencies for rakep/rack
20
+ ├── Gemfile.lock - Here be dragons: don't touch, always include
21
+ ├── app - App specific code
22
+ │ ├── index.html - The app entry point
23
+ │ ├── css - App CSS or SCSS (.scss)
24
+ │ ├── lib - App code, *modularized during build*
25
+ │ ├── modules - Module code, *already modularized*
26
+ │ ├── plugins - Plugins (e.g. jquery.jsonrpc.js)
27
+ │ │ └── loader.js - JS module loader
28
+ │ ├── static - Static files, never touched, copied over during build
29
+ │ ├── templates - Handlebars templates, *modularized during build*
30
+ │ ├── tests - App tests
31
+ │ └── vendor - Vendor code, *modularized during build*
32
+ ├── _attachments - Built out asset files
33
+ ├── config.ru - Rack development web server configuration
34
+ └── tmp - Temporary build files used by rakep
35
+
36
+ Testing
37
+ -------
38
+
39
+ You can test the app by invoking
40
+
41
+ $ bundle exec rake test
42
+
43
+ This executes the tests by using [Phantom.JS](http://www.phantomjs.org/), which you need to have installed.
44
+
45
+ Or you can run the tests via
46
+
47
+ $ bundle exec rackup
48
+ $ open http://localhost:9292/tests/index.html
49
+
50
+ You can automatically execute the tests every time a file changes via
51
+
52
+ $ bundle exec guard
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require "bundler/gem_tasks"
2
+ require File.expand_path('../lib/emberjs-couchapp/version', __FILE__)
3
+
4
+ desc "run the specs"
5
+ task :spec do
6
+ sh "rspec -cfs spec"
7
+ end
8
+
9
+ desc "build gem"
10
+ task :build do
11
+ sh "gem build emberjs-couchapp.gemspec"
12
+ end
13
+
14
+ desc "install gem"
15
+ task :install => :build do
16
+ sh "gem install pkg/emberjs-couchapp-#{EmberjsCouchapp::VERSION}.gem"
17
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'emberjs-couchapp/cli'
4
+
5
+ EmberjsCouchapp::CLI.start
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/emberjs-couchapp/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Clemens Müller"]
6
+ gem.email = ["cmueller.418@gmail.com"]
7
+ gem.description = %q{Create CouchApp which uses Ember.js}
8
+ gem.summary = %q{CouchApp using Ember.js}
9
+ gem.homepage = "https://github.com/pangratz/emberjs-couchapp-gem"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "emberjs-couchapp"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = EmberjsCouchapp::VERSION
17
+
18
+ gem.add_dependency 'thor'
19
+
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'rspec'
22
+ gem.add_development_dependency 'pry'
23
+ end
@@ -0,0 +1,5 @@
1
+ require "emberjs-couchapp/version"
2
+
3
+ module EmberjsCouchapp
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,25 @@
1
+ require 'thor/group'
2
+
3
+ module EmberjsCouchapp
4
+ class AppGenerator < Thor::Group
5
+ include Thor::Actions
6
+
7
+ source_root File.expand_path('../templates/app', __FILE__)
8
+
9
+ argument :path
10
+
11
+ def name
12
+ File.basename(path)
13
+ end
14
+
15
+ def title
16
+ name.capitalize
17
+ end
18
+
19
+ def create
20
+ self.destination_root = File.expand_path(path, destination_root)
21
+ directory '.'
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require 'emberjs-couchapp/app_generator'
3
+
4
+ module EmberjsCouchapp
5
+ class CLI < Thor
6
+ include Thor::Actions
7
+
8
+ desc 'new PATH', 'Create a new CouchApp using Ember.js'
9
+ def new(path)
10
+ EmberjsCouchapp::AppGenerator.start([path])
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ [
2
+ // filenames matching these regexps will not be pushed to the database
3
+ // uncomment to activate; separate entries with ","
4
+ // ".*~$"
5
+ // ".*\\.swp$"
6
+ // ".*\\.bak$"
7
+ ]
@@ -0,0 +1,10 @@
1
+ {
2
+ "env": {
3
+ "default": {
4
+ "db": "http://localhost:5984/<%= name %>_dev"
5
+ },
6
+ "prod": {
7
+ "db": "http://localhost:5984/<%= name %>"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ tmp/
3
+ assets/
@@ -0,0 +1,136 @@
1
+ APPNAME = '<%= name %>'
2
+
3
+ require 'json'
4
+ require 'rake-pipeline-web-filters'
5
+
6
+ WebFilters = Rake::Pipeline::Web::Filters
7
+
8
+ class LoaderFilter < WebFilters::MinispadeFilter
9
+ def generate_output(inputs, output)
10
+ inputs.each do |input|
11
+ code = input.read
12
+ module_id = @module_id_generator.call(input)
13
+ contents = "function(require) {\n#{code}\n}"
14
+ ret = "\nloader.register('#{module_id}', #{contents});\n"
15
+ output.write ret
16
+ end
17
+ end
18
+ end
19
+
20
+ class EmberAssertFilter < Filter
21
+ def generate_output(inputs, output)
22
+ inputs.each do |input|
23
+ result = input.read
24
+ result.gsub!(/ember_assert\((.*)\);/, '')
25
+ output.write(result)
26
+ end
27
+ end
28
+ end
29
+
30
+ class HandlebarsFilter < Filter
31
+ def generate_output(inputs, output)
32
+ inputs.each do |input|
33
+ code = input.read.to_json
34
+ name = File.basename(input.path, '.handlebars')
35
+ output.write "\nreturn Ember.Handlebars.compile(#{code});\n"
36
+ end
37
+ end
38
+ end
39
+
40
+ output '_attachments'
41
+
42
+ input 'app' do
43
+ match 'index.html' do
44
+ concat 'index.html'
45
+ end
46
+
47
+ match 'lib/**/*.js' do
48
+ filter LoaderFilter,
49
+ :module_id_generator => proc { |input|
50
+ input.path.sub(/^lib\//, "#{APPNAME}/").sub(/\.js$/, '')
51
+ }
52
+
53
+ if ENV['RAKEP_MODE'] == 'production'
54
+ filter EmberAssertFilter
55
+ uglify {|input| input}
56
+ end
57
+ concat 'app.js'
58
+ end
59
+
60
+ match 'vendor/**/*.js' do
61
+ filter LoaderFilter,
62
+ :module_id_generator => proc { |input|
63
+ input.path.sub(/^vendor\//, '').sub(/\.js$/, '')
64
+ }
65
+
66
+ if ENV['RAKEP_MODE'] == 'production'
67
+ filter EmberAssertFilter
68
+ uglify {|input| input}
69
+ end
70
+ concat %w[
71
+ vendor/jquery.js
72
+ vendor/ember.js
73
+ vendor/ember-data.js
74
+ ], 'app.js'
75
+ end
76
+
77
+ match 'modules/**/*.js' do
78
+ if ENV['RAKEP_MODE'] == 'production'
79
+ filter EmberAssertFilter
80
+ uglify {|input| input}
81
+ end
82
+ concat 'app.js'
83
+ end
84
+
85
+ match 'plugins/**/*.js' do
86
+ if ENV['RAKEP_MODE'] == 'production'
87
+ uglify {|input| input}
88
+ end
89
+ concat do |input|
90
+ input.sub(/plugins\//, '')
91
+ end
92
+ end
93
+
94
+ match 'templates/**/*.handlebars' do
95
+ filter HandlebarsFilter
96
+ filter LoaderFilter,
97
+ :module_id_generator => proc { |input|
98
+ input.path.sub(/^templates\//, "#{APPNAME}/~templates/").sub(/\.handlebars$/, '')
99
+ }
100
+ if ENV['RAKEP_MODE'] == 'production'
101
+ uglify {|input| input}
102
+ end
103
+ concat 'app.js'
104
+ end
105
+
106
+ match 'tests/**/*.js' do
107
+ filter LoaderFilter,
108
+ :module_id_generator => proc { |input|
109
+ input.path.sub(/^lib\//, "#{APPNAME}/").sub(/\.js$/, '')
110
+ }
111
+ concat 'app-tests.js'
112
+ end
113
+
114
+ match 'css/**/*.css' do
115
+ if ENV['RAKEP_MODE'] == 'production'
116
+ yui_css
117
+ end
118
+ concat ['bootstrap.css', 'main.css'], 'app.css'
119
+ end
120
+
121
+ match 'css/**/*.scss' do
122
+ sass
123
+ if ENV['RAKEP_MODE'] == 'production'
124
+ yui_css
125
+ end
126
+ concat 'app.css'
127
+ end
128
+
129
+ match "static/**/*" do
130
+ concat do |input|
131
+ input.sub(/static\//, '')
132
+ end
133
+ end
134
+ end
135
+
136
+ # vim: filetype=ruby
@@ -0,0 +1,19 @@
1
+ source :rubygems
2
+
3
+ gem 'colored'
4
+
5
+ gem 'guard'
6
+ gem 'guard-rake'
7
+
8
+ gem 'rack'
9
+ gem 'rack-rewrite'
10
+ gem 'rack-streaming-proxy'
11
+
12
+ gem 'sass'
13
+ gem 'compass'
14
+
15
+ gem 'uglifier'
16
+ gem 'yui-compressor'
17
+
18
+ gem 'rake-pipeline', :git => 'https://github.com/livingsocial/rake-pipeline.git'
19
+ gem 'rake-pipeline-web-filters', :git => 'https://github.com/wycats/rake-pipeline-web-filters.git'
@@ -0,0 +1,3 @@
1
+ guard :rake, :task => :test do
2
+ watch(%r{^app/.+\.js$})
3
+ end
@@ -0,0 +1,13 @@
1
+ Copyright (c) Your Name Here
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,58 @@
1
+ Ember Skeleton
2
+ ==============
3
+
4
+ A skeleton application framework using Ember.js and Rake Pipeline.
5
+
6
+ Running
7
+ -------
8
+
9
+ $ bundle install
10
+ $ bundle exec rackup
11
+
12
+ App Structure
13
+ -------------
14
+
15
+ ember-skeleton
16
+ ├── Assetfile - App build file
17
+ ├── Gemfile - Package dependencies for rakep/rack
18
+ ├── Gemfile.lock - Here be dragons: don't touch, always include
19
+ ├── app - App specific code
20
+ │ ├── css - App CSS or SCSS (.scss)
21
+ │ ├── lib - App code, *modularized during build*
22
+ │ ├── modules - Module code, *already modularized*
23
+ │ ├── plugins - Plugins (e.g. jquery.jsonrpc.js)
24
+ │ │ └── loader.js - JS module loader
25
+ │ ├── static - Static files, never touched, copied over during build
26
+ │ ├── templates - Handlebars templates, *modularized during build*
27
+ │ ├── tests - QUnit application tests
28
+ │ └── vendor - Vendor code, *modularized during build*
29
+ ├── assets - Built out asset files, minified in production
30
+ │ ├── app.css - Built out app CSS/SCSS
31
+ │ ├── app.js - Built out app JS
32
+ │ └── loader.js - Built out JS module loader
33
+ ├── config.ru - Rack development web server configuration
34
+ ├── index.html - The app entry point
35
+ ├── tests - QUnit testing files
36
+ │ ├── index.html - The testing entry point
37
+ │ ├── qunit - Testing support files
38
+ │ └── run-tests.js - The PhantomJS QUnit test runner
39
+ └── tmp - Temporary build files used by rakep
40
+
41
+ Testing
42
+ -------
43
+
44
+ You can test the app by invoking:
45
+
46
+ $ bundle exec rake test
47
+
48
+ This executes the tests by using [PhantomJS](http://www.phantomjs.org/),
49
+ which you need to have installed.
50
+
51
+ Or you can run the tests via:
52
+
53
+ $ bundle exec rackup
54
+ $ open http://localhost:9292/tests/index.html
55
+
56
+ If you want to continuously run the tests every time a file changes, invoke:
57
+
58
+ $ bundle exec guard