embork 0.0.4

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 (121) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +5 -0
  7. data/TODO.md +16 -0
  8. data/bin/embork +63 -0
  9. data/blueprint/Borkfile +42 -0
  10. data/blueprint/Gemfile +13 -0
  11. data/blueprint/README.md +25 -0
  12. data/blueprint/app/app.js +11 -0
  13. data/blueprint/app/components/.gitkeep +0 -0
  14. data/blueprint/app/controllers/.gitkeep +0 -0
  15. data/blueprint/app/helpers/.gitkeep +0 -0
  16. data/blueprint/app/index.html.erb +18 -0
  17. data/blueprint/app/initializers/.gitkeep +0 -0
  18. data/blueprint/app/mixins/.gitkeep +0 -0
  19. data/blueprint/app/models/.gitkeep +0 -0
  20. data/blueprint/app/router.js +8 -0
  21. data/blueprint/app/routes/.gitkeep +0 -0
  22. data/blueprint/app/routes/index.js +1 -0
  23. data/blueprint/app/styles/.gitkeep +0 -0
  24. data/blueprint/app/styles/app.scss +3 -0
  25. data/blueprint/app/templates/.gitkeep +0 -0
  26. data/blueprint/app/templates/application.hbs +3 -0
  27. data/blueprint/app/templates/components/.gitkeep +0 -0
  28. data/blueprint/app/utils/.gitkeep +0 -0
  29. data/blueprint/app/views/.gitkeep +0 -0
  30. data/blueprint/bower.json +16 -0
  31. data/blueprint/bowerrc +3 -0
  32. data/blueprint/config/development/application.css +0 -0
  33. data/blueprint/config/development/application.js +12 -0
  34. data/blueprint/config/production/application.css +0 -0
  35. data/blueprint/config/production/application.js +12 -0
  36. data/blueprint/dotfiles +3 -0
  37. data/blueprint/erbfiles +5 -0
  38. data/blueprint/gitignore +17 -0
  39. data/blueprint/jshintrc +40 -0
  40. data/blueprint/package.json +15 -0
  41. data/blueprint/static/.gitkeep +0 -0
  42. data/blueprint/tests/.jshintrc +71 -0
  43. data/blueprint/tests/helpers/resolver.js +7 -0
  44. data/blueprint/tests/helpers/start-app.js +29 -0
  45. data/blueprint/tests/index.html +44 -0
  46. data/blueprint/tests/test-helper.js +6 -0
  47. data/blueprint/tests/test-loader.js +8 -0
  48. data/blueprint/tests/unit/.gitkeep +0 -0
  49. data/embork.gemspec +41 -0
  50. data/lib/embork.rb +23 -0
  51. data/lib/embork/borkfile.rb +148 -0
  52. data/lib/embork/build_versions.rb +21 -0
  53. data/lib/embork/builder.rb +156 -0
  54. data/lib/embork/environment.rb +90 -0
  55. data/lib/embork/forwarder.rb +23 -0
  56. data/lib/embork/generator.rb +184 -0
  57. data/lib/embork/logger.rb +40 -0
  58. data/lib/embork/pushstate.rb +16 -0
  59. data/lib/embork/server.rb +80 -0
  60. data/lib/embork/sprockets.rb +6 -0
  61. data/lib/embork/sprockets/ember_handlebars_compiler.rb +75 -0
  62. data/lib/embork/sprockets/es6_module_transpiler.rb +120 -0
  63. data/lib/embork/sprockets/frameworks.rb +34 -0
  64. data/lib/embork/sprockets/helpers.rb +45 -0
  65. data/lib/embork/sprockets/support/es6-module-transpiler.js +7190 -0
  66. data/lib/embork/sprockets/support/node_runner.js +22 -0
  67. data/lib/embork/version.rb +3 -0
  68. data/lib/string/strip.rb +27 -0
  69. data/spec/embork/borkfile/Borkfile.empty +0 -0
  70. data/spec/embork/borkfile/Borkfile.full +32 -0
  71. data/spec/embork/borkfile/Borkfile.rack +5 -0
  72. data/spec/embork/borkfile/Borkfile.relative +3 -0
  73. data/spec/embork/borkfile_spec.rb +119 -0
  74. data/spec/embork/builder/Borkfile +20 -0
  75. data/spec/embork/builder/app/index.html.erb +9 -0
  76. data/spec/embork/builder/config/production/application.css +0 -0
  77. data/spec/embork/builder/config/production/application.js +0 -0
  78. data/spec/embork/builder/config/production/deeply/nested/asset.js +0 -0
  79. data/spec/embork/builder/static/images/image.png +0 -0
  80. data/spec/embork/builder_spec.rb +95 -0
  81. data/spec/embork/environment_spec.rb +78 -0
  82. data/spec/embork/generator_spec.rb +84 -0
  83. data/spec/embork/server/example_app/Borkfile +1 -0
  84. data/spec/embork/server/example_app/app/app.js.erb +3 -0
  85. data/spec/embork/server/example_app/app/css/main.sass +3 -0
  86. data/spec/embork/server/example_app/app/index.html +9 -0
  87. data/spec/embork/server/example_app/build/development/application-12345.js +14 -0
  88. data/spec/embork/server/example_app/build/development/index.html +9 -0
  89. data/spec/embork/server/example_app/components/some/component.js +6 -0
  90. data/spec/embork/server/example_app/config/development/application.css +4 -0
  91. data/spec/embork/server/example_app/config/development/application.js +2 -0
  92. data/spec/embork/server/example_app/config/production/application.css +4 -0
  93. data/spec/embork/server/example_app/config/production/application.js +4 -0
  94. data/spec/embork/server/example_app/static/fonts/.gitkeep +0 -0
  95. data/spec/embork/server/example_app/static/images/.gitkeep +0 -0
  96. data/spec/embork/server/example_app/static/images/image.png +0 -0
  97. data/spec/embork/server/specimen.css +7 -0
  98. data/spec/embork/server/specimen.js +14 -0
  99. data/spec/embork/server_spec.rb +152 -0
  100. data/spec/embork/sprockets/ember_handlebars_compiler/amd_template.js +26 -0
  101. data/spec/embork/sprockets/ember_handlebars_compiler/cjs_template.js +24 -0
  102. data/spec/embork/sprockets/ember_handlebars_compiler/global_handlebars_template.js +17 -0
  103. data/spec/embork/sprockets/ember_handlebars_compiler/global_hbs_template.js +17 -0
  104. data/spec/embork/sprockets/ember_handlebars_compiler/my/hbs/template.hbs +5 -0
  105. data/spec/embork/sprockets/ember_handlebars_compiler/my_handlebars_template.js.handlebars +5 -0
  106. data/spec/embork/sprockets/ember_handlebars_compiler/my_hbs_template.js.hbs +5 -0
  107. data/spec/embork/sprockets/ember_handlebars_compiler/transformed_template.js +26 -0
  108. data/spec/embork/sprockets/ember_handlebars_compiler_spec.rb +82 -0
  109. data/spec/embork/sprockets/es6_module_transpiler/app/my/transformed/module.js +13 -0
  110. data/spec/embork/sprockets/es6_module_transpiler/app/my_fancy_module.js +13 -0
  111. data/spec/embork/sprockets/es6_module_transpiler/compiled_amd.js +20 -0
  112. data/spec/embork/sprockets/es6_module_transpiler/compiled_cjs.js +20 -0
  113. data/spec/embork/sprockets/es6_module_transpiler/component.js +1 -0
  114. data/spec/embork/sprockets/es6_module_transpiler/components/some_component.js +1 -0
  115. data/spec/embork/sprockets/es6_module_transpiler/config/application.js +1 -0
  116. data/spec/embork/sprockets/es6_module_transpiler/manifest.js +20 -0
  117. data/spec/embork/sprockets/es6_module_transpiler/namespaced.js +20 -0
  118. data/spec/embork/sprockets/es6_module_transpiler/transformed.js +20 -0
  119. data/spec/embork/sprockets/es6_module_transpiler_spec.rb +97 -0
  120. data/spec/spec_helper.rb +13 -0
  121. metadata +468 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 68e08a13835911d3be709a08ed0f8c8e1d33d41f
4
+ data.tar.gz: 2d1db05b1f2d067446e290a62d69d615e6dfe0d6
5
+ SHA512:
6
+ metadata.gz: c59ae75b4decaa04317aa4b0e32b064969d26a40a1ff2ea0a667baca1bb635294a04d1a85fce506714282047e3f584373c8aeec2a3a4d6e6f0da8bf7b7d2dd15
7
+ data.tar.gz: 79a46ae25a8232379c62ffc16f84c60b389238a08038fdbc389ecd4ab65c68351d316de644b0a4ac5a2cf46d711895c9d73eb03c6794c92d94f59a0904f916da
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ spec/embork/example_app/.cache
19
+ spec/embork/builder/build
20
+ spec/embork/builder/.cache
21
+ blueprint/components
22
+ blueprint/node_modules
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in embork.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Matthew Smart
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Embork
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'embork'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install embork
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
data/TODO.md ADDED
@@ -0,0 +1,16 @@
1
+ TODO
2
+ ====
3
+
4
+ - [x] add helpers to run from built or generated files
5
+ - [x] Add html files to Borkfile. Discreet list of what to build. Don't assume.
6
+ - [x] Use no cache for erb files.
7
+ - [x] Add `:keep_old_versions` to Borkfile to configure the number of old versions
8
+ - [x] Create full blown example project.
9
+ - [x] Create blank Borkfile with all options presented and probably commented out.
10
+ - [x] Make module transpiler ignore components
11
+ - [x] Create cli to run server.
12
+ - [x] Add jj-abrams resolver
13
+ - [ ] Extend cli with clean, and hint
14
+ - [ ] add hint task
15
+ - [ ] build in qunit-runner
16
+ - [ ] build in prerender
data/bin/embork ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'embork'
4
+ require 'thor'
5
+
6
+ class EmborkCLI < Thor
7
+ class_option :borkfile, :type => :string, :default => "./Borkfile",
8
+ :desc => "Path to the embork config file."
9
+
10
+ desc "create PACKAGE_NAME", %{generate an Embork Ember application called "PACKAGE_NAME"}
11
+ option :use_ember_data, :type => :boolean, :default => false
12
+ option :directory, :type => :string, :default => nil
13
+ def create(package_name)
14
+ puts %{Creating embork app in "%s"} % package_name
15
+ Embork::Generator.new(package_name, options).generate
16
+ end
17
+
18
+ desc "server [ENVIRONMENT]", %{run the development or production server}
19
+ option :port, :type => :numeric, :default => 9292
20
+ option :host, :type => :string, :default => 'localhost'
21
+ option :bundle_version, :type => :string, :default => nil
22
+ option :with_latest_bundle, :type => :boolean, :default => false
23
+ def server(environment = :development)
24
+ borkfile = Embork::Borkfile.new options[:borkfile], environment
25
+ Embork::Server.new(borkfile, options).run
26
+ end
27
+
28
+ desc "build [ENVIRONMENT]", %{build the project in the 'build' directory}
29
+ option :keep_all_old_versions, :type => :boolean, :default => false,
30
+ :desc => %{By default, older versions of the project are removed, only keeping the last few versions. This flag keeps all old versions.}
31
+ def build(environment = :production)
32
+ borkfile = Embork::Borkfile.new options[:borkfile], environment
33
+ builder = Embork::Builder.new(borkfile)
34
+ builder.build
35
+ builder.clean unless options[:keep_all_old_versions]
36
+ end
37
+
38
+ desc "clean", %{Remove all files under the build directory}
39
+ def clean
40
+ borkfile = Embork::Borkfile.new options[:borkfile]
41
+ FileUtils.rm_rf File.expand_path('build', borkfile.project_root)
42
+ end
43
+
44
+ desc "clean-cache", %{Blow away the sprockets cache}
45
+ def clean_cache
46
+ borkfile = Embork::Borkfile.new options[:borkfile]
47
+ FileUtils.rm_rf File.expand_path('.cache', borkfile.project_root)
48
+ end
49
+
50
+ desc "hint", %{run jshint on the app and tests}
51
+ option :only_app, :type => :boolean, :default => false
52
+ option :only_tests, :type => :boolean, :default => false
53
+ def hint
54
+ borkfile = Embork::Borkfile.new options[:borkfile]
55
+ Dir.chdir borkfile.project_root do
56
+ system('npm run hint-app') unless options[:only_tests]
57
+ system('npm run hint-testss') unless options[:only_app]
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ EmborkCLI.start(ARGV)
@@ -0,0 +1,42 @@
1
+ # vim: set ft=ruby:
2
+ # Borkfile
3
+
4
+ keep_old_versions 5
5
+
6
+ set_project_root '.'
7
+
8
+ # Add paths:
9
+ #
10
+ # append_asset_path 'foo/bar'
11
+
12
+ # Add sprockets pre/post processors and template engines:
13
+ #
14
+ # register_postprocessor 'application/javascript', SomeClass
15
+ # register_engine '.some-ext, SomeEngine
16
+
17
+ # Add frameworks. Currently only compass and bootstrap (bootstrap-sass) are
18
+ # supported. First add either to your Gemfile and bundle.
19
+ #
20
+ # use_framework :compass
21
+ # use_framework :bootstrap
22
+
23
+ add_sprockets_helpers do
24
+ end
25
+
26
+ # Pass in a single file or an array.
27
+ compile_html 'index.html'
28
+
29
+ es6_namespace '<%= namespace %>'
30
+
31
+ # Call anything of these things inside a `configure <environment>` block to
32
+ # make it environment specific
33
+ configure :development do
34
+ end
35
+
36
+ configure :production do
37
+ end
38
+
39
+ # Use :static index to fall back to sprockets-built html files OR pass in
40
+ # a rack application
41
+ set_backend :static_index
42
+
data/blueprint/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'embork'
4
+
5
+ # To include compass, include the gem, and use the 'use_framework' DSL in the
6
+ # Borkfile.
7
+ #
8
+ # gem 'compass'
9
+
10
+ # To include bootstrap, include the gem, and use the 'use_framework' DSL in the
11
+ # Borkfile.
12
+ #
13
+ # gem 'bootstrap-sass'
@@ -0,0 +1,25 @@
1
+ # <%= name.substring(0,1).toUpperCase() + name.substring(1) %>
2
+
3
+ This README outlines the details of collaborating on this Ember application.
4
+
5
+ ## Installation
6
+
7
+ * `git clone` this repository
8
+ * `npm install`
9
+ * `bower install`
10
+
11
+ ## Running
12
+
13
+ * `ember server`
14
+ * Visit your app at http://localhost:4200.
15
+
16
+ ## Running Tests
17
+
18
+ * `ember test`
19
+ * `ember test --server`
20
+
21
+ ## Building
22
+
23
+ * `ember build`
24
+
25
+ For more information on using ember-cli, visit [http://iamstef.net/ember-cli/](http://iamstef.net/ember-cli/).
@@ -0,0 +1,11 @@
1
+ import Resolver from 'ember/resolver';
2
+ import loadInitializers from 'ember/load-initializers';
3
+
4
+ var App = Ember.Application.extend({
5
+ modulePrefix: "<%= namespace %>",
6
+ Resolver: Resolver
7
+ });
8
+
9
+ loadInitializers(App, "<%= namespace %>");
10
+
11
+ export default App;
File without changes
File without changes
File without changes
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <title><%= namespace %></title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+ <%%= stylesheet_link_tag '/application.css' %>
10
+ </head>
11
+ <body>
12
+ <%%= javascript_include_tag '/application.js' %>
13
+ <script>
14
+ window.App = require('<%= namespace %>/app')['default'].create(
15
+ Ember.merge(window.ENV, { environment: "<%%= Embork.env %>" }));
16
+ </script>
17
+ </body>
18
+ </html>
File without changes
File without changes
File without changes
@@ -0,0 +1,8 @@
1
+ var Router = Ember.Router.extend({
2
+ location: ENV.locationType
3
+ });
4
+
5
+ Router.map(function() {
6
+ });
7
+
8
+ export default Router;
File without changes
@@ -0,0 +1 @@
1
+ export default Ember.Route.extend({});
File without changes
@@ -0,0 +1,3 @@
1
+ html, body {
2
+ margin: 20px;
3
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ <h2 id='title'>Welcome to Ember.js</h2>
2
+
3
+ {{outlet}}
File without changes
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "<%= namespace %>",
3
+ "dependencies": {
4
+ "handlebars": "~1.3.0",
5
+ "jquery": "^1.11.1",
6
+ "qunit": "~1.12.0",
7
+ "ember-qunit": "~0.1.5",
8
+ "ember": "1.5.1",
9
+ "ember-data": "1.0.0-beta.7",
10
+ "ic-ajax": "~1.x",
11
+ "loader": "stefanpenner/loader.js#1.0.0",
12
+ "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.1",
13
+ "ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.1",
14
+ "ember-resolver": "stefanpenner/ember-jj-abrams-resolver#0.1.1"
15
+ }
16
+ }
data/blueprint/bowerrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "directory": "components"
3
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ //= require jquery/dist/jquery
2
+ //= require handlebars/handlebars
3
+ //= require ember/ember
4
+ //= require loader/loader
5
+ //= require ember-resolver/dist/ember-resolver
6
+ //= require ic-ajax/dist/named-amd/main
7
+ //= require ember-data/ember-data
8
+ //= require ember-cli-shims/app-shims
9
+ //= require ember-load-initializers/ember-load-initializers
10
+ //= require_tree ../../app
11
+
12
+ window.ENV = {};
File without changes
@@ -0,0 +1,12 @@
1
+ //= require jquery/dist/jquery.min
2
+ //= require handlebars/handlebars.runtime.min
3
+ //= require ember/ember.prod
4
+ //= require loader/loader
5
+ //= require ember-resolver/dist/ember-resolver.prod
6
+ //= require ic-ajax/dist/named-amd/main
7
+ //= require ember-data/ember-data.prod
8
+ //= require ember-cli-shims/app-shims
9
+ //= require ember-load-initializers/ember-load-initializers
10
+ //= require_tree ../../app
11
+
12
+ window.ENV = {};
@@ -0,0 +1,3 @@
1
+ gitignore
2
+ bowerrc
3
+ jshintrc
@@ -0,0 +1,5 @@
1
+ app/app.js
2
+ app/index.html.erb
3
+ bower.json
4
+ package.json
5
+ Borkfile
@@ -0,0 +1,17 @@
1
+ # Compiled output
2
+ build
3
+ .cache
4
+ .sass-cache
5
+
6
+ # Ruby stuff
7
+ .bundle
8
+ Gemfile.lock
9
+
10
+ # Dependencies
11
+ node_modules
12
+ components
13
+
14
+ # Misc
15
+ .DS_Store
16
+ Thumbs.db
17
+ npm-debug.log