event-bus 0.2.0 → 0.2.1

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: 079dd5fa10807c0fc4c29e661ecd7affcaf6488e
4
- data.tar.gz: 6a6e8dcbb44d22cc086f026c967208a142d421b9
3
+ metadata.gz: 49272a921e41a3b24399455d18e27cd8f23cb453
4
+ data.tar.gz: 0f56f30be1a845251d2a72d3523f1f4c4eba7ded
5
5
  SHA512:
6
- metadata.gz: bb4250749d76973f58250e81d3b7c3140ffbdb7c364f755621415b96a00605bd24d84a72898c8c84bfe18f12ed15acef072c2a6a2f62036309daa0167e272f28
7
- data.tar.gz: b437df70ce05bfbc08fff20ff89b0f56ed6a6d1b638e7d570b5588d405ace3316d495aa05592ffd6c84f942cb50acbacf1a705a0a32815e6bef1ef18913c7454
6
+ metadata.gz: 3251595d6cdbea5754efb77ce8351f70774ffd3ed332886044132ae6949307d566e5921684730292e39474d1a72c21b43b95083c2039e149af687866e292e7d7
7
+ data.tar.gz: 83bf7b31c82c8ea5e0b0e0d4080ee52694eb539f949b6da5fe41ec873dc42eb2f6e41c3603932bdcd758da3818963772e5c70dde348186ae93c0a159f5e3b93a
@@ -21,3 +21,6 @@ Metrics/MethodLength:
21
21
  Metrics/PerceivedComplexity:
22
22
  Exclude:
23
23
  - lib/event/name_resolver.rb
24
+
25
+ Style/HashSyntax:
26
+ Enabled: false
@@ -1,9 +1,34 @@
1
1
  sudo: false
2
- env:
3
- - CI=1
4
2
  language: ruby
5
- bundler_args: --without development debug profile
3
+ script: script/test
4
+ install: script/bootstrap --without development debug
6
5
  rvm:
6
+ - 1.8.7
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - 2.0.0
7
10
  - 2.1.7
8
11
  - 2.2.3
9
- script: script/test
12
+ - jruby
13
+ - jruby-20mode
14
+ - jruby-21mode
15
+ - jruby-9.0.0.0
16
+ - jruby-9.0.0.0-20mode
17
+ - jruby-9.0.0.0-21mode
18
+ - rbx
19
+ matrix:
20
+ allow_failures:
21
+ - rvm: rbx
22
+ - rvm: jruby-9.0.0.0
23
+ - rvm: jruby-9.0.0.0-20mode
24
+ - rvm: jruby-9.0.0.0-21mode
25
+ notifications:
26
+ email:
27
+ - cukes-devs@googlegroups.com
28
+ webhooks:
29
+ urls:
30
+ - https://webhooks.gitter.im/e/d4d9080e2a8c4910f609
31
+ env:
32
+ global:
33
+ - JRUBY_OPTS='--dev -X-C -Xcli.debug=true --debug
34
+ - CI=1
data/Gemfile CHANGED
@@ -1,33 +1,81 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in event-bus.gemspec
3
+ # Use dependencies from gemspec
4
4
  gemspec
5
5
 
6
+ # Debug aruba
6
7
  group :debug do
7
- gem 'pry'
8
- gem 'byebug'
9
- gem 'pry-doc', require: false
10
- gem 'pry-byebug', require: false
8
+ if RUBY_VERSION >= '2' && !RUBY_PLATFORM.include?('java')
9
+ gem 'byebug', '~> 4.0.5'
10
+ gem 'pry-byebug', '~> 3.1.0'
11
+ end
12
+
13
+ if RUBY_VERSION < '2' && RUBY_VERSION > '1.9' && !RUBY_PLATFORM.include?('java')
14
+ gem 'debugger', '~> 1.6.8'
15
+ gem 'pry-debugger', '~> 0.2.3'
16
+ end
17
+
18
+ gem 'pry-doc', '~> 0.8.0'
11
19
  end
12
20
 
13
21
  group :development, :test do
14
- gem 'aruba', '~>0.10.0', require: false
15
- gem 'awesome_print', require: 'ap'
16
- gem 'coveralls', require: false
17
- gem 'cucumber', require: false
18
- gem 'fuubar', require: false
19
- gem 'github-markup'
20
- gem 'inch', require: false
21
- gem 'license_finder'
22
- gem 'rake', '~>10.0.0', require: false
23
- gem 'rubocop', require: false
24
- gem 'simplecov', require: false
25
- gem 'tmrb', require: false
26
- gem 'versionomy', require: false
27
- gem 'yard', require: false
28
- gem 'rspec', require: false
22
+ # we use this to demonstrate interactive debugging within our feature tests
23
+ if RUBY_VERSION >= '2'
24
+ gem 'pry', '~> 0.10.1'
25
+ else
26
+ gem 'pry', '~>0.9.12'
27
+ end
28
+
29
+ gem 'aruba', '~>0.11.pre3'
30
+
31
+ # Run development tasks
32
+ gem 'rake', '~> 10.4.2'
33
+
34
+ if RUBY_VERSION >= '2.0.0'
35
+ # Lint travis yaml
36
+ gem 'travis-yaml'
37
+
38
+ # Reporting
39
+ gem 'bcat', '~> 0.6.2'
40
+ gem 'kramdown', '~> 1.7.0'
41
+ end
42
+
43
+ # Code Coverage
44
+ gem 'simplecov', '~> 0.10'
45
+
46
+ # Test api
47
+ gem 'rspec', '~> 3.4'
48
+ gem 'fuubar', '~> 2.0.0'
49
+
50
+ # using platform for this make bundler complain about the same gem given
51
+ # twice
52
+ if RUBY_VERSION < '1.9.3'
53
+ gem 'cucumber', '~> 1.3.20'
54
+ else
55
+ gem 'cucumber', '~> 2.0'
56
+ end
57
+
58
+ if RUBY_VERSION >= '1.9.3'
59
+ # Make aruba compliant to ruby community guide
60
+ gem 'rubocop', '~> 0.32.0'
61
+ end
62
+
63
+ gem 'cucumber-pro', '~> 0.0' if RUBY_VERSION >= '1.9.3'
64
+
65
+ if RUBY_VERSION >= '1.9.3'
66
+ # License compliance
67
+ gem 'license_finder', '~> 2.0.4'
68
+ end
69
+
70
+ if RUBY_VERSION >= '1.9.3'
71
+ # Upload documentation
72
+ gem 'relish', '~> 0.7.1'
73
+ end
74
+
75
+ gem 'minitest', '~> 5.8.0'
29
76
  end
30
77
 
31
- group :profile do
32
- gem 'ruby-prof'
78
+ platforms :rbx do
79
+ gem 'rubysl', '~> 2.0'
80
+ gem 'rubinius-developer_tools'
33
81
  end
data/Rakefile CHANGED
@@ -1,34 +1,58 @@
1
1
  #!/usr/bin/env rake
2
+ #
3
+ require 'bundler'
4
+ Bundler.setup
2
5
 
3
6
  namespace :gem do
4
7
  require 'bundler/gem_tasks'
5
8
  end
6
9
 
7
- desc 'Default task'
8
- task default: :test
10
+ require 'cucumber/rake/task'
9
11
 
10
- require 'coveralls/rake/task'
11
- Coveralls::RakeTask.new
12
-
13
- desc 'Run test suite'
14
- task test: %w(test:rubocop test:rspec test:cucumber)
12
+ Cucumber::Rake::Task.new do |t|
13
+ t.cucumber_opts = ''
14
+ # t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log" if ENV['CUCUMBER_PRO_TOKEN']
15
+ t.cucumber_opts << '--format pretty'
16
+ end
15
17
 
16
- namespace :test do
17
- desc 'Test with coveralls'
18
- task coveralls: %w(test coveralls:push)
18
+ Cucumber::Rake::Task.new(:cucumber_wip) do |t|
19
+ t.cucumber_opts = '-p wip'
20
+ end
19
21
 
20
- desc 'Run rspec'
21
- task :rspec do
22
- sh 'bundle exec rspec'
23
- end
22
+ require 'rspec/core/rake_task'
23
+ desc 'Run RSpec'
24
+ RSpec::Core::RakeTask.new do |spec|
25
+ spec.rspec_opts = ['--color', '--format documentation']
26
+ end
24
27
 
25
- desc 'Run cucumber'
26
- task :cucumber do
27
- sh 'bundle exec cucumber'
28
+ namespace :travis do
29
+ desc 'Lint travis.yml'
30
+ task :lint do
31
+ begin
32
+ require 'travis/yaml'
33
+
34
+ puts 'Linting .travis.yml ... No output is good!'
35
+ Travis::Yaml.parse! File.read('.travis.yml')
36
+ rescue LoadError
37
+ $stderr.puts 'You ruby is not supported for linting the .travis.yml'
38
+ end
28
39
  end
40
+ end
29
41
 
30
- desc 'Run cucumber'
31
- task :rubocop do
32
- sh 'bundle exec rubocop'
42
+ if RUBY_VERSION < '1.9.3'
43
+ begin
44
+ require 'rubocop/rake_task'
45
+ RuboCop::RakeTask.new
46
+ rescue LoadError
47
+ desc 'Stub task to make rake happy'
48
+ task(:rubocop) {}
33
49
  end
50
+ else
51
+ require 'rubocop/rake_task'
52
+ RuboCop::RakeTask.new
34
53
  end
54
+
55
+ desc 'Run tests, both RSpec and Cucumber'
56
+ task :test => ['travis:lint', :rubocop, :spec, :cucumber, :cucumber_wip]
57
+
58
+ task :default => :test
@@ -18,7 +18,7 @@ module Event
18
18
  end
19
19
 
20
20
  # Register for an event
21
- #
21
+ #
22
22
  # @param [String, Symbol, Class, Array] event_ids
23
23
  # If Array, register multiple events witht the same handler. If String,
24
24
  # Symbol, Class register handler for given event.
@@ -2,6 +2,6 @@
2
2
  module Event
3
3
  # Bus
4
4
  class Bus
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -18,13 +18,17 @@ module Event
18
18
  constantize("#{@default_namespace}::#{camel_case(event_id)}")
19
19
  end
20
20
  rescue => e
21
- raise EventNameResolveError, %(Transforming "#{event_id}" into an event class failed: #{e.message}.)
21
+ raise EventNameResolveError, %(Transforming "#{event_id}" into an event class failed: #{e.message}.\n\n#{e.backtrace.join("\n")})
22
22
  end
23
23
 
24
24
  private
25
25
 
26
26
  def camel_case(underscored_name)
27
- underscored_name.to_s.split('_').map { |word| word.upcase[0] + word[1..-1] }.join
27
+ if RUBY_VERSION < '1.9.3'
28
+ underscored_name.to_s.split('_').map { |word| word.upcase.chars.to_a[0] + word.chars.to_a[1..-1].join }.join
29
+ else
30
+ underscored_name.to_s.split('_').map { |word| word.upcase[0] + word[1..-1] }.join
31
+ end
28
32
  end
29
33
 
30
34
  # Thanks ActiveSupport
@@ -43,7 +47,13 @@ module Event
43
47
  constant.const_get(name)
44
48
  else
45
49
  candidate = constant.const_get(name)
46
- next candidate if constant.const_defined?(name, false)
50
+
51
+ if RUBY_VERSION < '1.9.3'
52
+ next candidate if constant.const_defined?(name)
53
+ else
54
+ next candidate if constant.const_defined?(name, false)
55
+ end
56
+
47
57
  next candidate unless Object.const_defined?(name)
48
58
 
49
59
  # Go down the ancestors to check if it is owned directly. The check
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ info_msg="\e[0;32m[INFO]\e[0;30m"
6
+ error_msg="\e[0;31mFAILED\e[0;30m"
7
+
8
+ function output_error_log {
9
+ [[ -f error.log ]] && ( cat error.log >&2; rm error.log)
10
+ }
11
+
12
+ echo -ne "$info_msg Checking if ruby installed? "
13
+ which 'ruby' >/dev/null 2>error.log || ( echo -e "$error_msg\n\nCould not find \`ruby\`. Please install ruby or add it to PATH"; output_error_log; exit 1 )
14
+ echo OK
15
+
16
+ echo -e "$info_msg rubygem \"bundler\" "
17
+ gem install bundler
18
+
19
+ echo -e "$info_msg \"bundle install\" "
20
+ bundle install $*
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event-bus
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
  - Dennis Günnewig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,6 +56,7 @@ files:
56
56
  - lib/event/bus/version.rb
57
57
  - lib/event/errors.rb
58
58
  - lib/event/name_resolver.rb
59
+ - script/bootstrap
59
60
  - script/console
60
61
  - script/setup
61
62
  - script/test