spicycode-micronaut 0.1.0 → 0.1.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/Rakefile +1 -4
- data/examples/example_helper.rb +4 -3
- data/lib/micronaut/behaviour.rb +10 -2
- data/lib/micronaut/configuration.rb +13 -0
- data/lib/micronaut/runner.rb +7 -11
- data/lib/micronaut/runner_options.rb +1 -1
- data/lib/micronaut.rb +1 -1
- metadata +4 -12
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rubygems/specification'
|
|
4
4
|
require 'date'
|
5
5
|
|
6
6
|
GEM = "micronaut"
|
7
|
-
GEM_VERSION = "0.1.
|
7
|
+
GEM_VERSION = "0.1.1"
|
8
8
|
AUTHOR = "Chad Humphries"
|
9
9
|
EMAIL = "chad@spicycode.com"
|
10
10
|
HOMEPAGE = "http://spicycode.com"
|
@@ -22,9 +22,6 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.email = EMAIL
|
23
23
|
s.homepage = HOMEPAGE
|
24
24
|
|
25
|
-
# Uncomment this to add a dependency
|
26
|
-
s.add_dependency "mocha"
|
27
|
-
|
28
25
|
s.require_path = 'lib'
|
29
26
|
s.autorequire = GEM
|
30
27
|
s.files = %w(LICENSE README RSPEC-LICENSE Rakefile) + Dir.glob("{lib,examples}/**/*")
|
data/examples/example_helper.rb
CHANGED
@@ -2,6 +2,7 @@ lib_path = File.expand_path(File.dirname(__FILE__) + "/../lib")
|
|
2
2
|
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
|
3
3
|
|
4
4
|
require 'micronaut'
|
5
|
+
gem :mocha
|
5
6
|
require File.expand_path(File.dirname(__FILE__) + "/resources/example_classes")
|
6
7
|
|
7
8
|
module Micronaut
|
@@ -29,7 +30,7 @@ end
|
|
29
30
|
Micronaut.configure do |config|
|
30
31
|
|
31
32
|
config.mock_with :mocha
|
33
|
+
config.autorun!
|
34
|
+
config.options = Micronaut::RunnerOptions.new(:color => true, :formatter => :progress)
|
32
35
|
|
33
|
-
end
|
34
|
-
|
35
|
-
Micronaut::Runner.autorun
|
36
|
+
end
|
data/lib/micronaut/behaviour.rb
CHANGED
@@ -6,6 +6,11 @@ module Micronaut
|
|
6
6
|
super
|
7
7
|
Micronaut::World.behaviour_groups << klass
|
8
8
|
end
|
9
|
+
|
10
|
+
def self.extended_modules #:nodoc:
|
11
|
+
ancestors = class << self; ancestors end
|
12
|
+
ancestors.select { |mod| mod.class == Module } - [ Object, Kernel ]
|
13
|
+
end
|
9
14
|
|
10
15
|
def self.befores
|
11
16
|
@_befores ||= { :all => [], :each => [] }
|
@@ -54,7 +59,11 @@ module Micronaut
|
|
54
59
|
metadata[:name] = "#{metadata[:described_type]} #{metadata[:description]}".strip
|
55
60
|
|
56
61
|
Micronaut.configuration.find_modules(self).each do |include_or_extend, mod, opts|
|
57
|
-
|
62
|
+
if include_or_extend == :extend
|
63
|
+
send(:extend, mod) unless extended_modules.include?(mod)
|
64
|
+
else
|
65
|
+
send(:include, mod) unless included_modules.include?(mod)
|
66
|
+
end
|
58
67
|
end
|
59
68
|
end
|
60
69
|
|
@@ -144,7 +153,6 @@ module Micronaut
|
|
144
153
|
reporter.add_behaviour(self)
|
145
154
|
|
146
155
|
group = new
|
147
|
-
|
148
156
|
eval_before_alls(group)
|
149
157
|
success = true
|
150
158
|
|
@@ -26,6 +26,19 @@ module Micronaut
|
|
26
26
|
Micronaut::Behaviour.send(:include, @mock_framework)
|
27
27
|
end
|
28
28
|
|
29
|
+
def autorun!
|
30
|
+
Micronaut::Runner.autorun unless Micronaut::Runner.installed_at_exit?
|
31
|
+
end
|
32
|
+
|
33
|
+
def options=(new_options)
|
34
|
+
raise ArguementError unless new_options.is_a?(Micronaut::RunnerOptions)
|
35
|
+
@options = new_options
|
36
|
+
end
|
37
|
+
|
38
|
+
def options
|
39
|
+
@options ||= Micronaut::RunnerOptions.new(:color => true, :formatter => :documentation)
|
40
|
+
end
|
41
|
+
|
29
42
|
def extra_modules
|
30
43
|
@extra_modules ||= []
|
31
44
|
end
|
data/lib/micronaut/runner.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
module Micronaut
|
2
2
|
|
3
3
|
class Runner
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def self.options
|
8
|
-
@options ||= Micronaut::RunnerOptions.new(:color => true, :formatter => :documentation)
|
4
|
+
|
5
|
+
def self.installed_at_exit?
|
6
|
+
@installed_at_exit ||= false
|
9
7
|
end
|
10
|
-
|
8
|
+
|
11
9
|
def self.autorun
|
12
|
-
at_exit {
|
13
|
-
|
14
|
-
} unless @@installed_at_exit
|
15
|
-
@@installed_at_exit = true
|
10
|
+
at_exit { Micronaut::Runner.new.run(ARGV) ? exit(0) : exit(1) } unless installed_at_exit?
|
11
|
+
@installed_at_exit = true
|
16
12
|
end
|
17
13
|
|
18
14
|
def options
|
19
|
-
|
15
|
+
Micronaut.configuration.options
|
20
16
|
end
|
21
17
|
|
22
18
|
def run(args = [])
|
data/lib/micronaut.rb
CHANGED
@@ -25,7 +25,7 @@ module Micronaut
|
|
25
25
|
|
26
26
|
# './lib' in project dir, or '/usr/local/blahblah' if installed
|
27
27
|
InstallDirectory = File.expand_path(File.dirname(File.dirname(file)) + "/lib")
|
28
|
-
|
28
|
+
|
29
29
|
def self.configuration
|
30
30
|
@configuration ||= Micronaut::Configuration.new
|
31
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spicycode-micronaut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Humphries
|
@@ -9,18 +9,10 @@ autorequire: micronaut
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: mocha
|
17
|
-
version_requirement:
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: "0"
|
23
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
24
16
|
description: An excellent replacement for the wheel...
|
25
17
|
email: chad@spicycode.com
|
26
18
|
executables: []
|