transponder 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ccccdc0818f754f37268ee96f20af335f421ea6
4
- data.tar.gz: 8815be6c4094582df1ea99e7a8e1758bf8565b0d
3
+ metadata.gz: 44c4428640dfc59dd3da8e81e89064a400ae9c50
4
+ data.tar.gz: d61643eed437b3f45b56a0dda2aef7050a7ebcc5
5
5
  SHA512:
6
- metadata.gz: 783c404f1a7d79249bf28ae721571855d8771646ec8b51d5c2972bc192ac81ce29e33b769e88f66c9f796588c9e18d7f670777fe384c54529ad2035b94e42159
7
- data.tar.gz: c03937b51975b092612c4537a7c70119125ef86989390d1f16ffa11c240f4bb03be380d64d2561184e40196f12daf618b2794d6ea648da40246b5c7bc30000c7
6
+ metadata.gz: 6a1cb5d7726e64a679d496bf1ddafd56727b306931d60b7aae121f403be1bba171755a848fe3e9421d02f5c113cab8af1d99dfb45d17d15249787ea714833c79
7
+ data.tar.gz: 833c3f18a8763f9959342031292a55c10b61b07d817338db58648c1871c7d421d9d44ab0e7d5b0ffcf0722355525548c204326b3b3b9084a0b1b64c2f4689276
@@ -3,17 +3,11 @@ class Transponder.Service
3
3
  element: null
4
4
  module: null
5
5
 
6
- constructor: ->
6
+ constructor: (element, message = {}) ->
7
7
  throw new Transponder.InvalidService('no service name specified.') unless @serviceName?
8
- _this = this
9
- serviceEvent = "#{_this.module}:services:#{_this.serviceName}"
10
- $(document).on serviceEvent, (e, message = {}) ->
11
- service = _this.serviceName
12
- $(".#{service}:not(#{service}_active)").each (i, f) ->
13
- _this.element = $(this)
14
- _this.element.addClass("#{service}_active")
15
- _this.serve(message)
16
-
17
-
8
+ @element = $(element)
9
+ @element.addClass("#{this.serviceName}_active")
10
+ @serve(message)
11
+
18
12
  serve: ->
19
13
 
@@ -6,4 +6,17 @@ window.Transponder =
6
6
  init: ->
7
7
  Transponder.eh = new Transponder.Error()
8
8
  Transponder.req = new Transponder.Request()
9
- Transponder.res = new Transponder.Response()
9
+ Transponder.res = new Transponder.Response()
10
+
11
+ buildServicesFor: (services) ->
12
+ serviceEvents = []
13
+ for _, service of services
14
+ serviceEvents.push("#{service::module}:services:#{service::serviceName}")
15
+
16
+ $(document).on serviceEvents.join(' '), (e, message = {}) ->
17
+ [module, _, service] = e.type.split(':')
18
+ $(".#{service}:not(#{service}_active)").each (i, f) ->
19
+ for _, fun of services
20
+ if fun::serviceName is service and fun::module is module
21
+ new fun(this, message)
22
+
@@ -14,6 +14,10 @@ module Transponder
14
14
  directory "#{options[:type].downcase}", base_path
15
15
  end
16
16
 
17
+ def add_boot
18
+ template "#{options[:type].downcase}_boot.coffee", base_path('initializers/boot.coffee')
19
+ end
20
+
17
21
  def add_setup
18
22
  template "#{options[:type].downcase}_setup.coffee", base_path('initializers/setup.coffee')
19
23
  end
@@ -4,3 +4,4 @@
4
4
 
5
5
 
6
6
  # services
7
+ Transponder.buildServicesFor(<%= file_name.camelize %>.Services)
@@ -4,3 +4,4 @@
4
4
 
5
5
 
6
6
  # services
7
+ Transponder.buildServicesFor(<%= file_name.camelize %>.Services)
@@ -10,18 +10,10 @@ module Transponder
10
10
  template "_service.coffee", service_path
11
11
  end
12
12
 
13
-
14
13
  def service_class_name
15
14
  "#{options[:module_name].camelize}.Services.#{file_name.camelize}"
16
15
  end
17
16
 
18
- def add_service_to_boot
19
- boot_file = File.join(javascripts_path, options[:module_name], 'initializers/boot.coffee')
20
- insert_into_file boot_file,
21
- "new #{service_class_name}()\n",
22
- after: "# services\n"
23
- end
24
-
25
17
  def add_service_to_manifest
26
18
  manifest_file = File.join(javascripts_path, options[:module_name], 'initializers/manifest.coffee')
27
19
  insert_into_file manifest_file,
@@ -1,3 +1,3 @@
1
1
  module Transponder
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transponder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Siri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails
@@ -46,25 +46,26 @@ files:
46
46
  - lib/generators/transponder/install/install_generator.rb
47
47
  - lib/generators/transponder/install/templates/application.coffee
48
48
  - lib/generators/transponder/install/templates/basic/helpers/.keep
49
- - lib/generators/transponder/install/templates/basic/initializers/boot.coffee
50
49
  - lib/generators/transponder/install/templates/basic/presenters/.keep
51
50
  - lib/generators/transponder/install/templates/basic/services/.keep
51
+ - lib/generators/transponder/install/templates/basic_boot.coffee
52
52
  - lib/generators/transponder/install/templates/basic_setup.coffee
53
53
  - lib/generators/transponder/install/templates/basic_shared.coffee
54
54
  - lib/generators/transponder/install/templates/full/collections/.keep
55
55
  - lib/generators/transponder/install/templates/full/helpers/.keep
56
- - lib/generators/transponder/install/templates/full/initializers/boot.coffee
57
56
  - lib/generators/transponder/install/templates/full/models/.keep
58
57
  - lib/generators/transponder/install/templates/full/presenters/.keep
59
58
  - lib/generators/transponder/install/templates/full/services/.keep
60
59
  - lib/generators/transponder/install/templates/full/templates/.keep
61
60
  - lib/generators/transponder/install/templates/full/views/.keep
61
+ - lib/generators/transponder/install/templates/full_boot.coffee
62
62
  - lib/generators/transponder/install/templates/full_setup.coffee
63
63
  - lib/generators/transponder/install/templates/full_shared.coffee
64
64
  - lib/generators/transponder/install/templates/manifest.coffee
65
65
  - lib/generators/transponder/install/templates/minimal/helpers/.keep
66
66
  - lib/generators/transponder/install/templates/minimal/initializers/boot.coffee
67
67
  - lib/generators/transponder/install/templates/minimal/services/.keep
68
+ - lib/generators/transponder/install/templates/minimal_boot.coffee
68
69
  - lib/generators/transponder/install/templates/minimal_setup.coffee
69
70
  - lib/generators/transponder/install/templates/minimal_shared.coffee
70
71
  - lib/generators/transponder/presenter/presenter_generator.rb
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
115
  version: '0'
115
116
  requirements: []
116
117
  rubyforge_project:
117
- rubygems_version: 2.2.2
118
+ rubygems_version: 2.5.1
118
119
  signing_key:
119
120
  specification_version: 4
120
121
  summary: This library gives you more control over rails ujs, it compliments turbolinks,