angry_mob 0.1.0
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/LICENSE +21 -0
- data/README.md +123 -0
- data/bin/mob +139 -0
- data/lib/angry_mob.rb +28 -0
- data/lib/angry_mob/act.rb +111 -0
- data/lib/angry_mob/act/scheduler.rb +143 -0
- data/lib/angry_mob/action.rb +11 -0
- data/lib/angry_mob/builder.rb +115 -0
- data/lib/angry_mob/extend.rb +10 -0
- data/lib/angry_mob/extend/array.rb +30 -0
- data/lib/angry_mob/extend/blank.rb +108 -0
- data/lib/angry_mob/extend/blankslate.rb +109 -0
- data/lib/angry_mob/extend/dictionary.rb +140 -0
- data/lib/angry_mob/extend/hash.rb +67 -0
- data/lib/angry_mob/extend/object.rb +21 -0
- data/lib/angry_mob/extend/pathname.rb +23 -0
- data/lib/angry_mob/extend/string.rb +8 -0
- data/lib/angry_mob/log.rb +28 -0
- data/lib/angry_mob/mob.rb +77 -0
- data/lib/angry_mob/mob_loader.rb +115 -0
- data/lib/angry_mob/node.rb +44 -0
- data/lib/angry_mob/notifier.rb +76 -0
- data/lib/angry_mob/target.rb +257 -0
- data/lib/angry_mob/target/arguments.rb +71 -0
- data/lib/angry_mob/target/call.rb +57 -0
- data/lib/angry_mob/target/default_resource_locator.rb +11 -0
- data/lib/angry_mob/target/defaults.rb +23 -0
- data/lib/angry_mob/target/mother.rb +66 -0
- data/lib/angry_mob/target/notify.rb +57 -0
- data/lib/angry_mob/target/tracking.rb +96 -0
- data/lib/angry_mob/ui.rb +247 -0
- data/lib/angry_mob/util.rb +11 -0
- data/lib/angry_mob/vendored.rb +8 -0
- data/lib/angry_mob/version.rb +3 -0
- data/vendor/angry_hash/Rakefile +17 -0
- data/vendor/angry_hash/VERSION +1 -0
- data/vendor/angry_hash/angry_hash.gemspec +47 -0
- data/vendor/angry_hash/examples/accessors_eg.rb +46 -0
- data/vendor/angry_hash/examples/creation_eg.rb +43 -0
- data/vendor/angry_hash/examples/dsl.eg.rb +18 -0
- data/vendor/angry_hash/examples/dup_eg.rb +86 -0
- data/vendor/angry_hash/examples/eg_helper.rb +24 -0
- data/vendor/angry_hash/examples/merge_eg.rb +135 -0
- data/vendor/angry_hash/lib/angry_hash.rb +215 -0
- data/vendor/angry_hash/lib/angry_hash/dsl.rb +44 -0
- data/vendor/angry_hash/lib/angry_hash/extension_tracking.rb +12 -0
- data/vendor/angry_hash/lib/angry_hash/merge_string.rb +58 -0
- data/vendor/json/COPYING +58 -0
- data/vendor/json/GPL +340 -0
- data/vendor/json/README +360 -0
- data/vendor/json/lib/json/common.rb +371 -0
- data/vendor/json/lib/json/pure.rb +77 -0
- data/vendor/json/lib/json/pure/generator.rb +443 -0
- data/vendor/json/lib/json/pure/parser.rb +303 -0
- data/vendor/json/lib/json/version.rb +8 -0
- data/vendor/thor/CHANGELOG.rdoc +89 -0
- data/vendor/thor/LICENSE +20 -0
- data/vendor/thor/README.rdoc +297 -0
- data/vendor/thor/Thorfile +69 -0
- data/vendor/thor/bin/rake2thor +86 -0
- data/vendor/thor/bin/thor +6 -0
- data/vendor/thor/lib/thor.rb +244 -0
- data/vendor/thor/lib/thor/actions.rb +275 -0
- data/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/vendor/thor/lib/thor/actions/directory.rb +91 -0
- data/vendor/thor/lib/thor/actions/empty_directory.rb +134 -0
- data/vendor/thor/lib/thor/actions/file_manipulation.rb +223 -0
- data/vendor/thor/lib/thor/actions/inject_into_file.rb +104 -0
- data/vendor/thor/lib/thor/base.rb +540 -0
- data/vendor/thor/lib/thor/core_ext/file_binary_read.rb +9 -0
- data/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/vendor/thor/lib/thor/core_ext/ordered_hash.rb +100 -0
- data/vendor/thor/lib/thor/error.rb +30 -0
- data/vendor/thor/lib/thor/group.rb +271 -0
- data/vendor/thor/lib/thor/invocation.rb +180 -0
- data/vendor/thor/lib/thor/parser.rb +4 -0
- data/vendor/thor/lib/thor/parser/argument.rb +67 -0
- data/vendor/thor/lib/thor/parser/arguments.rb +150 -0
- data/vendor/thor/lib/thor/parser/option.rb +128 -0
- data/vendor/thor/lib/thor/parser/options.rb +169 -0
- data/vendor/thor/lib/thor/rake_compat.rb +66 -0
- data/vendor/thor/lib/thor/runner.rb +314 -0
- data/vendor/thor/lib/thor/shell.rb +83 -0
- data/vendor/thor/lib/thor/shell/basic.rb +239 -0
- data/vendor/thor/lib/thor/shell/color.rb +108 -0
- data/vendor/thor/lib/thor/task.rb +102 -0
- data/vendor/thor/lib/thor/util.rb +224 -0
- data/vendor/thor/lib/thor/version.rb +3 -0
- data/vendor/thor/spec/actions/create_file_spec.rb +170 -0
- data/vendor/thor/spec/actions/directory_spec.rb +131 -0
- data/vendor/thor/spec/actions/empty_directory_spec.rb +91 -0
- data/vendor/thor/spec/actions/file_manipulation_spec.rb +271 -0
- data/vendor/thor/spec/actions/inject_into_file_spec.rb +135 -0
- data/vendor/thor/spec/actions_spec.rb +292 -0
- data/vendor/thor/spec/base_spec.rb +263 -0
- data/vendor/thor/spec/core_ext/hash_with_indifferent_access_spec.rb +43 -0
- data/vendor/thor/spec/core_ext/ordered_hash_spec.rb +115 -0
- data/vendor/thor/spec/fixtures/application.rb +2 -0
- data/vendor/thor/spec/fixtures/bundle/execute.rb +6 -0
- data/vendor/thor/spec/fixtures/bundle/main.thor +1 -0
- data/vendor/thor/spec/fixtures/doc/%file_name%.rb.tt +1 -0
- data/vendor/thor/spec/fixtures/doc/README +3 -0
- data/vendor/thor/spec/fixtures/doc/config.rb +1 -0
- data/vendor/thor/spec/fixtures/group.thor +90 -0
- data/vendor/thor/spec/fixtures/invoke.thor +112 -0
- data/vendor/thor/spec/fixtures/script.thor +145 -0
- data/vendor/thor/spec/fixtures/task.thor +10 -0
- data/vendor/thor/spec/group_spec.rb +171 -0
- data/vendor/thor/spec/invocation_spec.rb +107 -0
- data/vendor/thor/spec/parser/argument_spec.rb +47 -0
- data/vendor/thor/spec/parser/arguments_spec.rb +64 -0
- data/vendor/thor/spec/parser/option_spec.rb +202 -0
- data/vendor/thor/spec/parser/options_spec.rb +292 -0
- data/vendor/thor/spec/rake_compat_spec.rb +68 -0
- data/vendor/thor/spec/runner_spec.rb +210 -0
- data/vendor/thor/spec/shell/basic_spec.rb +205 -0
- data/vendor/thor/spec/shell/color_spec.rb +41 -0
- data/vendor/thor/spec/shell_spec.rb +34 -0
- data/vendor/thor/spec/spec.opts +1 -0
- data/vendor/thor/spec/spec_helper.rb +54 -0
- data/vendor/thor/spec/task_spec.rb +69 -0
- data/vendor/thor/spec/thor_spec.rb +237 -0
- data/vendor/thor/spec/util_spec.rb +163 -0
- data/vendor/thor/thor.gemspec +120 -0
- metadata +199 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class AngryMob
|
|
2
|
+
class Target
|
|
3
|
+
class Notify
|
|
4
|
+
attr_reader :target, :args, :actions
|
|
5
|
+
def nickname; @target end
|
|
6
|
+
|
|
7
|
+
def initialize(act)
|
|
8
|
+
@act = act
|
|
9
|
+
|
|
10
|
+
@target = nil
|
|
11
|
+
@args = AngryHash.new
|
|
12
|
+
|
|
13
|
+
@actions = []
|
|
14
|
+
|
|
15
|
+
@backtrace = caller
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def inject_actions(args)
|
|
19
|
+
args.actions = @actions
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call(mob)
|
|
23
|
+
raise "not used anymore"
|
|
24
|
+
args = Arguments.parse(@args)
|
|
25
|
+
inject_actions(args)
|
|
26
|
+
|
|
27
|
+
# localise to save into closure
|
|
28
|
+
target = @target
|
|
29
|
+
|
|
30
|
+
# this block is instance_eval'd
|
|
31
|
+
@act.in_sub_act do
|
|
32
|
+
send(target, args)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def method_missing(method,*args,&blk)
|
|
37
|
+
if ! @target
|
|
38
|
+
@target = method.to_s
|
|
39
|
+
@args = AngryHash.__convert_without_dup( args.first ) if args.first
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
if method == :now
|
|
43
|
+
raise "notify.now is no longer supported"
|
|
44
|
+
|
|
45
|
+
else
|
|
46
|
+
@actions << method.to_s
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
return self
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def inspect
|
|
53
|
+
"#<AM::T::Notify target=#{@target} actions=#{@actions.inspect}>"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
class AngryMob
|
|
2
|
+
class Target
|
|
3
|
+
module Tracking
|
|
4
|
+
class << self
|
|
5
|
+
def included(base) #:nodoc:
|
|
6
|
+
base.send :extend, ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Returns the classes that inherit from AngryMob::Target
|
|
10
|
+
def subclasses
|
|
11
|
+
@subclasses ||= {}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Returns the files where the subclasses are kept.
|
|
15
|
+
def subclass_files
|
|
16
|
+
@subclass_files ||= Hash.new{ |h,k| h[k] = [] }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Whenever a class inherits from AngryMob::Target, we should track the
|
|
20
|
+
# class and the file on AngryMob::Target::Tracking. This is the method responsable for it.
|
|
21
|
+
#
|
|
22
|
+
def register_klass_file(klass) #:nodoc:
|
|
23
|
+
file = caller[1].match(/(.*):\d+/)[1]
|
|
24
|
+
|
|
25
|
+
nickname = klass.nickname.to_s
|
|
26
|
+
AngryMob::Target::Tracking.subclasses[nickname] = klass unless AngryMob::Target::Tracking.subclasses.key?(nickname)
|
|
27
|
+
|
|
28
|
+
file_subclasses = AngryMob::Target::Tracking.subclass_files[File.expand_path(file)]
|
|
29
|
+
file_subclasses << klass unless file_subclasses.include?(klass)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
module ClassMethods
|
|
34
|
+
# Everytime someone inherits from a AngryMob::Target class, register the klass
|
|
35
|
+
# and file into baseclass.
|
|
36
|
+
def inherited(klass)
|
|
37
|
+
AngryMob::Target::Tracking.register_klass_file(klass)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Fire this callback whenever a method is added. Added methods are
|
|
41
|
+
# tracked as tasks by invoking the create_task method.
|
|
42
|
+
def method_added(meth)
|
|
43
|
+
meth = meth.to_s
|
|
44
|
+
|
|
45
|
+
if meth == "initialize"
|
|
46
|
+
initialize_added
|
|
47
|
+
return
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Return if it's not a public instance method
|
|
51
|
+
return unless public_instance_methods.include?(meth) ||
|
|
52
|
+
public_instance_methods.include?(meth.to_sym)
|
|
53
|
+
|
|
54
|
+
return unless create_action(meth)
|
|
55
|
+
|
|
56
|
+
#is_thor_reserved_word?(meth, :task)
|
|
57
|
+
AngryMob::Target::Tracking.register_klass_file(self)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def nickname(name=nil)
|
|
61
|
+
if name
|
|
62
|
+
@nickname = name
|
|
63
|
+
AngryMob::Target::Tracking.register_klass_file(self)
|
|
64
|
+
else
|
|
65
|
+
if @nickname
|
|
66
|
+
@nickname
|
|
67
|
+
else
|
|
68
|
+
Util.snake_case(to_s)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
protected
|
|
74
|
+
|
|
75
|
+
# Retrieves a value from superclass. If it reaches the baseclass,
|
|
76
|
+
# returns default.
|
|
77
|
+
def from_superclass(method, default=nil)
|
|
78
|
+
if self == baseclass || !superclass.respond_to?(method, true)
|
|
79
|
+
default
|
|
80
|
+
else
|
|
81
|
+
value = superclass.send(method)
|
|
82
|
+
value.dup if value
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def create_action(meth)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def initialize_added
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
data/lib/angry_mob/ui.rb
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
|
|
2
|
+
class AngryMob
|
|
3
|
+
class UI
|
|
4
|
+
# Embed in a String to clear all previous ANSI sequences.
|
|
5
|
+
CLEAR = "\e[0m"
|
|
6
|
+
# The start of an ANSI bold sequence.
|
|
7
|
+
BOLD = "\e[1m"
|
|
8
|
+
|
|
9
|
+
# Set the terminal's foreground ANSI color to black.
|
|
10
|
+
BLACK = "\e[30m"
|
|
11
|
+
# Set the terminal's foreground ANSI color to red.
|
|
12
|
+
RED = "\e[31m"
|
|
13
|
+
# Set the terminal's foreground ANSI color to green.
|
|
14
|
+
GREEN = "\e[32m"
|
|
15
|
+
# Set the terminal's foreground ANSI color to yellow.
|
|
16
|
+
YELLOW = "\e[33m"
|
|
17
|
+
# Set the terminal's foreground ANSI color to blue.
|
|
18
|
+
BLUE = "\e[34m"
|
|
19
|
+
# Set the terminal's foreground ANSI color to magenta.
|
|
20
|
+
MAGENTA = "\e[35m"
|
|
21
|
+
# Set the terminal's foreground ANSI color to cyan.
|
|
22
|
+
CYAN = "\e[36m"
|
|
23
|
+
# Set the terminal's foreground ANSI color to white.
|
|
24
|
+
WHITE = "\e[37m"
|
|
25
|
+
|
|
26
|
+
GRAY = "#{BOLD}#{BLACK}"
|
|
27
|
+
|
|
28
|
+
BRIGHT_WHITE = "#{BOLD}#{WHITE}"
|
|
29
|
+
|
|
30
|
+
# Set the terminal's background ANSI color to black.
|
|
31
|
+
ON_BLACK = "\e[40m"
|
|
32
|
+
# Set the terminal's background ANSI color to red.
|
|
33
|
+
ON_RED = "\e[41m"
|
|
34
|
+
# Set the terminal's background ANSI color to green.
|
|
35
|
+
ON_GREEN = "\e[42m"
|
|
36
|
+
# Set the terminal's background ANSI color to yellow.
|
|
37
|
+
ON_YELLOW = "\e[43m"
|
|
38
|
+
# Set the terminal's background ANSI color to blue.
|
|
39
|
+
ON_BLUE = "\e[44m"
|
|
40
|
+
# Set the terminal's background ANSI color to magenta.
|
|
41
|
+
ON_MAGENTA = "\e[45m"
|
|
42
|
+
# Set the terminal's background ANSI color to cyan.
|
|
43
|
+
ON_CYAN = "\e[46m"
|
|
44
|
+
# Set the terminal's background ANSI color to white.
|
|
45
|
+
ON_WHITE = "\e[47m"
|
|
46
|
+
|
|
47
|
+
attr_reader :level, :result, :message, :stack
|
|
48
|
+
|
|
49
|
+
def initialize(options={}, min_level=0, stack=[])
|
|
50
|
+
@options = options
|
|
51
|
+
@stack = stack
|
|
52
|
+
@min_level = @level = min_level
|
|
53
|
+
@colour = CLEAR
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#def self.stack; @stack ||= [] end
|
|
57
|
+
#def stack; self.class.stack end
|
|
58
|
+
def current
|
|
59
|
+
stack.last || self
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def colourise(string, colour, bold=false)
|
|
63
|
+
color = self.class.const_get(colour.to_s.upcase) if colour.is_a?(Symbol)
|
|
64
|
+
bold = bold ? BOLD : ""
|
|
65
|
+
"#{bold}#{color}#{string}#{CLEAR}"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def recolourize(colour)
|
|
69
|
+
$stdout.print("\e[s\e[1G#{RED}\e[u")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def say(message="", colour=nil, force_new_line=(message.to_s !~ /( |\t)$/))
|
|
73
|
+
return if self.class.silence?
|
|
74
|
+
|
|
75
|
+
message = message.to_s
|
|
76
|
+
message = colourise(message, colour) if colour
|
|
77
|
+
|
|
78
|
+
if force_new_line
|
|
79
|
+
$stdout.puts(message)
|
|
80
|
+
else
|
|
81
|
+
$stdout.print(message)
|
|
82
|
+
$stdout.flush
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def isay(message, colour=nil, force_new_line=(message.to_s !~ /( |\t)$/))
|
|
87
|
+
say spaces+message, colour, force_new_line
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def newline
|
|
91
|
+
$stdout.puts "\n" unless self.class.silence?
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def spaces
|
|
95
|
+
" " * @level
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def indent
|
|
99
|
+
@level += 1
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def outdent
|
|
103
|
+
@level -= 1
|
|
104
|
+
@level = @min_level if @level < @min_level
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.silence(&block)
|
|
108
|
+
old_silence,@silence = @silence,true
|
|
109
|
+
yield
|
|
110
|
+
ensure
|
|
111
|
+
@silence = old_silence
|
|
112
|
+
end
|
|
113
|
+
def self.silence?
|
|
114
|
+
@silence
|
|
115
|
+
end
|
|
116
|
+
def silence(&block)
|
|
117
|
+
self.class.silence(&block)
|
|
118
|
+
end
|
|
119
|
+
def silence(&block)
|
|
120
|
+
self.class.silence(&block)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def info(message)
|
|
124
|
+
say spaces+message, :bright_white
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def good(message)
|
|
128
|
+
say spaces+message, :green
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def task(message)
|
|
132
|
+
isay ">> ", :blue
|
|
133
|
+
say message
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def log(message)
|
|
137
|
+
say spaces+indent_string(message, @level+1), :white
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def point(message)
|
|
141
|
+
say spaces+"● #{message}", :blue
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def error(message)
|
|
145
|
+
say spaces+message, :red
|
|
146
|
+
end
|
|
147
|
+
alias_method :bad, :error
|
|
148
|
+
|
|
149
|
+
def debug?
|
|
150
|
+
@debug ||= !(FalseClass === @options[:debug])
|
|
151
|
+
end
|
|
152
|
+
def debug(message)
|
|
153
|
+
say spaces+message, :gray if debug?
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def benchmark?
|
|
157
|
+
@benchmark ||= !(FalseClass === @options[:benchmark])
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def warn(message)
|
|
161
|
+
say spaces+message, :yellow
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def push(message,opts={},&block)
|
|
165
|
+
start_time = Time.now
|
|
166
|
+
start! message
|
|
167
|
+
subui = self.class.new(@options, @level+1,stack)
|
|
168
|
+
|
|
169
|
+
stack.push subui
|
|
170
|
+
|
|
171
|
+
begin
|
|
172
|
+
yield
|
|
173
|
+
rescue Object
|
|
174
|
+
if opts[:bubble]
|
|
175
|
+
raise $!
|
|
176
|
+
else
|
|
177
|
+
subui.exception!($!)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
ensure
|
|
181
|
+
stack.pop
|
|
182
|
+
|
|
183
|
+
say spaces+'}', :yellow, false
|
|
184
|
+
|
|
185
|
+
colour = nil
|
|
186
|
+
|
|
187
|
+
case subui.result
|
|
188
|
+
when :ok
|
|
189
|
+
colour = :green
|
|
190
|
+
say " ✓ #{message}", :green, false
|
|
191
|
+
say " (#{subui.message})", :green, false if subui.message
|
|
192
|
+
|
|
193
|
+
when :skip
|
|
194
|
+
colour = :blue
|
|
195
|
+
say " ● #{message}", :blue, false
|
|
196
|
+
say " (#{subui.message})", :blue, false if subui.message
|
|
197
|
+
|
|
198
|
+
when Exception
|
|
199
|
+
colour = :red
|
|
200
|
+
say " ☠ #{message}", :red, false
|
|
201
|
+
say " (#{subui.message})", :red, false if subui.message
|
|
202
|
+
newline
|
|
203
|
+
raise subui.result
|
|
204
|
+
|
|
205
|
+
else
|
|
206
|
+
colour = :gray
|
|
207
|
+
say " #{message}", :gray, false
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
say(" (#{Time.now-start_time}s)", colour, false) if benchmark?
|
|
211
|
+
|
|
212
|
+
newline
|
|
213
|
+
newline
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def start!(banner)
|
|
217
|
+
say spaces+">> ", :blue
|
|
218
|
+
say banner, :white, false
|
|
219
|
+
say " {", :yellow
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def exception!(ex)
|
|
223
|
+
msg = "[#{ex.class}] - #{ex.message}"
|
|
224
|
+
say spaces+msg, :red
|
|
225
|
+
# backtrace
|
|
226
|
+
|
|
227
|
+
@result = ex
|
|
228
|
+
@message = msg
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def ok!(message=nil)
|
|
232
|
+
@result = :ok
|
|
233
|
+
@message = message
|
|
234
|
+
end
|
|
235
|
+
alias_method :changed!, :ok!
|
|
236
|
+
|
|
237
|
+
def skipped!(message)
|
|
238
|
+
@result = :skip
|
|
239
|
+
@message = message
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
protected
|
|
243
|
+
def indent_string(string,level=@level)
|
|
244
|
+
string.chomp.gsub(/\n/,"\n#{' ' * level}")
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'jeweler'
|
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
|
4
|
+
gemspec.name = "angry_hash"
|
|
5
|
+
gemspec.summary = "A stabler mash with different emphases."
|
|
6
|
+
gemspec.description = "A stabler mash with different emphases. Used in plus2 projects AngryMob and Igor."
|
|
7
|
+
gemspec.email = "lachie@plus2.com.au"
|
|
8
|
+
gemspec.homepage = "http://github.com/plus2/angry_hash"
|
|
9
|
+
gemspec.authors = ["Lachie Cox"]
|
|
10
|
+
gemspec.test_files = []
|
|
11
|
+
gemspec.executables = []
|
|
12
|
+
end
|
|
13
|
+
Jeweler::GemcutterTasks.new
|
|
14
|
+
rescue LoadError
|
|
15
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
|
16
|
+
end
|
|
17
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|