commandz 0.0.2 → 0.0.3

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: 331dea85970246369b095cc99b8660c3f9a93c04
4
- data.tar.gz: f00a9e210a47a18b3458a6f88ea0d96ba58a331c
3
+ metadata.gz: f2704f6b71bfb108f4089d4539879479a1f5e6c9
4
+ data.tar.gz: a7511dae7fbb4fa5b5d499947f1712718a3bc2c0
5
5
  SHA512:
6
- metadata.gz: f30b30d62d585f39e024587ca28bf156493862829757104e3e23700f5ee02e55d3a2719db6449a5c5cc638f547e8654f8578da4ef3fa8962a050688a14e4d3ef
7
- data.tar.gz: 410ba025d6b17e60f62f9db2a31bda7071e43401a710efa0880ace7f738b16be296bc093b7fa8cf6a9c3beb9c63e1b5a3b5d81e47a8b1f07b8c44473549fce31
6
+ metadata.gz: 0c650267d1bac2d6e1525a1f77a044cfd5929a9baed475f8b53a6bd51430b000731031a4182f196f3611d180f7bc2fe162a8c11fb4e07fc0d0f63dc9cec4b1b2
7
+ data.tar.gz: 076c76e6f4e9ba0dbfe2efaea07317a63eb902382ccf9ec0dfce6f7cf8dca245e039cf5e232cfd7fb4dee0ca92322ae05284de2e617ff03c907f498f865986c3
@@ -0,0 +1,4 @@
1
+ before_script: "sh -e /etc/init.d/xvfb start"
2
+ script: "DISPLAY=:99.0 bundle exec rake spec"
3
+ rvm:
4
+ - 2.0.0
@@ -0,0 +1,10 @@
1
+ ## [v0.0.3](https://github.com/EtienneLem/commandz/tree/v0.0.3)
2
+ - Fix a bug where `handleChange` wouldn’t be called after `CommandZ.execute()`
3
+
4
+ ## [v0.0.2](https://github.com/EtienneLem/commandz/tree/v0.0.2)
5
+ - Make `CommandZ.status()` return `canUndo` and `canRedo` states
6
+ - Add `CommandZ.onChange()` status callback
7
+ - Add `CMD+Z` & `CMD+SHIFT+Z` keyboard shortcuts
8
+
9
+ ## [v0.0.1](https://github.com/EtienneLem/commandz/tree/v0.0.1)
10
+ Initial release
data/README.md CHANGED
@@ -11,6 +11,7 @@
11
11
 
12
12
  <p align="center">
13
13
  <a href="http://badge.fury.io/rb/commandz"><img src="https://badge.fury.io/rb/commandz@2x.png" alt="Gem Version" height="18"></a>
14
+ <a href="https://travis-ci.org/EtienneLem/commandz"><img src="https://travis-ci.org/EtienneLem/commandz.png" alt="Travis build"></a>
14
15
  </p>
15
16
 
16
17
  ## Table of contents
data/Rakefile CHANGED
@@ -9,6 +9,7 @@ Bundler::GemHelper.install_tasks
9
9
  require 'uglifier'
10
10
  require 'commandz'
11
11
  require 'sprockets'
12
+ require 'jasmine-headless-webkit'
12
13
 
13
14
  # Tasks
14
15
  desc 'Merge, compiles and minify CoffeeScript files'
@@ -20,9 +21,11 @@ task :compile do
20
21
  compile('commandz.js')
21
22
  end
22
23
 
24
+ Jasmine::Headless::Task.new
25
+
23
26
  desc 'run Jasmine specs'
24
27
  task :spec do
25
- system('bundle exec jasmine-headless-webkit')
28
+ Rake::Task['jasmine:headless'].invoke
26
29
  end
27
30
 
28
31
  # Helpers
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.version = CommandZ::VERSION
6
6
  s.authors = ['Etienne Lemay']
7
7
  s.email = ['etienne@heliom.ca']
8
- s.homepage = 'https://github.com/EtienneLem/commandz'
9
- s.summary = 'CommandZ undo and redo commands'
8
+ s.homepage = 'http://etiennelem.github.io/commandz'
9
+ s.summary = '⌘Z add commands history support to your web app'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -1,10 +1,10 @@
1
1
  /*
2
- * CommandZ v0.0.2
2
+ * CommandZ v0.0.3
3
3
  * https://github.com/EtienneLem/commandz
4
4
  *
5
5
  * Copyright 2013, Etienne Lemay http://heliom.ca
6
6
  * Released under the MIT license
7
7
  *
8
- * Date: 2013-08-29 03:07:13 -0400
8
+ * Date: 2013-08-29 16:12:59 -0400
9
9
  */
10
- (function(){var t,n=function(t,n){return function(){return t.apply(n,arguments)}};t=function(){function t(){this.handleKeyboard=n(this.handleKeyboard,this),this.VERSION="0.0.2",this.changeCallback=null,this.clear(),this.keyboardShortcuts(!0)}return t.prototype.clear=function(){return this.commands=[],this.index=-1},t.prototype.keyboardShortcuts=function(t){var n;return null==t&&(t=!0),n=t?"addEventListener":"removeEventListener",document[n]("keypress",this.handleKeyboard)},t.prototype.handleKeyboard=function(t){return"INPUT"!==document.activeElement.nodeName&&122===t.keyCode&&t.metaKey===!0?(t.preventDefault(),t.shiftKey?this.redo():this.undo()):void 0},t.prototype.execute=function(t){var n;return this.up(t),this.index<this.commands.length-1&&(n=this.commands.length-this.index-1,this.commands.splice(-n)),this.commands.push(t),this.index=this.commands.length-1},t.prototype.undo=function(t){var n,e;if(null==t&&(t=1),this.status().canUndo)for(n=e=1;t>=1?t>=e:e>=t;n=t>=1?++e:--e){if(!this.commands[this.index])return;this.down(this.commands[this.index]),this.index--,this.handleChange()}},t.prototype.redo=function(t){var n,e;if(null==t&&(t=1),this.status().canRedo)for(n=e=1;t>=1?t>=e:e>=t;n=t>=1?++e:--e){if(!this.commands[this.index+1])return;this.index++,this.up(this.commands[this.index]),this.handleChange()}},t.prototype.exec=function(t,n){var e,i,o,s;if(!(n instanceof Array))return n[t]();for(s=[],i=0,o=n.length;o>i;i++)e=n[i],s.push(e[t]());return s},t.prototype.up=function(t){return this.exec("up",t)},t.prototype.down=function(t){return this.exec("down",t)},t.prototype.onChange=function(t){return this.changeCallback=t,this.handleChange()},t.prototype.handleChange=function(){return this.changeCallback?this.changeCallback(this.status()):void 0},t.prototype.status=function(){return{canUndo:this.index>-1,canRedo:this.index<this.commands.length-1}},t}(),this.CommandZ=new t}).call(this);
10
+ (function(){var t,n=function(t,n){return function(){return t.apply(n,arguments)}};t=function(){function t(){this.handleKeyboard=n(this.handleKeyboard,this),this.VERSION="0.0.3",this.changeCallback=null,this.clear(),this.keyboardShortcuts(!0)}return t.prototype.clear=function(){return this.commands=[],this.index=-1},t.prototype.keyboardShortcuts=function(t){var n;return null==t&&(t=!0),n=t?"addEventListener":"removeEventListener",document[n]("keypress",this.handleKeyboard)},t.prototype.handleKeyboard=function(t){return"INPUT"!==document.activeElement.nodeName&&122===t.keyCode&&t.metaKey===!0?(t.preventDefault(),t.shiftKey?this.redo():this.undo()):void 0},t.prototype.execute=function(t){var n;return this.up(t),this.index<this.commands.length-1&&(n=this.commands.length-this.index-1,this.commands.splice(-n)),this.commands.push(t),this.index=this.commands.length-1,this.handleChange()},t.prototype.undo=function(t){var n,e;if(null==t&&(t=1),this.status().canUndo)for(n=e=1;t>=1?t>=e:e>=t;n=t>=1?++e:--e){if(!this.commands[this.index])return;this.down(this.commands[this.index]),this.index--,this.handleChange()}},t.prototype.redo=function(t){var n,e;if(null==t&&(t=1),this.status().canRedo)for(n=e=1;t>=1?t>=e:e>=t;n=t>=1?++e:--e){if(!this.commands[this.index+1])return;this.index++,this.up(this.commands[this.index]),this.handleChange()}},t.prototype.exec=function(t,n){var e,i,o,s;if(!(n instanceof Array))return n[t]();for(s=[],i=0,o=n.length;o>i;i++)e=n[i],s.push(e[t]());return s},t.prototype.up=function(t){return this.exec("up",t)},t.prototype.down=function(t){return this.exec("down",t)},t.prototype.onChange=function(t){return this.changeCallback=t,this.handleChange()},t.prototype.handleChange=function(){return this.changeCallback?this.changeCallback(this.status()):void 0},t.prototype.status=function(){return{canUndo:this.index>-1,canRedo:this.index<this.commands.length-1}},t}(),this.CommandZ=new t}).call(this);
@@ -1,7 +1,7 @@
1
1
  class CommandZ
2
2
 
3
3
  constructor: ->
4
- @VERSION = '0.0.2'
4
+ @VERSION = '0.0.3'
5
5
  @changeCallback = null
6
6
 
7
7
  this.clear()
@@ -33,6 +33,7 @@ class CommandZ
33
33
  # Push new command
34
34
  @commands.push(command)
35
35
  @index = @commands.length - 1
36
+ this.handleChange()
36
37
 
37
38
  undo: (times=1) ->
38
39
  return unless this.status().canUndo
@@ -1,3 +1,3 @@
1
1
  module CommandZ
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -74,8 +74,9 @@ describe 'CommandZ', ->
74
74
 
75
75
  CommandZ.undo(3)
76
76
  CommandZ.redo(2)
77
+ CommandZ.execute({up: (->), down: (->)})
77
78
 
78
- expect(onChangeCallback.calls.length).toBe(6)
79
+ expect(onChangeCallback.calls.length).toBe(7)
79
80
  CommandZ.onChange(null)
80
81
 
81
82
  describe 'integration', ->
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commandz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Etienne Lemay
@@ -103,6 +103,8 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - .gitignore
105
105
  - .jasmine-headless-webkit
106
+ - .travis.yml
107
+ - CHANGELOG.md
106
108
  - Gemfile
107
109
  - Guardfile
108
110
  - MIT-LICENSE
@@ -121,7 +123,7 @@ files:
121
123
  - spec/helpers/spec_helper.coffee
122
124
  - vendor/jasmine-jquery.js
123
125
  - vendor/jquery.js
124
- homepage: https://github.com/EtienneLem/commandz
126
+ homepage: http://etiennelem.github.io/commandz
125
127
  licenses:
126
128
  - MIT
127
129
  metadata: {}
@@ -144,7 +146,7 @@ rubyforge_project:
144
146
  rubygems_version: 2.0.0
145
147
  signing_key:
146
148
  specification_version: 4
147
- summary: CommandZ undo and redo commands
149
+ summary: ⌘Z add commands history support to your web app
148
150
  test_files:
149
151
  - spec/commandz_spec.coffee
150
152
  - spec/fixtures/spec_container.html