goon 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,36 +1,37 @@
1
1
  ## Goon ##
2
2
 
3
- Goon is a minion that pulls off heists
3
+ Goon is a minion that performs tasks
4
4
 
5
5
  ## Release Notes ##
6
6
 
7
+ * 0.0.3 - Renamed "Heist" to "Task," as that makes more sense.
7
8
  * 0.0.2 - For example, our naivite caused us to think that we could cut a gem without jumping through hoops.
8
9
  * 0.0.1 - Initial release. Basically usable and spec'd, but probably has some
9
10
  naive implementation.
10
11
 
11
12
  ## Goons? ##
12
13
 
13
- That is, a goon object, being taught the proper competencies, will pull off a
14
- valid Heist and remember facts related to the process.
14
+ That is, a goon object, being taught the proper competencies, will perform a
15
+ valid Task and remember facts related to the process.
15
16
 
16
17
  ### .new ###
17
18
 
18
- Creating a Goon is pretty easy, but a Goon created without a Heist is just
19
+ Creating a Goon is pretty easy, but a Goon created without a Task is just
19
20
  about worthless. The following will actually do the trick:
20
21
 
21
22
  goon = Goon.new
22
23
 
23
- The following, however, is a lot more useful (or would be if the Heist wasn't
24
+ The following, however, is a lot more useful (or would be if the Task wasn't
24
25
  just terribly cordial):
25
26
 
26
27
  goon = Goon.new(
27
- :heist => OpenStruct(
28
- :name => 'Heist!!!',
28
+ :task => OpenStruct(
29
+ :name => 'Hello!!!',
29
30
  :body => 'puts "hello"'
30
31
  )
31
32
  )
32
33
 
33
- In addition to the :heist option, you can pass in an array of Competency objects
34
+ In addition to the :task option, you can pass in an array of Competency objects
34
35
  with the :competencies option or a hash of facts with the :facts option.
35
36
 
36
37
  ### #learn_competency ###
@@ -55,40 +56,38 @@ A goon can forget facts that it has remembered. The forget method takes a fact n
55
56
 
56
57
  ### #run ###
57
58
 
58
- A goon can pull off a Heist. The run method takes no arguments, but returns the facts that it has remembered when it is done with the job.
59
+ A goon can perform a Task. The run method takes no arguments, but returns the facts that it has remembered when it is done with the job.
59
60
 
60
- ## Heists? ##
61
+ ## Tasks? ##
61
62
 
62
- Yeah. Heists. We like metaphors.
63
-
64
- A Heist, when it comes down, is any object that fits this bill:
63
+ A Task, when it comes down, is any object that fits this bill:
65
64
 
66
65
  * Has a name method that returns a non-empty string
67
66
  * Has a body method that returns a non-empty string
68
67
 
69
- That said, goon/heist contains the Goon::Heist class that will absolutely always
68
+ That said, goon/task contains the Goon::Task class that will absolutely always
70
69
  work with Goon, and it also validates itself on creation. Unfortunately, using
71
- this class to make a Heist means that exceptions will be raised if an invalid
70
+ this class to make a Task means that exceptions will be raised if an invalid
72
71
  name or body is provided.
73
72
 
74
73
  ### name ###
75
74
 
76
- The name of a Heist is just that ... it is a (preferably) unique identifier.
75
+ The name of a Task is just that ... it is a (preferably) unique identifier.
77
76
 
78
77
  ### body ###
79
78
 
80
- The body of a Heist is a snippet of code. Most typically,
79
+ The body of a Task is a snippet of code. Most typically,
81
80
 
82
81
  ## Competencies? ##
83
82
 
84
- A Competency is a skill that one can teach one's goons. Much like a Heist, a
83
+ A Competency is a skill that one can teach one's goons. Much like a Task, a
85
84
  competency can be pretty much any object so long as it fits the following:
86
85
 
87
86
  * Has a name method that returns a non-empty string
88
87
  * Has a body method that returns a non-empty string
89
88
 
90
89
  If you would like to use our reference Competency, it lives in goon/competency.
91
- The same caveats (and then some) apply to this as do to our reference Heist.
90
+ The same caveats (and then some) apply to this as do to our reference Task.
92
91
 
93
92
  When a Goon learns a Competency, the Goon in question gains an equivalent
94
93
  instance method to said Competency. So, say that we have a Competency named
@@ -123,7 +122,7 @@ on this, but take our word that you absolutely want this to be valid Ruby.
123
122
  <pre>
124
123
  require 'goon'
125
124
  require 'goon/competency'
126
- require 'goon/heist'
125
+ require 'goon/task'
127
126
  require 'json'
128
127
 
129
128
  competencies = []
@@ -142,7 +141,7 @@ competencies << Goon::Competency.new(
142
141
  :body => "puts options[:phrase]"
143
142
  )
144
143
 
145
- heist = Goon::Heist.new(
144
+ task = Goon::Task.new(
146
145
  :name => 'The Stinky Teen Job',
147
146
  :body => <<-EOS
148
147
  hello
@@ -154,17 +153,17 @@ heist = Goon::Heist.new(
154
153
  EOS
155
154
  )
156
155
 
157
- my_goon = Goon.new(:competencies => competencies, :heist => heist)
158
- puts "## Running the '#{heist.name}' heist ..."
156
+ my_goon = Goon.new(:competencies => competencies, :task => task)
157
+ puts "## Running the '#{task.name}' task ..."
159
158
  goon_results = my_goon.run
160
- puts "## Finished the '#{heist.name}' heist"
159
+ puts "## Finished the '#{task.name}' task"
161
160
 
162
161
  # Since the goon was not instructed to remember anything, an empty hash is
163
162
  # returned.
164
163
 
165
- puts "## '#{heist.name}' Results: #{goon_results.to_json}\n"
164
+ puts "## '#{task.name}' Results: #{goon_results.to_json}\n"
166
165
 
167
- heist = Goon::Heist.new(
166
+ task = Goon::Task.new(
168
167
  :name => 'Remember Remember',
169
168
  :body => <<-EOS
170
169
  puts "remembering the date"
@@ -174,15 +173,15 @@ heist = Goon::Heist.new(
174
173
  EOS
175
174
  )
176
175
 
177
- my_goon = Goon.new(:heist => heist)
176
+ my_goon = Goon.new(:task => task)
178
177
 
179
- puts "## Running the '#{heist.name}' heist ..."
178
+ puts "## Running the '#{task.name}' task ..."
180
179
 
181
180
  goon_results = my_goon.run
182
181
 
183
- puts "## Finished the '#{heist.name}' heist"
182
+ puts "## Finished the '#{task.name}' task"
184
183
 
185
184
  # Since the goon was told to remember things, we get back a non-empty hash.
186
185
 
187
- puts "## '#{heist.name}' Results: #{goon_results.to_json}"
186
+ puts "## '#{task.name}' Results: #{goon_results.to_json}"
188
187
  </pre>
@@ -1,12 +1,12 @@
1
1
  require 'goon/version'
2
2
 
3
3
  class Goon
4
- attr_reader :competencies, :heist, :facts
4
+ attr_reader :competencies, :task, :facts
5
5
 
6
6
  def initialize(options = {})
7
7
  competencies = options[:competencies] || []
8
8
  @competencies = []
9
- @heist = options[:heist]
9
+ @task = options[:task]
10
10
  @facts = options[:facts] || {}
11
11
  learn_competencies(competencies)
12
12
  end
@@ -52,7 +52,7 @@ class Goon
52
52
  end
53
53
 
54
54
  def run
55
- instance_eval @heist.body
55
+ instance_eval @task.body
56
56
  @facts
57
57
  end
58
58
  end
@@ -1,7 +1,7 @@
1
1
  require 'goon'
2
2
 
3
- class Goon::Heist
4
- class InvalidHeist < Exception
3
+ class Goon::Task
4
+ class InvalidTask < Exception
5
5
  end
6
6
 
7
7
  attr_reader :name, :body
@@ -28,12 +28,12 @@ class Goon::Heist
28
28
  private
29
29
 
30
30
  def validate_name!
31
- raise InvalidHeist, "name cannot be nil" if @name.nil?
32
- raise InvalidHeist, "name cannot be blank" if @name.gsub(/\s+/, '').empty?
31
+ raise InvalidTask, "name cannot be nil" if @name.nil?
32
+ raise InvalidTask, "name cannot be blank" if @name.gsub(/\s+/, '').empty?
33
33
  end
34
34
 
35
35
  def validate_body!
36
- raise InvalidHeist, "body cannot be nil" if @body.nil?
37
- raise InvalidHeist, "body cannot be blank" if @body.gsub(/\s+/, '').empty?
36
+ raise InvalidTask, "body cannot be nil" if @body.nil?
37
+ raise InvalidTask, "body cannot be blank" if @body.gsub(/\s+/, '').empty?
38
38
  end
39
39
  end
@@ -1,3 +1,3 @@
1
1
  class Goon
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
+ - Applied Awesome
8
9
  - Dennis Walters
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-03-12 00:00:00.000000000Z
13
+ date: 2012-03-18 00:00:00.000000000Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rake
16
- requirement: &10212600 !ruby/object:Gem::Requirement
17
+ requirement: &7220880 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ~>
@@ -21,10 +22,10 @@ dependencies:
21
22
  version: 0.9.2
22
23
  type: :development
23
24
  prerelease: false
24
- version_requirements: *10212600
25
+ version_requirements: *7220880
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: rdoc
27
- requirement: &10212140 !ruby/object:Gem::Requirement
28
+ requirement: &7219780 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ~>
@@ -32,10 +33,10 @@ dependencies:
32
33
  version: '3.8'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *10212140
36
+ version_requirements: *7219780
36
37
  - !ruby/object:Gem::Dependency
37
38
  name: rspec
38
- requirement: &10211680 !ruby/object:Gem::Requirement
39
+ requirement: &7218760 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ~>
@@ -43,10 +44,10 @@ dependencies:
43
44
  version: 2.8.0
44
45
  type: :development
45
46
  prerelease: false
46
- version_requirements: *10211680
47
+ version_requirements: *7218760
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: coco
49
- requirement: &10211220 !ruby/object:Gem::Requirement
50
+ requirement: &7217100 !ruby/object:Gem::Requirement
50
51
  none: false
51
52
  requirements:
52
53
  - - ~>
@@ -54,10 +55,10 @@ dependencies:
54
55
  version: '0.6'
55
56
  type: :development
56
57
  prerelease: false
57
- version_requirements: *10211220
58
+ version_requirements: *7217100
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: mocha
60
- requirement: &10210760 !ruby/object:Gem::Requirement
61
+ requirement: &7215980 !ruby/object:Gem::Requirement
61
62
  none: false
62
63
  requirements:
63
64
  - - ~>
@@ -65,21 +66,21 @@ dependencies:
65
66
  version: 0.10.5
66
67
  type: :development
67
68
  prerelease: false
68
- version_requirements: *10210760
69
- description: ! ' Goon is a minion that pulls off Heists
69
+ version_requirements: *7215980
70
+ description: ! ' Goon is a minion that performs Tasks
70
71
 
71
72
  '
72
- email: pooster@gmail.com
73
+ email: hi@appliedawesome.com
73
74
  executables: []
74
75
  extensions: []
75
76
  extra_rdoc_files: []
76
77
  files:
77
78
  - lib/goon.rb
79
+ - lib/goon/task.rb
78
80
  - lib/goon/version.rb
79
- - lib/goon/heist.rb
80
81
  - lib/goon/competency.rb
81
82
  - README.md
82
- homepage: https://github.com/ess/goon
83
+ homepage: https://github.com/appliedawesome/goon
83
84
  licenses: []
84
85
  post_install_message:
85
86
  rdoc_options: