From 8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 13 Nov 2017 15:23:28 -0500 Subject: Use .tt extension to all the template files Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878. --- .../channel/templates/application_cable/channel.rb | 4 ---- .../channel/templates/application_cable/channel.rb.tt | 4 ++++ .../channel/templates/application_cable/connection.rb | 4 ---- .../templates/application_cable/connection.rb.tt | 4 ++++ .../rails/generators/channel/templates/assets/cable.js | 13 ------------- .../generators/channel/templates/assets/cable.js.tt | 13 +++++++++++++ .../generators/channel/templates/assets/channel.coffee | 14 -------------- .../channel/templates/assets/channel.coffee.tt | 14 ++++++++++++++ .../generators/channel/templates/assets/channel.js | 18 ------------------ .../generators/channel/templates/assets/channel.js.tt | 18 ++++++++++++++++++ .../lib/rails/generators/channel/templates/channel.rb | 16 ---------------- .../rails/generators/channel/templates/channel.rb.tt | 16 ++++++++++++++++ 12 files changed, 69 insertions(+), 69 deletions(-) delete mode 100644 actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb create mode 100644 actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb.tt delete mode 100644 actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb create mode 100644 actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb.tt delete mode 100644 actioncable/lib/rails/generators/channel/templates/assets/cable.js create mode 100644 actioncable/lib/rails/generators/channel/templates/assets/cable.js.tt delete mode 100644 actioncable/lib/rails/generators/channel/templates/assets/channel.coffee create mode 100644 actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt delete mode 100644 actioncable/lib/rails/generators/channel/templates/assets/channel.js create mode 100644 actioncable/lib/rails/generators/channel/templates/assets/channel.js.tt delete mode 100644 actioncable/lib/rails/generators/channel/templates/channel.rb create mode 100644 actioncable/lib/rails/generators/channel/templates/channel.rb.tt (limited to 'actioncable/lib/rails/generators') diff --git a/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb b/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb deleted file mode 100644 index d672697283..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb.tt b/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb.tt new file mode 100644 index 0000000000..d672697283 --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb.tt @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb b/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb deleted file mode 100644 index 0ff5442f47..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb.tt b/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb.tt new file mode 100644 index 0000000000..0ff5442f47 --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb.tt @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/actioncable/lib/rails/generators/channel/templates/assets/cable.js b/actioncable/lib/rails/generators/channel/templates/assets/cable.js deleted file mode 100644 index 739aa5f022..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/assets/cable.js +++ /dev/null @@ -1,13 +0,0 @@ -// Action Cable provides the framework to deal with WebSockets in Rails. -// You can generate new channels where WebSocket features live using the `rails generate channel` command. -// -//= require action_cable -//= require_self -//= require_tree ./channels - -(function() { - this.App || (this.App = {}); - - App.cable = ActionCable.createConsumer(); - -}).call(this); diff --git a/actioncable/lib/rails/generators/channel/templates/assets/cable.js.tt b/actioncable/lib/rails/generators/channel/templates/assets/cable.js.tt new file mode 100644 index 0000000000..739aa5f022 --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/assets/cable.js.tt @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the `rails generate channel` command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee deleted file mode 100644 index 5467811aba..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee +++ /dev/null @@ -1,14 +0,0 @@ -App.<%= class_name.underscore %> = App.cable.subscriptions.create "<%= class_name %>Channel", - connected: -> - # Called when the subscription is ready for use on the server - - disconnected: -> - # Called when the subscription has been terminated by the server - - received: (data) -> - # Called when there's incoming data on the websocket for this channel -<% actions.each do |action| -%> - - <%= action %>: -> - @perform '<%= action %>' -<% end -%> diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt new file mode 100644 index 0000000000..5467811aba --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt @@ -0,0 +1,14 @@ +App.<%= class_name.underscore %> = App.cable.subscriptions.create "<%= class_name %>Channel", + connected: -> + # Called when the subscription is ready for use on the server + + disconnected: -> + # Called when the subscription has been terminated by the server + + received: (data) -> + # Called when there's incoming data on the websocket for this channel +<% actions.each do |action| -%> + + <%= action %>: -> + @perform '<%= action %>' +<% end -%> diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.js b/actioncable/lib/rails/generators/channel/templates/assets/channel.js deleted file mode 100644 index ab0e68b11a..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/assets/channel.js +++ /dev/null @@ -1,18 +0,0 @@ -App.<%= class_name.underscore %> = App.cable.subscriptions.create("<%= class_name %>Channel", { - connected: function() { - // Called when the subscription is ready for use on the server - }, - - disconnected: function() { - // Called when the subscription has been terminated by the server - }, - - received: function(data) { - // Called when there's incoming data on the websocket for this channel - }<%= actions.any? ? ",\n" : '' %> -<% actions.each do |action| -%> - <%=action %>: function() { - return this.perform('<%= action %>'); - }<%= action == actions[-1] ? '' : ",\n" %> -<% end -%> -}); diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.js.tt b/actioncable/lib/rails/generators/channel/templates/assets/channel.js.tt new file mode 100644 index 0000000000..ab0e68b11a --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/assets/channel.js.tt @@ -0,0 +1,18 @@ +App.<%= class_name.underscore %> = App.cable.subscriptions.create("<%= class_name %>Channel", { + connected: function() { + // Called when the subscription is ready for use on the server + }, + + disconnected: function() { + // Called when the subscription has been terminated by the server + }, + + received: function(data) { + // Called when there's incoming data on the websocket for this channel + }<%= actions.any? ? ",\n" : '' %> +<% actions.each do |action| -%> + <%=action %>: function() { + return this.perform('<%= action %>'); + }<%= action == actions[-1] ? '' : ",\n" %> +<% end -%> +}); diff --git a/actioncable/lib/rails/generators/channel/templates/channel.rb b/actioncable/lib/rails/generators/channel/templates/channel.rb deleted file mode 100644 index 4bcfb2be4d..0000000000 --- a/actioncable/lib/rails/generators/channel/templates/channel.rb +++ /dev/null @@ -1,16 +0,0 @@ -<% module_namespacing do -%> -class <%= class_name %>Channel < ApplicationCable::Channel - def subscribed - # stream_from "some_channel" - end - - def unsubscribed - # Any cleanup needed when channel is unsubscribed - end -<% actions.each do |action| -%> - - def <%= action %> - end -<% end -%> -end -<% end -%> diff --git a/actioncable/lib/rails/generators/channel/templates/channel.rb.tt b/actioncable/lib/rails/generators/channel/templates/channel.rb.tt new file mode 100644 index 0000000000..4bcfb2be4d --- /dev/null +++ b/actioncable/lib/rails/generators/channel/templates/channel.rb.tt @@ -0,0 +1,16 @@ +<% module_namespacing do -%> +class <%= class_name %>Channel < ApplicationCable::Channel + def subscribed + # stream_from "some_channel" + end + + def unsubscribed + # Any cleanup needed when channel is unsubscribed + end +<% actions.each do |action| -%> + + def <%= action %> + end +<% end -%> +end +<% end -%> -- cgit v1.2.3