event_emitter 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.
data/.gitignore CHANGED
@@ -1,6 +1,23 @@
1
1
  .DS_Store
2
+ *.tmp
2
3
  *~
3
- pkg/*
4
- tmp/*
5
- .\#*
6
- *\#*
4
+ *#*
5
+ vendor
6
+ .sass-cache
7
+ .bundle
8
+ config.yml
9
+ *.gem
10
+ *.rbc
11
+ .config
12
+ .yardoc
13
+ InstalledFiles
14
+ _yardoc
15
+ coverage
16
+ doc/
17
+ lib/bundler/man
18
+ pkg
19
+ rdoc
20
+ spec/reports
21
+ test/tmp
22
+ test/version_tmp
23
+ tmp
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'hoe'
4
- gem 'newgem'
3
+ # Specify your gem's dependencies in event_emitter.gemspec
4
+ gemspec
5
5
  gem 'minitest'
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.1 2012-01-04
2
+
3
+ * use bundler gem template
4
+
1
5
  === 0.2.0 2012-12-16
2
6
 
3
7
  * remove_listener
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Sho Hashimoto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ event_emitter
2
+ =============
3
+
4
+ * Ruby port of EventEmitter from Node.js
5
+ * http://shokai.github.com/event_emitter
6
+
7
+ Install
8
+ -------
9
+
10
+ % gem install event_emitter
11
+
12
+
13
+ Requirements
14
+ ------------
15
+
16
+ * Ruby 1.8.7+
17
+ * Ruby 1.9.2+
18
+ * JRuby 1.6.7+
19
+
20
+
21
+ Synopsys
22
+ --------
23
+
24
+ load rubygem
25
+ ```ruby
26
+ require "rubygems"
27
+ require "event_emitter"
28
+ ```
29
+
30
+ include
31
+ ```ruby
32
+ class User
33
+ include EventEmitter
34
+ attr_accessor :name
35
+ end
36
+ ```
37
+
38
+ regist event listener
39
+ ```ruby
40
+ user = User.new
41
+ user.name = "shokai"
42
+ user.on :go do |data|
43
+ puts "#{name} go to #{data[:place]}"
44
+ end
45
+ ```
46
+
47
+ call event
48
+ ```ruby
49
+ user.emit :go, {:place => "mountain"}
50
+ # => "shokai go to mountain"
51
+ ```
52
+
53
+ regist event using "once"
54
+ ```ruby
55
+ user.once :eat do |what, where|
56
+ puts "#{name} -> eat #{what} at #{where}"
57
+ end
58
+ ```
59
+
60
+ call
61
+ ```ruby
62
+ user.emit :eat, "BEEF", "zanmai" # => "shokai -> eat BEEF at zanmai"
63
+ user.emit :eat, "Ramen", "marutomo" # => do not call. call only first time.
64
+ ```
65
+
66
+ apply as instance-specific method
67
+ ```ruby
68
+ class Foo
69
+ end
70
+
71
+ foo = Foo.new
72
+ EventEmitter.apply foo
73
+ ```
74
+
75
+ remove event listener
76
+ ```ruby
77
+ user.remove_listener :go
78
+ user.remove_listener event_id
79
+ ```
80
+
81
+ see samples https://github.com/shokai/event_emitter/tree/master/samples
82
+
83
+
84
+ Test
85
+ ----
86
+
87
+ % gem install bundler
88
+ % bundle install
89
+ % rake test
90
+
91
+
92
+ Contributing
93
+ ------------
94
+ 1. Fork it
95
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
96
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
97
+ 4. Push to the branch (`git push origin my-new-feature`)
98
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,25 +1,8 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/event_emitter'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'event_emitter' do
14
- self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
- self.rubyforge_name = self.name # TODO this is default value
16
- # self.extra_deps = [['activesupport','>= 2.0.2']]
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
17
3
 
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "test/test_*.rb"
18
6
  end
19
7
 
20
- require 'newgem/tasks'
21
- Dir['tasks/**/*.rake'].each { |t| load t }
22
-
23
- # TODO - want other tests/tasks run by default? Add them to the list
24
- # remove_task :default
25
- # task :default => [:spec, :features]
8
+ task :default => :test
@@ -0,0 +1,18 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'event_emitter/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "event_emitter"
7
+ gem.version = EventEmitter::VERSION
8
+ gem.authors = ["Sho Hashimoto"]
9
+ gem.email = ["hashimoto@shokai.org"]
10
+ gem.description = %q{Ruby port of EventEmitter from Node.js}
11
+ gem.summary = gem.description
12
+ gem.homepage = "http://shokai.github.com/event_emitter"
13
+
14
+ gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+ end
@@ -0,0 +1,3 @@
1
+ module EventEmitter
2
+ VERSION = '0.2.1'
3
+ end
data/lib/event_emitter.rb CHANGED
@@ -2,7 +2,3 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  require 'event_emitter/emitter'
5
-
6
- module EventEmitter
7
- VERSION = '0.2.0'
8
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_emitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,93 +9,37 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rdoc
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '3.10'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '3.10'
30
- - !ruby/object:Gem::Dependency
31
- name: newgem
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 1.5.3
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 1.5.3
46
- - !ruby/object:Gem::Dependency
47
- name: hoe
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '3.1'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '3.1'
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
+ dependencies: []
62
14
  description: Ruby port of EventEmitter from Node.js
63
15
  email:
64
16
  - hashimoto@shokai.org
65
17
  executables: []
66
18
  extensions: []
67
- extra_rdoc_files:
68
- - History.txt
69
- - Manifest.txt
70
- - README.rdoc
19
+ extra_rdoc_files: []
71
20
  files:
72
21
  - .gitignore
73
22
  - Gemfile
74
- - Gemfile.lock
75
23
  - History.txt
76
- - Manifest.txt
77
- - README.rdoc
24
+ - LICENSE.txt
25
+ - README.md
78
26
  - Rakefile
27
+ - event_emitter.gemspec
79
28
  - lib/event_emitter.rb
80
29
  - lib/event_emitter/emitter.rb
30
+ - lib/event_emitter/version.rb
81
31
  - samples/class-method.rb
82
32
  - samples/instance-specific-method.rb
83
33
  - samples/sample.rb
84
34
  - samples/timer.rb
85
- - script/console
86
- - script/destroy
87
- - script/generate
88
35
  - test/test_class_method.rb
89
36
  - test/test_event_emitter.rb
90
37
  - test/test_helper.rb
91
38
  - test/test_singular_method.rb
92
- - .gemtest
93
39
  homepage: http://shokai.github.com/event_emitter
94
40
  licenses: []
95
41
  post_install_message:
96
- rdoc_options:
97
- - --main
98
- - README.rdoc
42
+ rdoc_options: []
99
43
  require_paths:
100
44
  - lib
101
45
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -104,9 +48,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
48
  - - ! '>='
105
49
  - !ruby/object:Gem::Version
106
50
  version: '0'
107
- segments:
108
- - 0
109
- hash: -1579719327575037681
110
51
  required_rubygems_version: !ruby/object:Gem::Requirement
111
52
  none: false
112
53
  requirements:
@@ -114,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
55
  - !ruby/object:Gem::Version
115
56
  version: '0'
116
57
  requirements: []
117
- rubyforge_project: event_emitter
58
+ rubyforge_project:
118
59
  rubygems_version: 1.8.24
119
60
  signing_key:
120
61
  specification_version: 3
data/.gemtest DELETED
File without changes
data/Gemfile.lock DELETED
@@ -1,28 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- RedCloth (4.2.9)
5
- RedCloth (4.2.9-java)
6
- activesupport (2.3.14)
7
- hoe (3.1.1)
8
- rake (~> 0.8)
9
- minitest (4.2.0)
10
- newgem (1.5.3)
11
- RedCloth (>= 4.1.1)
12
- activesupport (~> 2.3.4)
13
- hoe (>= 2.4.0)
14
- rubigen (>= 1.5.3)
15
- syntax (>= 1.0.0)
16
- rake (0.9.2.2)
17
- rubigen (1.5.8)
18
- activesupport (>= 2.3.5, < 3.2.0)
19
- syntax (1.0.0)
20
-
21
- PLATFORMS
22
- java
23
- ruby
24
-
25
- DEPENDENCIES
26
- hoe
27
- minitest
28
- newgem
data/Manifest.txt DELETED
@@ -1,20 +0,0 @@
1
- .gitignore
2
- Gemfile
3
- Gemfile.lock
4
- History.txt
5
- Manifest.txt
6
- README.rdoc
7
- Rakefile
8
- lib/event_emitter.rb
9
- lib/event_emitter/emitter.rb
10
- samples/class-method.rb
11
- samples/instance-specific-method.rb
12
- samples/sample.rb
13
- samples/timer.rb
14
- script/console
15
- script/destroy
16
- script/generate
17
- test/test_class_method.rb
18
- test/test_event_emitter.rb
19
- test/test_helper.rb
20
- test/test_singular_method.rb
data/README.rdoc DELETED
@@ -1,108 +0,0 @@
1
- = event_emitter
2
-
3
- * http://shokai.github.com/event_emitter
4
-
5
- == INSTALL:
6
-
7
- * gem install event_emitter
8
-
9
- == DESCRIPTION:
10
-
11
- Ruby port of EventEmitter from Node.js
12
-
13
- == REQUIREMENTS:
14
-
15
- * Ruby 1.8.7+
16
- * Ruby 1.9.2+
17
- * JRuby 1.6.7+
18
-
19
- == SYNOPSIS:
20
-
21
- load rubygem
22
-
23
- require "rubygems"
24
- require "event_emitter"
25
-
26
- include
27
-
28
- class User
29
- include EventEmitter
30
- attr_accessor :name
31
- end
32
-
33
-
34
- regist event listener
35
-
36
- user = User.new
37
- user.name = "shokai"
38
- user.on :go do |data|
39
- puts "#{name} go to #{data[:place]}"
40
- end
41
-
42
-
43
- call event
44
-
45
- user.emit :go, {:place => "mountain"}
46
- # => "shokai go to mountain"
47
-
48
-
49
- regist event using "once"
50
-
51
- user.once :eat do |what, where|
52
- puts "#{name} -> eat #{what} at #{where}"
53
- end
54
-
55
-
56
- call
57
-
58
- user.emit :eat, "BEEF", "zanmai" # => "shokai -> eat BEEF at zanmai"
59
- user.emit :eat, "Ramen", "marutomo" # => do not call. call only first time.
60
-
61
-
62
- apply as instance-specific method
63
-
64
- class Foo
65
- end
66
-
67
- foo = Foo.new
68
- EventEmitter.apply foo
69
-
70
-
71
- remove event listener
72
-
73
- user.remove_listener :go
74
- user.remove_listener event_id
75
-
76
-
77
- see samples https://github.com/shokai/event_emitter/tree/master/samples
78
-
79
- == TEST:
80
-
81
- % gem install bundler
82
- % bundle install
83
- % rake test
84
-
85
- == LICENSE:
86
-
87
- (The MIT License)
88
-
89
- Copyright (c) 2012 Sho Hashimoto
90
-
91
- Permission is hereby granted, free of charge, to any person obtaining
92
- a copy of this software and associated documentation files (the
93
- 'Software'), to deal in the Software without restriction, including
94
- without limitation the rights to use, copy, modify, merge, publish,
95
- distribute, sublicense, and/or sell copies of the Software, and to
96
- permit persons to whom the Software is furnished to do so, subject to
97
- the following conditions:
98
-
99
- The above copyright notice and this permission notice shall be
100
- included in all copies or substantial portions of the Software.
101
-
102
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
103
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
106
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
107
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
108
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/event_emitter.rb'}"
9
- puts "Loading event_emitter gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)