alephant 1.0.0 → 1.1.0

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: 1285345b52033fd6414ad6b283811045d6dc5395
4
- data.tar.gz: 4cb7cfa587146258137d79229c16e7daa9cd1aec
3
+ metadata.gz: 1d0969b3b6dc40ef68a95253c8f7a82eea85ae93
4
+ data.tar.gz: 294db93a30362fc394876fc7ccb6eeef52995b11
5
5
  SHA512:
6
- metadata.gz: 2b8963e2f0f21b1b679518e4c95baf6aa969b94d8a43aa6f68011e58ff99b124612f8e2d76e673683f7308a640c3dcc8f603137206b40326e3755990111f04e2
7
- data.tar.gz: 2fcd9a2276ec6b0f26de93b5707f9aec595fa8663b56b741c2728530cb0a9f487b82759a84dabc6ac29acf97144abe9fc92eeba09be70ceb6a6ddc18caa89b9c
6
+ metadata.gz: ea681945852124bbb672553e0c515d78b947a45c748ccb7957e1cc3cb0d31cc5f7990dcee6eb9263f358e442ee0e1d42ad2253c835f2712d82f1925d599e3421
7
+ data.tar.gz: 66b57eddba3d016da3951d95bcede96d70683be0f6b109ccc4ba08a45b1ffb957dd2eb3b03615bf4084e4a3da7ac64421cd9ceda9c22e05d7409ac28c19f840b
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - "jruby"
4
+ notifications:
5
+ email:
6
+ recipients:
7
+ - kenoir@gmail.com
8
+ - stevenmajack@gmail.com
9
+ on_failure: change
10
+ on_success: never
@@ -0,0 +1,6 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/.+\.rb$})
4
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
data/README.md CHANGED
@@ -11,6 +11,7 @@ Requires:
11
11
  - https://github.com/BBC-News/alephant-renderer [![Build Status](https://travis-ci.org/BBC-News/alephant-renderer.png?branch=master)](https://travis-ci.org/BBC-News/alephant-renderer) [![Dependency Status](https://gemnasium.com/BBC-News/alephant-renderer.png)](https://gemnasium.com/BBC-News/alephant-renderer) [![Gem Version](https://badge.fury.io/rb/alephant-renderer.png)](http://badge.fury.io/rb/alephant-renderer)
12
12
  - https://github.com/BBC-News/alephant-lookup [![Build Status](https://travis-ci.org/BBC-News/alephant-lookup.png?branch=master)](https://travis-ci.org/BBC-News/alephant-lookup) [![Dependency Status](https://gemnasium.com/BBC-News/alephant-lookup.png)](https://gemnasium.com/BBC-News/alephant-lookup) [![Gem Version](https://badge.fury.io/rb/alephant-lookup.png)](http://badge.fury.io/rb/alephant-lookup)
13
13
  - https://github.com/BBC-News/alephant-preview [![Build Status](https://travis-ci.org/BBC-News/alephant-preview.png?branch=master)](https://travis-ci.org/BBC-News/alephant-preview) [![Dependency Status](https://gemnasium.com/BBC-News/alephant-preview.png)](https://gemnasium.com/BBC-News/alephant-preview) [![Gem Version](https://badge.fury.io/rb/alephant-preview.png)](http://badge.fury.io/rb/alephant-preview)
14
+ - https://github.com/BBC-News/alephant-broker [![Build Status](https://travis-ci.org/BBC-News/alephant-broker.png?branch=master)](https://travis-ci.org/BBC-News/alephant-broker) [![Dependency Status](https://gemnasium.com/BBC-News/alephant-broker.png)](https://gemnasium.com/BBC-News/alephant-broker) [![Gem Version](https://badge.fury.io/rb/alephant-broker.png)](http://badge.fury.io/rb/alephant-broker)
14
15
 
15
16
  ## Installation
16
17
 
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
- require "bundler/gem_tasks"
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+
3
+ require 'rspec/core/rake_task'
4
+ require 'bundler/gem_tasks'
5
+ require 'alephant/publisher'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
@@ -20,6 +20,13 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "rspec-nc"
25
+ spec.add_development_dependency "guard"
26
+ spec.add_development_dependency "guard-rspec"
27
+ spec.add_development_dependency "pry"
28
+ spec.add_development_dependency "pry-remote"
29
+ spec.add_development_dependency "pry-nav"
23
30
 
24
31
  spec.add_runtime_dependency 'alephant-publisher'
25
32
  spec.add_runtime_dependency 'alephant-support'
@@ -29,4 +36,5 @@ Gem::Specification.new do |spec|
29
36
  spec.add_runtime_dependency 'alephant-renderer'
30
37
  spec.add_runtime_dependency 'alephant-lookup'
31
38
  spec.add_runtime_dependency 'alephant-preview'
39
+ spec.add_runtime_dependency 'alephant-broker'
32
40
  end
@@ -3,4 +3,20 @@ require "alephant/publisher"
3
3
 
4
4
  module Alephant
5
5
  # Consuming application calls: `Alephant::Publisher.create`
6
+
7
+ module AOP
8
+
9
+ def around(fn_name)
10
+ puts 'In around method'
11
+ old_method = instance_method(fn_name)
12
+ define_method(fn_name) do |*args|
13
+ yield :before, args if block_given?
14
+ old_method.bind(self).call(args).tap do |return_value|
15
+ args << return_value unless return_value.nil?
16
+ end
17
+ yield :after, args if block_given?
18
+ end
19
+ end
20
+
21
+ end
6
22
  end
@@ -1,3 +1,3 @@
1
1
  module Alephant
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1 @@
1
+ *
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::AOP do
4
+ describe "#around(fn_name)" do
5
+ it "Overwrites the existing method with the block passed in, providing hooks for before and after the original method call" do
6
+
7
+ states = []
8
+
9
+ Test.around('test_method') do |state, args|
10
+ states << state
11
+ if state == :before
12
+ args.should eq(['test'])
13
+ elsif state == :after
14
+ args.should eq(['test', 'test_return'])
15
+ end
16
+ end
17
+
18
+ Test.new.test_method('test')
19
+ states.should include(:before, :after)
20
+
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,10 @@
1
+ require 'alephant'
2
+
3
+ class Test
4
+ extend Alephant::AOP
5
+
6
+ def test_method(arg)
7
+ 'test_return'
8
+ end
9
+
10
+ end
@@ -0,0 +1,3 @@
1
+ require 'pry'
2
+ require_relative 'fixtures/test'
3
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Integralist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,104 @@ dependencies:
38
38
  version: '0'
39
39
  prerelease: false
40
40
  type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-remote
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-nav
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ prerelease: false
138
+ type: :development
41
139
  - !ruby/object:Gem::Dependency
42
140
  name: alephant-publisher
43
141
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,6 +248,20 @@ dependencies:
150
248
  version: '0'
151
249
  prerelease: false
152
250
  type: :runtime
251
+ - !ruby/object:Gem::Dependency
252
+ name: alephant-broker
253
+ version_requirements: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - '>='
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ requirement: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - '>='
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ prerelease: false
264
+ type: :runtime
153
265
  description: Alephant framework
154
266
  email:
155
267
  - mark.mcdx@gmail.com
@@ -159,7 +271,9 @@ extra_rdoc_files: []
159
271
  files:
160
272
  - .gitignore
161
273
  - .ruby-version
274
+ - .travis.yml
162
275
  - Gemfile
276
+ - Guardfile
163
277
  - LICENSE.txt
164
278
  - README.md
165
279
  - Rakefile
@@ -167,6 +281,10 @@ files:
167
281
  - alephant/.gitignore
168
282
  - lib/alephant.rb
169
283
  - lib/alephant/version.rb
284
+ - spec/.gitkeep
285
+ - spec/aop_spec.rb
286
+ - spec/fixtures/test.rb
287
+ - spec/spec_helper.rb
170
288
  homepage: https://github.com/BBC-News/alephant
171
289
  licenses:
172
290
  - MIT
@@ -191,4 +309,8 @@ rubygems_version: 2.1.9
191
309
  signing_key:
192
310
  specification_version: 4
193
311
  summary: Alephant framework
194
- test_files: []
312
+ test_files:
313
+ - spec/.gitkeep
314
+ - spec/aop_spec.rb
315
+ - spec/fixtures/test.rb
316
+ - spec/spec_helper.rb