Skip to content
Browse files

Updated to 1.0.2

  • Loading branch information...
1 parent 20a7693 commit 3ef6a76563d5ff73bff5210a598f310f85c8fa0b Kevin Malakoff committed Sep 18, 2012
Showing with 118 additions and 110 deletions.
  1. +12 −27 README.md
  2. +10 −1 RELEASE_NOTES.md
  3. +12 −27 packages/npm/README.md
  4. +42 −1 test/core/test-amd.coffee
  5. +42 −1 test/core/test.coffee
  6. +0 −1 test/core/test.html
  7. +0 −1 test/core/test.min.html
  8. +0 −51 test/core/test_coffeescript.coffee
View
39 README.md
@@ -1,16 +1,23 @@
Lifecycle.js provides conventions and helpers to manage the life cycles of Javascript instances.
+#Download Latest (1.1.2):
-You can get the library here:
+Please see the [release notes](https://github.com/kmalakoff/lifecycle/blob/master/RELEASE_NOTES.md) for upgrade pointers.
-* [Development version][1]
-* [Production version][2]
+* [Development version](https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.js)
+* [Production version](https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.min.js)
+
+###Module Loading
+
+Lifecycle.js is compatible with RequireJS, CommonJS, Brunch and AMD module loading. Module names:
+
+* 'lifecycle' - lifecycle.js.
Introduction
------------
If you need to write code that manages the lifecycle of some javascript objects, but you don't know ahead of time what type of lifecycle model they implement, Lifecycle.js is for you!
-A good example of this is [Backbone.Articulation][3]. Backbone.Articulation will reconstruct instances of Dates or custom classes within you Backbone.Model's attributes irregardless of what lifecycle model they use (as long as they use one of the known conventions!)
+A good example of this is [Backbone.Articulation](https://github.com/kmalakoff/backbone-articulation). Backbone.Articulation will reconstruct instances of Dates or custom classes within you Backbone.Model's attributes irregardless of what lifecycle model they use (as long as they use one of the known conventions!)
# LC.own and LC.disown
Manages the lifecycle of individual instances, objects, arrays, and object properties that comply with some lifecycle conventions:
@@ -87,23 +94,6 @@ instance.release(); // ref_count = 1
instance.release(); // ref_count = 0 and __destroy() called
```
-# Release Notes
-
-###1.0.2
-
-- converted back to CoffeeScript
-
-- build using easy-bake
-
-- added packaging tests
-
-- added extend() functionality for JavaScript and CoffeeScript class usability
-
-- changed convention from _destroy() to __destroy() given that some libraries (like KnockoutJS) use _destroy for other purposes
-
-- removed Lifecycle alias
-
-
Building, Running and Testing the library
-----------------------
@@ -114,9 +104,4 @@ Building, Running and Testing the library
###Commands:
-Look at: https://github.com/kmalakoff/easy-bake
-
-[1]: https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.js
-[2]: https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.min.js
-[3]: https://github.com/kmalakoff/backbone-articulation
-
+Look at: https://github.com/kmalakoff/easy-bake
View
11 RELEASE_NOTES.md
@@ -3,4 +3,13 @@ Please refer to the following release notes when upgrading your version of Lifec
## 1.0.2
* renamed _destroy to __destroy to avoid conflicts.
-* added AMD loader.
+* added AMD loader.
+
+## 1.0.1
+
+* converted back to CoffeeScript
+* build using easy-bake
+* added packaging tests
+* added extend() functionality for JavaScript and CoffeeScript class usability
+* changed convention from _destroy() to __destroy() given that some libraries (like KnockoutJS) use _destroy for other purposes
+* removed Lifecycle alias
View
39 packages/npm/README.md
@@ -1,16 +1,23 @@
Lifecycle.js provides conventions and helpers to manage the life cycles of Javascript instances.
+#Download Latest (1.1.2):
-You can get the library here:
+Please see the [release notes](https://github.com/kmalakoff/lifecycle/blob/master/RELEASE_NOTES.md) for upgrade pointers.
-* [Development version][1]
-* [Production version][2]
+* [Development version](https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.js)
+* [Production version](https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.min.js)
+
+###Module Loading
+
+Lifecycle.js is compatible with RequireJS, CommonJS, Brunch and AMD module loading. Module names:
+
+* 'lifecycle' - lifecycle.js.
Introduction
------------
If you need to write code that manages the lifecycle of some javascript objects, but you don't know ahead of time what type of lifecycle model they implement, Lifecycle.js is for you!
-A good example of this is [Backbone.Articulation][3]. Backbone.Articulation will reconstruct instances of Dates or custom classes within you Backbone.Model's attributes irregardless of what lifecycle model they use (as long as they use one of the known conventions!)
+A good example of this is [Backbone.Articulation](https://github.com/kmalakoff/backbone-articulation). Backbone.Articulation will reconstruct instances of Dates or custom classes within you Backbone.Model's attributes irregardless of what lifecycle model they use (as long as they use one of the known conventions!)
# LC.own and LC.disown
Manages the lifecycle of individual instances, objects, arrays, and object properties that comply with some lifecycle conventions:
@@ -87,23 +94,6 @@ instance.release(); // ref_count = 1
instance.release(); // ref_count = 0 and __destroy() called
```
-# Release Notes
-
-###1.0.2
-
-- converted back to CoffeeScript
-
-- build using easy-bake
-
-- added packaging tests
-
-- added extend() functionality for JavaScript and CoffeeScript class usability
-
-- changed convention from _destroy() to __destroy() given that some libraries (like KnockoutJS) use _destroy for other purposes
-
-- removed Lifecycle alias
-
-
Building, Running and Testing the library
-----------------------
@@ -114,9 +104,4 @@ Building, Running and Testing the library
###Commands:
-Look at: https://github.com/kmalakoff/easy-bake
-
-[1]: https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.js
-[2]: https://raw.github.com/kmalakoff/lifecycle/1.0.2/lifecycle.min.js
-[3]: https://github.com/kmalakoff/backbone-articulation
-
+Look at: https://github.com/kmalakoff/easy-bake
View
43 test/core/test-amd.coffee
@@ -16,7 +16,7 @@ clone = (obj) ->
(result[key]=obj[key] if obj.hasOwnProperty(key)) for key of obj
return result
-$(document).ready( ->
+$(->
module("lifecycle-amd.js")
# library and dependencies
@@ -241,5 +241,46 @@ $(document).ready( ->
raises((->instance.release()), null, 'LC.RefCounting: ref_count is corrupt')
equal(instance.is_alive, false, 'is gone')
)
+
+ test('ref countable (coffeescript)', ->
+
+ class MyClass extends LC.RefCountable
+ constructor: ->
+ super
+ @is_alive = true
+
+ __destroy: ->
+ @is_alive = false
+
+ instance = new MyClass()
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.refCount(), 1, '1 reference')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 3, '3 references')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.is_alive, true, 'is alive')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 3, '3 references')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 1, '1 reference')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 0, '0 references')
+ equal(instance.is_alive, false, 'is gone')
+
+ raises((->instance.release()), null, 'LC.RefCounting: ref_count is corrupt')
+ equal(instance.is_alive, false, 'is gone')
+ )
)
)
View
43 test/core/test.coffee
@@ -19,7 +19,7 @@ clone = (obj) ->
###############
# Start Tests
###############
-$(document).ready(->
+$(->
module("Lifecycle.js")
# import Lifecycle
@@ -245,4 +245,45 @@ $(document).ready(->
raises((->instance.release()), null, 'LC.RefCounting: ref_count is corrupt')
equal(instance.is_alive, false, 'is gone')
)
+
+ test('ref countable (coffeescript)', ->
+
+ class MyClass extends LC.RefCountable
+ constructor: ->
+ super
+ @is_alive = true
+
+ __destroy: ->
+ @is_alive = false
+
+ instance = new MyClass()
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.refCount(), 1, '1 reference')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 3, '3 references')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.is_alive, true, 'is alive')
+ equal(instance.retain(), instance, 'chaining')
+ equal(instance.refCount(), 3, '3 references')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 2, '2 references')
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 1, '1 reference')
+ equal(instance.is_alive, true, 'is alive')
+
+ equal(instance.release(), instance, 'chaining')
+ equal(instance.refCount(), 0, '0 references')
+ equal(instance.is_alive, false, 'is gone')
+
+ raises((->instance.release()), null, 'LC.RefCounting: ref_count is corrupt')
+ equal(instance.is_alive, false, 'is gone')
+ )
)
View
1 test/core/test.html
@@ -10,7 +10,6 @@
<script type="text/javascript" src="../../lifecycle.js"></script>
<script type="text/javascript" src="build/test.js"></script>
- <script type="text/javascript" src="build/test_coffeescript.js"></script>
</head>
<body>
View
1 test/core/test.min.html
@@ -10,7 +10,6 @@
<script type="text/javascript" src="../../lifecycle.min.js"></script>
<script type="text/javascript" src="build/test.js"></script>
- <script type="text/javascript" src="build/test_coffeescript.js"></script>
</head>
<body>
View
51 test/core/test_coffeescript.coffee
@@ -1,51 +0,0 @@
-$(document).ready(->
- module("Lifecycle.js")
-
- # import Lifecycle
- LC = if !window.LC && (typeof require != 'undefined') then require('lifecycle') else window.LC
-
- test("TEST DEPENDENCY MISSING", ->
- ok(!!LC)
- )
-
- test('ref countable (coffeescript)', ->
-
- class MyClass extends LC.RefCountable
- constructor: ->
- super
- @is_alive = true
-
- __destroy: ->
- @is_alive = false
-
- instance = new MyClass()
- equal(instance.is_alive, true, 'is alive')
-
- equal(instance.refCount(), 1, '1 reference')
- equal(instance.retain(), instance, 'chaining')
- equal(instance.refCount(), 2, '2 references')
- equal(instance.retain(), instance, 'chaining')
- equal(instance.refCount(), 3, '3 references')
- equal(instance.is_alive, true, 'is alive')
-
- equal(instance.release(), instance, 'chaining')
- equal(instance.refCount(), 2, '2 references')
- equal(instance.is_alive, true, 'is alive')
- equal(instance.retain(), instance, 'chaining')
- equal(instance.refCount(), 3, '3 references')
- equal(instance.is_alive, true, 'is alive')
-
- equal(instance.release(), instance, 'chaining')
- equal(instance.refCount(), 2, '2 references')
- equal(instance.release(), instance, 'chaining')
- equal(instance.refCount(), 1, '1 reference')
- equal(instance.is_alive, true, 'is alive')
-
- equal(instance.release(), instance, 'chaining')
- equal(instance.refCount(), 0, '0 references')
- equal(instance.is_alive, false, 'is gone')
-
- raises((->instance.release()), null, 'LC.RefCounting: ref_count is corrupt')
- equal(instance.is_alive, false, 'is gone')
- )
-)

0 comments on commit 3ef6a76

Please sign in to comment.
Something went wrong with that request. Please try again.