ember-appkit-rails 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/Rakefile +31 -6
- data/app/assets/javascripts/templates/application.hbs +7 -0
- data/app/controllers/landing_controller.rb +5 -0
- data/lib/ember-appkit-rails.rb +9 -0
- data/lib/ember/appkit.rb +5 -0
- data/lib/ember/appkit/rails.rb +4 -4
- data/lib/ember/appkit/rails/engine.rb +37 -9
- data/lib/ember/appkit/rails/resource_override.rb +14 -0
- data/lib/ember/appkit/rails/sprockets.rb +4 -0
- data/lib/ember/appkit/rails/sprockets/directive_processor.rb +9 -0
- data/lib/ember/appkit/rails/sprockets/processed_asset.rb +27 -0
- data/lib/ember/appkit/rails/version.rb +1 -1
- data/lib/generators/ember/bootstrap_generator.rb +58 -19
- data/lib/generators/ember/component_generator.rb +2 -4
- data/lib/generators/ember/controller_generator.rb +1 -3
- data/lib/generators/ember/generator_helpers.rb +18 -10
- data/lib/generators/ember/helper_generator.rb +17 -0
- data/lib/generators/ember/model_generator.rb +3 -4
- data/lib/generators/ember/resource_generator.rb +13 -1
- data/lib/generators/ember/route_generator.rb +1 -2
- data/lib/generators/ember/scaffold_generator.rb +52 -0
- data/lib/generators/ember/template_generator.rb +1 -2
- data/lib/generators/ember/view_generator.rb +1 -4
- data/lib/generators/templates/adapter.js +3 -0
- data/lib/generators/templates/application.js.erb +11 -0
- data/lib/generators/templates/array_controller.js.es6 +1 -3
- data/lib/generators/templates/component.js.es6 +1 -1
- data/lib/generators/templates/controller.js.es6 +1 -2
- data/{test/dummy/app/utils → lib/generators/templates}/csrf.js +0 -0
- data/lib/generators/templates/environment.js +12 -0
- data/{test/dummy/app/views/application/show.html → lib/generators/templates/environments/development.js} +0 -0
- data/lib/generators/templates/environments/production.js +0 -0
- data/lib/generators/templates/environments/test.js +0 -0
- data/lib/generators/templates/helper.js +2 -0
- data/lib/generators/templates/model.js.es6 +1 -1
- data/lib/generators/templates/object_controller.js.es6 +1 -3
- data/lib/generators/templates/route.js.es6 +1 -2
- data/lib/generators/templates/router.js.es6 +1 -2
- data/lib/generators/templates/scaffold/route/edit.js.es6 +22 -0
- data/lib/generators/templates/scaffold/route/index.js.es6 +5 -0
- data/lib/generators/templates/scaffold/route/new.js.es6 +23 -0
- data/lib/generators/templates/scaffold/route/show.js.es6 +14 -0
- data/lib/generators/templates/scaffold/template.hbs +3 -0
- data/lib/generators/templates/scaffold/template/edit.hbs +3 -0
- data/lib/generators/templates/scaffold/template/form.hbs +9 -0
- data/lib/generators/templates/scaffold/template/index.hbs +20 -0
- data/lib/generators/templates/scaffold/template/new.hbs +3 -0
- data/lib/generators/templates/scaffold/template/show.hbs +9 -0
- data/lib/generators/templates/template.hbs +0 -5
- data/lib/generators/templates/view.js.es6 +1 -2
- data/test/dummy/Gemfile +40 -0
- data/test/dummy/config/adapter.js +3 -0
- data/test/dummy/config/application.js +11 -0
- data/test/dummy/config/application.rb +24 -8
- data/test/dummy/config/boot.rb +1 -2
- data/test/dummy/config/environment.js +12 -0
- data/test/dummy/config/environments/development.js +0 -0
- data/test/dummy/config/environments/development.rb +1 -3
- data/test/dummy/config/environments/production.js +0 -0
- data/test/dummy/config/environments/test.js +0 -0
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/csrf.js +9 -0
- data/test/dummy/config/initializers/secret_token.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -5
- data/test/dummy/{app/assets/javascripts → config}/router.js.es6 +1 -2
- data/test/dummy/config/routes.rb +55 -2
- data/test/dummy/log/test.log +14 -175
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/tmp/Gemfile +45 -0
- data/test/dummy/{app → tmp/app}/assets/javascripts/application.js +3 -1
- data/test/dummy/tmp/app/assets/javascripts/custom/application.js +16 -0
- data/test/dummy/tmp/app/templates/post.hbs +0 -0
- data/test/dummy/tmp/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/07afa5d8ceda557642e2330ab45eb203 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1f15c49a05b13c3a7ee50d2ac3900f38 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4a1d4e32cd7b9fd1c62bfd553ae56051 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/660bc633c8899c6c1b20514637fa0169 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/67afcba9807cd5e57b80b5fdf9f26758 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6870da13c3305651063dc22ccce27d5c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7ca4966e0a480430a858a7ab74518c75 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/827fafc13575b345cc572fd041ef1fba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/83af35bb6b852de883a26a9458fd4e3a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8ebc8c58233ab12eee6edfc0feca2492 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9160f792acb62d1f7721c714681fcfe6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a2f615309ade94c14ae81d7ebc94fd67 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a9648a765fed0738b076bd24099109a3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ae884a1acda0e6f9bb27a856a22bb08d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bb4a2293175928af3e23c47488077098 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bf689240392e7355c0de5cfd47272146 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c8c4c1b316845f30168739b5795846d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/{2f5173deea6c795b8fdde723bb4b63af → d5a48c6656341c56cac8a8e42bb925a5} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/{cffd775d018f68ce5dba1ee0d951a994 → de0932670a6c856bc6eda1586fd29061} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de94a60b438eb5bf57653f3a220acd80 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e22019b3c13c20bc08e899fb2b7248ea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e9abb671d48f6ff2be6ffb463ea652bf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/eeb5bd38d1dad0d908461fd114f702bc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fde9e78f8d55a70f4ef757638fc6cde0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fdfac6623944c5a23737724cbd90e58e +0 -0
- data/test/dummy/tmp/ember-rails/ember-data.js +3787 -5850
- data/test/dummy/tmp/generator_test_output/Gemfile +45 -0
- data/test/dummy/tmp/generator_test_output/app/assets/javascripts/application.js +16 -0
- data/test/dummy/tmp/generator_test_output/app/assets/javascripts/custom/application.js +16 -0
- data/test/dummy/tmp/generator_test_output/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/tmp/generator_test_output/app/views/post.js.es6 +2 -0
- data/test/fixtures/rails_4-0-0_Gemfile +45 -0
- data/test/fixtures/rails_4-0-0_application.js +16 -0
- data/test/fixtures/rails_4-0-0_application_layout +14 -0
- data/test/generators/bootstrap_generator_test.rb +72 -17
- data/test/generators/component_generator_test.rb +13 -20
- data/test/generators/controller_generator_test.rb +7 -18
- data/test/generators/helper_generator_test.rb +16 -0
- data/test/generators/model_generator_test.rb +7 -14
- data/test/generators/resource_generator_test.rb +12 -11
- data/test/generators/resource_override_test.rb +29 -0
- data/test/generators/route_generator_test.rb +1 -9
- data/test/generators/scaffold_generator_test.rb +48 -0
- data/test/generators/template_generator_test.rb +4 -10
- data/test/generators/view_generator_test.rb +11 -18
- data/test/integration/navigation_test.rb +11 -3
- data/test/support/generator_test_support.rb +59 -18
- data/test/support/integration_test_support.rb +12 -0
- data/vendor/assets/javascripts/app.js.es6.erb +27 -0
- data/vendor/assets/javascripts/ember-appkit/index.js +1 -0
- data/vendor/assets/javascripts/ember-appkit/resolver.js +13 -9
- metadata +133 -90
- data/lib/generators/templates/application.js +0 -2
- data/lib/generators/templates/ember-app.js.es6 +0 -15
- data/test/dummy/app/assets/javascripts/components/my-component.js.es6 +0 -4
- data/test/dummy/app/assets/javascripts/controllers/index.js.es6 +0 -7
- data/test/dummy/app/assets/javascripts/ember-app.js +0 -9
- data/test/dummy/app/assets/javascripts/models/person.js.es6 +0 -3
- data/test/dummy/app/assets/javascripts/routes/index.js.es6 +0 -13
- data/test/dummy/app/assets/javascripts/templates/application.hbs +0 -2
- data/test/dummy/app/assets/javascripts/templates/components/my-component.hbs +0 -1
- data/test/dummy/app/assets/javascripts/templates/index.hbs +0 -6
- data/test/dummy/tmp/app/assets/javascripts/templates/post.hbs +0 -5
- data/test/dummy/tmp/cache/assets/test/sprockets/19c9bc7dbf67a891e93c7a663a62ff1c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/22d5df6f378a04858f2123ee6e176ff1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/30e6b42a491dc4952ff020137405d502 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/331122f2f78d79778408023cf5bad1e3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/34b3026e7f937c6a19a0aee7f8451aad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/36b770b8db4bb47ce9c524d7104be2e9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4bde569e155e5abfc2bc79bb61721688 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/720ee922899be7948cc2a8b27660ce0b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7689ffe6d7c831ee178e07106482b2cc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7bf1770d3a1c8bc1b59a4bc89d5c4bca +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7d008b32a16b10ea72ea849f47d9a095 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8e9feb35d7e388f760d17aaf89b32731 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b3a5b51571520b61f892c51e979b9f53 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c0bb6b15bdd48873e96974816e18abe9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e2a67ad17895f7711966ca1a5ff7af86 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e44f5ebcd8f42995512e64b96b63c9cf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e8aa57b28c86586b8b7344feb891c43f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ed5238112abbfd6a794a100804365903 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/generator_test_output/app/assets/javascripts/views/post.js.es6 +0 -3
- data/vendor/assets/javascripts/app.js.es6 +0 -13
@@ -0,0 +1,45 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
4
|
+
gem 'rails', '4.0.1'
|
5
|
+
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'sqlite3'
|
8
|
+
|
9
|
+
# Use SCSS for stylesheets
|
10
|
+
gem 'sass-rails', '~> 4.0.0'
|
11
|
+
|
12
|
+
# Use Uglifier as compressor for JavaScript assets
|
13
|
+
gem 'uglifier', '>= 1.3.0'
|
14
|
+
|
15
|
+
# Use CoffeeScript for .js.coffee assets and views
|
16
|
+
gem 'coffee-rails', '~> 4.0.0'
|
17
|
+
|
18
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
19
|
+
# gem 'therubyracer', platforms: :ruby
|
20
|
+
|
21
|
+
# Use jquery as the JavaScript library
|
22
|
+
gem 'jquery-rails'
|
23
|
+
|
24
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
25
|
+
gem 'turbolinks'
|
26
|
+
|
27
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
28
|
+
gem 'jbuilder', '~> 1.2'
|
29
|
+
|
30
|
+
group :doc do
|
31
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
32
|
+
gem 'sdoc', require: false
|
33
|
+
end
|
34
|
+
|
35
|
+
# Use ActiveModel has_secure_password
|
36
|
+
# gem 'bcrypt-ruby', '~> 3.1.2'
|
37
|
+
|
38
|
+
# Use unicorn as the app server
|
39
|
+
# gem 'unicorn'
|
40
|
+
|
41
|
+
# Use Capistrano for deployment
|
42
|
+
# gem 'capistrano', group: :development
|
43
|
+
|
44
|
+
# Use debugger
|
45
|
+
# gem 'debugger', group: [:development, :test]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SampleRails400</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
4
|
+
gem 'rails', '4.0.1'
|
5
|
+
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'sqlite3'
|
8
|
+
|
9
|
+
# Use SCSS for stylesheets
|
10
|
+
gem 'sass-rails', '~> 4.0.0'
|
11
|
+
|
12
|
+
# Use Uglifier as compressor for JavaScript assets
|
13
|
+
gem 'uglifier', '>= 1.3.0'
|
14
|
+
|
15
|
+
# Use CoffeeScript for .js.coffee assets and views
|
16
|
+
gem 'coffee-rails', '~> 4.0.0'
|
17
|
+
|
18
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
19
|
+
# gem 'therubyracer', platforms: :ruby
|
20
|
+
|
21
|
+
# Use jquery as the JavaScript library
|
22
|
+
gem 'jquery-rails'
|
23
|
+
|
24
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
25
|
+
gem 'turbolinks'
|
26
|
+
|
27
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
28
|
+
gem 'jbuilder', '~> 1.2'
|
29
|
+
|
30
|
+
group :doc do
|
31
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
32
|
+
gem 'sdoc', require: false
|
33
|
+
end
|
34
|
+
|
35
|
+
# Use ActiveModel has_secure_password
|
36
|
+
# gem 'bcrypt-ruby', '~> 3.1.2'
|
37
|
+
|
38
|
+
# Use unicorn as the app server
|
39
|
+
# gem 'unicorn'
|
40
|
+
|
41
|
+
# Use Capistrano for deployment
|
42
|
+
# gem 'capistrano', group: :development
|
43
|
+
|
44
|
+
# Use debugger
|
45
|
+
# gem 'debugger', group: [:development, :test]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SampleRails400</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -7,7 +7,7 @@ class BootstrapGeneratorTest < Rails::Generators::TestCase
|
|
7
7
|
tests Ember::Generators::BootstrapGenerator
|
8
8
|
destination File.join(Rails.root, "tmp", "generator_test_output")
|
9
9
|
|
10
|
-
setup :prepare_destination
|
10
|
+
setup :prepare_destination, :copy_application
|
11
11
|
|
12
12
|
test "Assert folder layout and .gitkeep files are properly created" do
|
13
13
|
run_generator []
|
@@ -16,38 +16,93 @@ class BootstrapGeneratorTest < Rails::Generators::TestCase
|
|
16
16
|
|
17
17
|
test "create bootstrap" do
|
18
18
|
run_generator []
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
assert_files
|
21
21
|
end
|
22
22
|
|
23
|
-
test "create bootstrap with and custom path" do
|
24
|
-
custom_path =
|
25
|
-
run_generator ["-
|
26
|
-
|
27
|
-
|
23
|
+
test "create bootstrap with and custom app path" do
|
24
|
+
custom_path = app_path("custom")
|
25
|
+
run_generator ["-a", custom_path]
|
26
|
+
|
27
|
+
assert_files custom_path, config_path
|
28
|
+
assert_file 'config/application.rb', /config\.ember\.appkit\.paths\.app = '#{custom_path}'/
|
29
|
+
end
|
30
|
+
|
31
|
+
test "create bootstrap with and custom config path" do
|
32
|
+
custom_path = config_path("custom")
|
33
|
+
run_generator ["-c", custom_path]
|
34
|
+
|
35
|
+
assert_files app_path, custom_path
|
36
|
+
assert_file 'config/application.rb', /config\.ember\.appkit\.paths\.config = '#{custom_path}'/
|
28
37
|
end
|
29
38
|
|
30
39
|
test "create bootstrap with custom app name" do
|
31
40
|
run_generator ["-n", "MyApp"]
|
32
|
-
|
33
|
-
assert_file "#{
|
41
|
+
|
42
|
+
assert_file "#{config_path}/application.js", /MyApp = /
|
43
|
+
|
44
|
+
assert_files
|
34
45
|
end
|
35
46
|
|
36
47
|
test "Uses config.ember.app_name" do
|
37
48
|
with_config app_name: 'Blazorz' do
|
38
49
|
run_generator
|
39
|
-
|
40
|
-
|
50
|
+
|
51
|
+
assert_files
|
52
|
+
assert_file "#{config_path}/application.js", /Blazorz = /
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
44
|
-
test "Uses config.ember.
|
45
|
-
|
56
|
+
test "Uses config.ember.appkit.paths.app" do
|
57
|
+
custom_app_path = app_path("custom_app")
|
58
|
+
custom_config_path = app_path("custom_config")
|
46
59
|
|
47
|
-
with_config
|
60
|
+
with_config paths: {app: custom_app_path, config: custom_config_path} do
|
48
61
|
run_generator
|
49
|
-
|
50
|
-
|
62
|
+
|
63
|
+
assert_files custom_app_path, custom_config_path
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
test "Removes turbolinks" do
|
68
|
+
run_generator
|
69
|
+
|
70
|
+
confirm_turbolinks_removed "Gemfile"
|
71
|
+
confirm_turbolinks_removed "app/views/layouts/application.html.erb"
|
72
|
+
end
|
73
|
+
|
74
|
+
test "Removed app/assets/javascript directory" do
|
75
|
+
run_generator
|
76
|
+
assert_no_directory "app/assets/javascripts"
|
77
|
+
end
|
78
|
+
|
79
|
+
test "Does not error if Gemfile is missing" do
|
80
|
+
FileUtils.rm destination_root + '/Gemfile'
|
81
|
+
run_generator
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def assert_files(app_path = app_path, config_path = config_path)
|
87
|
+
assert_file "#{config_path}/environment.js"
|
88
|
+
assert_file "#{config_path}/environments/development.js"
|
89
|
+
assert_file "#{config_path}/environments/production.js"
|
90
|
+
assert_file "#{config_path}/environments/test.js"
|
91
|
+
assert_file "#{config_path}/application.js"
|
92
|
+
assert_file "#{config_path}/router.js.es6"
|
93
|
+
assert_file "#{config_path}/adapter.js"
|
94
|
+
assert_file "#{config_path}/initializers/csrf.js"
|
95
|
+
end
|
96
|
+
|
97
|
+
def confirm_turbolinks_removed(file)
|
98
|
+
assert_file file do |content|
|
99
|
+
assert_no_match(/turbolinks/, content)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def confirm_turbolinks_not_removed(file)
|
104
|
+
assert_file file do |content|
|
105
|
+
assert_match(/turbolinks/, content)
|
51
106
|
end
|
52
107
|
end
|
53
108
|
end
|
@@ -11,45 +11,38 @@ class ComponentGeneratorTest < Rails::Generators::TestCase
|
|
11
11
|
|
12
12
|
test "default_component" do
|
13
13
|
run_generator ["PostChart"]
|
14
|
-
assert_file "
|
15
|
-
assert_file "
|
14
|
+
assert_file "#{app_path}/components/post-chart_component.js.es6"
|
15
|
+
assert_file "#{app_path}/templates/components/post-chart.hbs"
|
16
16
|
end
|
17
17
|
|
18
18
|
test "Assert files are properly created (CamelCase)" do
|
19
19
|
run_generator %w(PostChart)
|
20
|
-
assert_file "#{
|
21
|
-
assert_file "#{
|
20
|
+
assert_file "#{app_path}/components/post-chart_component.js.es6"
|
21
|
+
assert_file "#{app_path}/templates/components/post-chart.hbs"
|
22
22
|
end
|
23
23
|
|
24
24
|
test "Assert object names are properly created with CamelCase name" do
|
25
25
|
run_generator %w(PostChart)
|
26
|
-
assert_file "#{
|
27
|
-
assert_file "#{
|
26
|
+
assert_file "#{app_path}/components/post-chart_component.js.es6"
|
27
|
+
assert_file "#{app_path}/templates/components/post-chart.hbs"
|
28
28
|
end
|
29
29
|
|
30
30
|
test "Assert files are properly created (lower-case)" do
|
31
31
|
run_generator %w(post-chart)
|
32
|
-
assert_file "#{
|
33
|
-
assert_file "#{
|
32
|
+
assert_file "#{app_path}/components/post-chart_component.js.es6"
|
33
|
+
assert_file "#{app_path}/templates/components/post-chart.hbs"
|
34
34
|
end
|
35
35
|
|
36
36
|
test "Assert object names are properly created with lower-case name" do
|
37
37
|
run_generator %w(post-chart)
|
38
|
-
assert_file "#{
|
39
|
-
assert_file "#{
|
38
|
+
assert_file "#{app_path}/components/post-chart_component.js.es6"
|
39
|
+
assert_file "#{app_path}/templates/components/post-chart.hbs"
|
40
40
|
end
|
41
41
|
|
42
|
-
test "
|
43
|
-
custom_path =
|
44
|
-
run_generator [ "PostChart", "-d", custom_path ]
|
45
|
-
assert_file "#{custom_path}/components/post-chart_component.js.es6"
|
46
|
-
assert_file "#{custom_path}/templates/components/post-chart.hbs"
|
47
|
-
end
|
48
|
-
|
49
|
-
test "Uses config.ember.ember_path" do
|
50
|
-
custom_path = ember_path("custom")
|
42
|
+
test "Uses config.ember.appkit.paths.app" do
|
43
|
+
custom_path = app_path("custom")
|
51
44
|
|
52
|
-
with_config
|
45
|
+
with_config paths: {app: custom_path} do
|
53
46
|
run_generator ["PostChart"]
|
54
47
|
assert_file "#{custom_path}/components/post-chart_component.js.es6"
|
55
48
|
assert_file "#{custom_path}/templates/components/post-chart.hbs"
|
@@ -11,39 +11,28 @@ class ControllerGeneratorTest < Rails::Generators::TestCase
|
|
11
11
|
|
12
12
|
test "array_controller" do
|
13
13
|
run_generator ["post", "--array"]
|
14
|
-
assert_file "
|
14
|
+
assert_file "#{app_path}/controllers/post.js.es6"
|
15
15
|
end
|
16
16
|
|
17
17
|
test "object_controller" do
|
18
18
|
run_generator ["post", "--object"]
|
19
|
-
assert_file "
|
19
|
+
assert_file "#{app_path}/controllers/post.js.es6"
|
20
20
|
end
|
21
21
|
|
22
22
|
test "default_controller" do
|
23
23
|
run_generator ["post"]
|
24
|
-
assert_file "
|
25
|
-
end
|
26
|
-
|
27
|
-
test "default_controller namespaced" do
|
28
|
-
run_generator ["post/index"]
|
29
|
-
assert_file "#{ember_path}/controllers/post/index.js.es6", /PostIndexController/
|
24
|
+
assert_file "#{app_path}/controllers/post.js.es6"
|
30
25
|
end
|
31
26
|
|
32
27
|
test "Assert files are properly created" do
|
33
28
|
run_generator %w(ember)
|
34
|
-
assert_file "#{
|
35
|
-
end
|
36
|
-
|
37
|
-
test "Assert files are properly created with custom path" do
|
38
|
-
custom_path = ember_path("custom")
|
39
|
-
run_generator [ "ember", "-d", custom_path ]
|
40
|
-
assert_file "#{custom_path}/controllers/ember.js.es6"
|
29
|
+
assert_file "#{app_path}/controllers/ember.js.es6"
|
41
30
|
end
|
42
31
|
|
43
|
-
test "Uses config.ember.
|
44
|
-
custom_path =
|
32
|
+
test "Uses config.ember.appkit.paths.app" do
|
33
|
+
custom_path = app_path("custom")
|
45
34
|
|
46
|
-
with_config
|
35
|
+
with_config paths: {app: custom_path} do
|
47
36
|
run_generator ["post", "--object"]
|
48
37
|
assert_file "#{custom_path}/controllers/post.js.es6"
|
49
38
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/ember/helper_generator'
|
3
|
+
|
4
|
+
class HelperGeneratorTest < Rails::Generators::TestCase
|
5
|
+
include GeneratorTestSupport
|
6
|
+
|
7
|
+
tests Ember::Generators::HelperGenerator
|
8
|
+
destination File.join(Rails.root, 'tmp')
|
9
|
+
|
10
|
+
setup :prepare_destination
|
11
|
+
|
12
|
+
test 'Generates helper correctly' do
|
13
|
+
run_generator ['catdog']
|
14
|
+
assert_file "#{app_path}/helpers/catdog.js", /catdog/
|
15
|
+
end
|
16
|
+
end
|
@@ -11,36 +11,29 @@ class ModelGeneratorTest < Rails::Generators::TestCase
|
|
11
11
|
|
12
12
|
test "create model" do
|
13
13
|
run_generator ["post", "title:string"]
|
14
|
-
assert_file "
|
14
|
+
assert_file "#{app_path}/models/post.js.es6"
|
15
15
|
end
|
16
16
|
|
17
17
|
test "create namespaced model" do
|
18
18
|
run_generator ["post/doineedthis", "title:string"]
|
19
|
-
assert_file "
|
19
|
+
assert_file "#{app_path}/models/post/doineedthis.js.es6"
|
20
20
|
end
|
21
21
|
|
22
22
|
test "leave parentheses when create model w/o attributes" do
|
23
23
|
run_generator ["post"]
|
24
|
-
assert_file "
|
24
|
+
assert_file "#{app_path}/models/post.js.es6", /export default DS.Model.extend/
|
25
25
|
end
|
26
26
|
|
27
27
|
test "Assert files are properly created" do
|
28
28
|
run_generator %w(ember)
|
29
29
|
|
30
|
-
assert_file "#{
|
30
|
+
assert_file "#{app_path}/models/ember.js.es6"
|
31
31
|
end
|
32
32
|
|
33
|
-
test "
|
34
|
-
custom_path =
|
35
|
-
run_generator [ "ember", "-d", custom_path ]
|
33
|
+
test "Uses config.ember.appkit.paths.app" do
|
34
|
+
custom_path = app_path("custom")
|
36
35
|
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
test "Uses config.ember.ember_path" do
|
41
|
-
custom_path = ember_path("custom")
|
42
|
-
|
43
|
-
with_config ember_path: custom_path do
|
36
|
+
with_config paths: {app: custom_path} do
|
44
37
|
run_generator ["ember"]
|
45
38
|
assert_file "#{custom_path}/models/ember.js.es6"
|
46
39
|
end
|