hero 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c5716bb5bd79c71833655e60ca11181eafd920f7
4
+ data.tar.gz: 27989818852c646c30fea5c3a2d7719eea38aed6
5
+ SHA512:
6
+ metadata.gz: 5996c9f6153bfd23e418736e0d0ecd72f523eab245f85663843f53ff21eb9da607e52e889dd5bdea797e41062924d35d76bf0f4a27101506e3502996b36272c1
7
+ data.tar.gz: c63f3916516f2fcf41d68b3381dde7300862fc4026e4225a54f0bc42007c69947dbfc477c105ad50538f4bf018c885a27cb822f55cb6b47619cfdae366bf1e27
@@ -6,25 +6,60 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- coderay (1.0.9)
10
- method_source (0.8.1)
11
- micro_mock (1.1.0)
12
- micro_test (0.3.5)
13
- os
9
+ binding_of_caller (0.7.2)
10
+ debug_inspector (>= 0.0.1)
11
+ coderay (1.1.0)
12
+ coveralls (0.7.1)
13
+ multi_json (~> 1.3)
14
+ rest-client
15
+ simplecov (>= 0.7)
16
+ term-ansicolor
17
+ thor
18
+ debug_inspector (0.0.2)
19
+ docile (1.1.5)
20
+ interception (0.5)
21
+ method_source (0.8.2)
22
+ mime-types (2.4.3)
23
+ multi_json (1.10.1)
24
+ netrc (0.8.0)
14
25
  os (0.9.6)
15
- pry (0.9.12)
16
- coderay (~> 1.0.5)
17
- method_source (~> 0.8)
26
+ pry (0.10.1)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.8.1)
18
29
  slop (~> 3.4)
19
- rake (10.0.4)
20
- slop (3.4.4)
30
+ pry-rescue (1.4.1)
31
+ interception (>= 0.5)
32
+ pry
33
+ pry-stack_explorer (0.4.9.1)
34
+ binding_of_caller (>= 0.7)
35
+ pry (>= 0.9.11)
36
+ pry-test (0.5.5)
37
+ os
38
+ rake (10.3.2)
39
+ rest-client (1.7.2)
40
+ mime-types (>= 1.16, < 3.0)
41
+ netrc (~> 0.7)
42
+ simplecov (0.9.1)
43
+ docile (~> 1.1.0)
44
+ multi_json (~> 1.0)
45
+ simplecov-html (~> 0.8.0)
46
+ simplecov-html (0.8.0)
47
+ slop (3.6.0)
48
+ spoof (2.0.1)
49
+ term-ansicolor (1.3.0)
50
+ tins (~> 1.0)
51
+ thor (0.19.1)
52
+ tins (1.3.3)
21
53
 
22
54
  PLATFORMS
23
55
  ruby
24
56
 
25
57
  DEPENDENCIES
58
+ coveralls
26
59
  hero!
27
- micro_mock
28
- micro_test
29
60
  pry
61
+ pry-rescue
62
+ pry-stack_explorer
63
+ pry-test
30
64
  rake
65
+ spoof
data/README.md CHANGED
@@ -1,18 +1,15 @@
1
- # Hero
2
-
3
- [![Build Status](https://travis-ci.org/hopsoft/hero.png)](https://travis-ci.org/hopsoft/hero)
4
- [![Dependency Status](https://gemnasium.com/hopsoft/hero.png)](https://gemnasium.com/hopsoft/hero)
5
- [![Code Climate](https://codeclimate.com/github/hopsoft/hero.png)](https://codeclimate.com/github/hopsoft/hero)
6
-
7
- ![Hero GEM](http://hopsoft.github.com/hero/images/hero.jpg)
8
-
9
- ## Its a bird, its a plane, its... its... my Hero
1
+ [![Lines of Code](http://img.shields.io/badge/lines_of_code-126-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)
2
+ [![Code Status](http://img.shields.io/codeclimate/github/hopsoft/hero.svg?style=flat)](https://codeclimate.com/github/hopsoft/hero)
3
+ [![Dependency Status](http://img.shields.io/gemnasium/hopsoft/hero.svg?style=flat)](https://gemnasium.com/hopsoft/hero)
4
+ [![Build Status](http://img.shields.io/travis/hopsoft/hero.svg?style=flat)](https://travis-ci.org/hopsoft/hero)
5
+ [![Coverage Status](https://img.shields.io/coveralls/hopsoft/hero.svg?style=flat)](https://coveralls.io/r/hopsoft/hero?branch=master)
6
+ [![Downloads](http://img.shields.io/gem/dt/hero.svg?style=flat)](http://rubygems.org/gems/hero)
10
7
 
11
- ---
8
+ # Hero
12
9
 
13
- *Controlling complexity is the essence of computer programming. -- [Brian Kernighan](http://en.wikipedia.org/wiki/Brian_Kernighan)*
10
+ > Controlling complexity is the essence of computer programming. -- [Brian Kernighan](http://en.wikipedia.org/wiki/Brian_Kernighan)
14
11
 
15
- ---
12
+ ### Create well organized modular apps.
16
13
 
17
14
  I've seen my share of poor app structure.
18
15
  Hell, I wrote most of it.
@@ -20,9 +17,6 @@ Whether is fat controllers, giant models with mystery callbacks, or a junk drawe
20
17
 
21
18
  The question remains. **Where do I put my business logic?**
22
19
 
23
- Finally... an answer that might even make DHH proud.
24
- One that evolved from the real world with concrete use cases and actual production code.
25
-
26
20
  ## Why Hero?
27
21
 
28
22
  * It matches the mental map of your business requirements
@@ -30,7 +24,7 @@ One that evolved from the real world with concrete use cases and actual producti
30
24
  * It easily handles changing requirements
31
25
  * It reduces the ramp up time for new team members
32
26
 
33
- Think of Hero as a simplified state machine which enables implementations that can be understood at a glance.
27
+ Think of Hero as a simplified state machine.
34
28
 
35
29
  ## Match the Implementation to the Business Process
36
30
 
@@ -217,12 +211,3 @@ Hero::Formula[:log_example].run([])
217
211
  # I, [2012-08-26T11:37:22.267282 #76676] INFO -- : HERO before log_example -> third_step Context: [1, 2] Options: {}
218
212
  # I, [2012-08-26T11:37:22.267333 #76676] INFO -- : HERO after log_example -> third_step Context: [1, 2, 3] Options: {}
219
213
  ```
220
-
221
- ## Run the Tests
222
-
223
- ```bash
224
- gem install hero
225
- gem unpack hero
226
- cd hero-VERSION
227
- rake
228
- ```
data/Rakefile CHANGED
@@ -2,10 +2,6 @@ require "bundler/gem_tasks"
2
2
 
3
3
  task :default => [:test]
4
4
 
5
- desc "Runs the test suite."
6
5
  task :test do
7
- ENV["TEST"] = "1"
8
- output = `bundle exec mt`
9
- puts output
10
- exit output.index(/tests\sfinished.*failed/).nil?
6
+ exec "bundle exec pry-test --disable-pry"
11
7
  end
@@ -1,3 +1,3 @@
1
1
  module Hero
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require "thread"
2
- require File.join(File.dirname(__FILE__), "test_helper")
2
+ require File.expand_path("../test_helper", __FILE__)
3
3
 
4
- class FormulaTest < MicroTest::Test
4
+ class FormulaTest < PryTest::Test
5
5
  class << self
6
6
  attr_accessor :formula_count
7
7
  def mutex
@@ -43,39 +43,39 @@ class FormulaTest < MicroTest::Test
43
43
  end
44
44
 
45
45
  test "should allow unnamed Class steps" do
46
- step = MicroMock.make
47
- step.def(:call) {}
46
+ step = Spoof.make
47
+ step.method(:call) {}
48
48
  Hero::Formula[@formula_name].add_step step
49
- assert Hero::Formula[@formula_name].steps.map{|s| s.first}.first =~ /MicroMock/
49
+ assert Hero::Formula[@formula_name].steps.map{|s| s.first}.first =~ /Spoof/
50
50
  assert Hero::Formula[@formula_name].steps.map{|s| s.last}.include?(step)
51
51
  end
52
52
 
53
53
  test "should allow named Class steps" do
54
- step = MicroMock.make
55
- step.def(:call) {}
54
+ step = Spoof.make
55
+ step.method(:call) {}
56
56
  Hero::Formula[@formula_name].add_step :foo, step
57
57
  assert Hero::Formula[@formula_name].steps.map{|s| s.first}.include?(:foo)
58
58
  assert Hero::Formula[@formula_name].steps.map{|s| s.last}.include?(step)
59
59
  end
60
60
 
61
61
  test "should allow unnamed instance steps" do
62
- step = MicroMock.make.new
63
- step.def(:call) {}
62
+ step = Spoof.make.new
63
+ step.method(:call) {}
64
64
  Hero::Formula[@formula_name].add_step step
65
65
  names = Hero::Formula[@formula_name].steps.map{|s| s.first}
66
66
  steps = Hero::Formula[@formula_name].steps.map{|s| s.last}
67
- steps.each { |s| assert s.is_a? MicroMock }
68
- assert names.first =~ /MicroMock/i
67
+ steps.each { |s| assert s.is_a? Spoof }
68
+ assert names.first =~ /Spoof/i
69
69
  assert steps.include?(step)
70
70
  end
71
71
 
72
72
  test "should allow named instance steps" do
73
- step = MicroMock.make.new
74
- step.def(:call) {}
73
+ step = Spoof.make.new
74
+ step.method(:call) {}
75
75
  Hero::Formula[@formula_name].add_step :foo, step
76
76
  names = Hero::Formula[@formula_name].steps.map{|s| s.first}
77
77
  steps = Hero::Formula[@formula_name].steps.map{|s| s.last}
78
- steps.each { |s| assert s.is_a? MicroMock }
78
+ steps.each { |s| assert s.is_a? Spoof }
79
79
  assert names.include?(:foo)
80
80
  assert steps.include?(step)
81
81
  end
@@ -166,8 +166,8 @@ class FormulaTest < MicroTest::Test
166
166
  end
167
167
 
168
168
  test "should support running step defined in a class" do
169
- step = MicroMock.make.new
170
- step.def(:call) do |context, options|
169
+ step = Spoof.make.new
170
+ step.method(:call) do |context, options|
171
171
  options[:context] = context
172
172
  end
173
173
 
@@ -206,11 +206,11 @@ class FormulaTest < MicroTest::Test
206
206
 
207
207
  test "should support logging" do
208
208
  FormulaTest.mutex.synchronize do
209
- logger = MicroMock.make.new
209
+ logger = Spoof.make.new
210
210
  logger.attr :buffer
211
211
  logger.buffer = []
212
- logger.def(:info) { |value| buffer << value }
213
- logger.def(:error) { |value| buffer << value }
212
+ logger.method(:info) { |value| buffer << value }
213
+ logger.method(:error) { |value| buffer << value }
214
214
  Hero.logger = logger
215
215
 
216
216
  Hero::Formula[@formula_name].add_step(:one) { |list, opts| list << 1; opts[:step] = 1 }
@@ -227,12 +227,12 @@ class FormulaTest < MicroTest::Test
227
227
 
228
228
  # test "should support logging errors" do
229
229
  # FormulaTest.mutex.synchronize do
230
- # logger = MicroMock.make.new
230
+ # logger = Spoof.make.new
231
231
  # logger.attr :buffer
232
232
  # logger.attr(:info_count)
233
233
  # logger.attr(:error_count)
234
- # logger.def(:info) { |value| buffer << value; self.info_count += 1 }
235
- # logger.def(:error) { |value| buffer << value; self.error_count += 1 }
234
+ # logger.method(:info) { |value| buffer << value; self.info_count += 1 }
235
+ # logger.method(:error) { |value| buffer << value; self.error_count += 1 }
236
236
  # logger.buffer = []
237
237
  # logger.info_count = 0
238
238
  # logger.error_count = 0
@@ -1,6 +1,6 @@
1
- require File.join(File.dirname(__FILE__), "test_helper")
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
 
3
- class ObserverTest < MicroTest::Test
3
+ class ObserverTest < PryTest::Test
4
4
  test "should support add_step" do
5
5
  step = lambda {}
6
6
  o = Hero::Observer.new(:example)
@@ -1,6 +1,10 @@
1
- require "micro_test"
2
- require "micro_mock"
1
+ require "pry-test"
2
+ require "spoof"
3
+ require "coveralls"
3
4
 
4
- Dir[File.join(File.dirname(__FILE__), "..", "lib", "*.rb")].each do |file|
5
+ Coveralls.wear!
6
+ SimpleCov.command_name "pry-test"
7
+
8
+ Dir[File.expand_path("../../lib/*.rb", __FILE__)].each do |file|
5
9
  require file
6
10
  end
metadata CHANGED
@@ -1,131 +1,158 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nathan Hopkins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: micro_test
28
+ name: coveralls
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: micro_mock
42
+ name: pry
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: pry
56
+ name: pry-stack_explorer
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-rescue
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
76
74
  - !ruby/object:Gem::Version
77
75
  version: '0'
78
- description: Think of Hero as a simplified state machine.
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: spoof
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A simplified state machine.
79
112
  email:
80
113
  - natehop@gmail.com
81
114
  executables: []
82
115
  extensions: []
83
116
  extra_rdoc_files: []
84
117
  files:
85
- - lib/hero/formula.rb
86
- - lib/hero/observer.rb
87
- - lib/hero/version.rb
88
- - lib/hero.rb
89
118
  - Gemfile
90
119
  - Gemfile.lock
91
120
  - LICENSE.txt
92
- - Rakefile
93
121
  - README.md
122
+ - Rakefile
123
+ - lib/hero.rb
124
+ - lib/hero/formula.rb
125
+ - lib/hero/observer.rb
126
+ - lib/hero/version.rb
94
127
  - test/formula_test.rb
95
128
  - test/observer_test.rb
96
129
  - test/test_helper.rb
97
130
  homepage: https://github.com/hopsoft/hero
98
131
  licenses:
99
132
  - MIT
133
+ metadata: {}
100
134
  post_install_message:
101
135
  rdoc_options: []
102
136
  require_paths:
103
137
  - lib
104
138
  required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
139
  requirements:
107
- - - ! '>='
140
+ - - ">="
108
141
  - !ruby/object:Gem::Version
109
142
  version: '0'
110
- segments:
111
- - 0
112
- hash: 1764610432239977629
113
143
  required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
144
  requirements:
116
- - - ! '>='
145
+ - - ">="
117
146
  - !ruby/object:Gem::Version
118
147
  version: '0'
119
- segments:
120
- - 0
121
- hash: 1764610432239977629
122
148
  requirements: []
123
149
  rubyforge_project:
124
- rubygems_version: 1.8.25
150
+ rubygems_version: 2.2.2
125
151
  signing_key:
126
- specification_version: 3
127
- summary: Think of Hero as a simplified state machine.
152
+ specification_version: 4
153
+ summary: A simplified state machine.
128
154
  test_files:
129
155
  - test/formula_test.rb
130
156
  - test/observer_test.rb
131
157
  - test/test_helper.rb
158
+ has_rdoc: