frenerator 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf185ff7acf00d990c9888c601057da85f2418e4
4
- data.tar.gz: a8481e52903c0227eccf7b48b88a06eb02442a7f
3
+ metadata.gz: db1c4c0dd27671d815b1f18d697be30f35416a44
4
+ data.tar.gz: 8fc80fdb30ba1a37475628df1283b2acecd3f61a
5
5
  SHA512:
6
- metadata.gz: c22bc762fcf0fe4aa22581b2374db0b4069dad335ef54892ddf9a8f77c1c2425bb5fac3f21e42c23de879f0ec88eeff66e044cd2faad6bf563cb622c55fbb8db
7
- data.tar.gz: 393ac733939facf3c5f6f86324c564ecd4b8ef708afe03044c0258e019f0fcd483c2b1be593b5a10467f56eb6757cb79290253beb35a7576b1f56394208a40f7
6
+ metadata.gz: edc25362185a0e41dcbabd099d98c6a8277ab5e901b17ee78e454ef9f290d35c9730303b550909cd9fbd83a8d05be07de185f4a024eff7be9d308ead8b4d66ae
7
+ data.tar.gz: ce6053b646e3141ca8e92ea469ed905bf458eb4e746c19c01d13b4eab9659733b74e7c5ad9a09a6665c95016efbbeaab55fca5e129a2243095a7aeb24cbc4f57
data/README.md CHANGED
@@ -31,17 +31,19 @@ configured with `bundleExec: true` to make sure everyone is on the same page.
31
31
 
32
32
  Main javascript file is `application.js` (the one that gets included via a `script` tag)
33
33
 
34
+ #### Dependencies
35
+
34
36
  Sprockets for dependency management: `application.js` includes app parts:
35
37
 
36
- 1. `dependencies` Place to include all libs, frameworks, etc.
37
- 2. `namespace` Gives common top level structure and defines `App`
38
- 3. `templates` Handlebars templates
39
- 4. `base` Define base coffee classes here
40
- 5. `collections` -||- collections
41
- 6. `models` -||- models
42
- 7. `views` -||- views
43
- 8. `components` All the top level backbone views live here
44
- 9. `main` - the init code
38
+ 1. `dependencies` Place to include all libs, frameworks, etc.
39
+ 2. `namespace` Gives common top level structure and defines `App`
40
+ 3. `templates` Handlebars templates
41
+ 4. `base` Define base coffee classes here
42
+ 5. `collections` -||- collections
43
+ 6. `models` -||- models
44
+ 7. `views` -||- views
45
+ 8. `components` All the top level backbone views live here
46
+ 9. `main` - the init code
45
47
 
46
48
  _You HAVE to manually include all the components you want to use inside `components.coffee`
47
49
  or your component code will not be compiled in `application.js`_
@@ -62,6 +64,35 @@ on something else, you can wait until `app:ready` to do your work. It will be mo
62
64
  likely that the component you are depending on will be available at the time this
63
65
  event is fired, rather than in your `@initialize` method
64
66
 
67
+ ##### Intercomponent communication conventions (events and stuff)
68
+
69
+ For controlling components from other components and triggering events you would like
70
+ other components to be able to hook into, use the global events channel - `App.Dispatch`.
71
+ As far as naming convention goes, events that a component is listening and responding to
72
+ should start with `tell:`. The common form is `tell:{component}:to_{do_something}`.
73
+ Events that are emmited in the global channel should be in the form `{component}:{event}`
74
+
75
+ Example:
76
+
77
+ ```coffeescript
78
+ App.Components.Mothership extends App.View
79
+
80
+ initialize: =>
81
+ @listenTo App.Dispatch, 'tell:mothership:to_takeoff', @takeoff
82
+
83
+ takeoff: =>
84
+ while @speed <= @V2
85
+ @speed += 1
86
+ App.Dispatch.trigger 'mothership:is_airborne'
87
+
88
+ ```
89
+
90
+ You might find that you have a view that is reused within several components (e.g. you have
91
+ more than one instance of that view in memory) and there is no way for other things to tell
92
+ which instance is emmiting the event, so they can't hook into the correct event. In these
93
+ cases try to find something unique about each instance and put it in the event name after
94
+ the `component` name. For example: `tell:drone:#{id}:to_patrol`. I usually use a DOM id.
95
+
65
96
  ## Development
66
97
 
67
98
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module Frenerator
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -75,7 +75,8 @@ module.exports = function (grunt) {
75
75
  files: [
76
76
  'app/assets/javascripts/templates/*.hbs',
77
77
  'app/components/**/*.hbs'
78
- ]
78
+ ],
79
+ tasks: ['handlebars']
79
80
  },
80
81
  coffee: {
81
82
  files: [
@@ -18,5 +18,7 @@ guard 'livereload' do
18
18
  # Templates
19
19
  watch('app/assets/javascripts/templates.js')
20
20
  watch(%r{app/assets/stylesheets/(.+\.scss).*$}) { |m| "assets/#{m[1]}" }
21
+ watch(%r{app/assets/javascripts/(.+\.coffee).*$}) { |m| "assets/#{m[1]}" }
22
+ watch(%r{app/components/(.+\.coffee).*$}) { |m| "assets/#{m[1]}" }
21
23
  watch(%r{app/components/(.+\.scss).*$}) { |m| "assets/#{m[1]}" }
22
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frenerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Karasavov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties