stubby 0.0.12 → 0.0.13
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/README.md +5 -1
- data/lib/stubby/stub.rb +7 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -64,12 +64,16 @@ Install the stubby gem:
|
|
64
64
|
|
65
65
|
## Available Options
|
66
66
|
|
67
|
+
|
67
68
|
> $ sudo stubby -h
|
68
69
|
> Commands:
|
69
70
|
> stubby env NAME # Switch stubby environment
|
71
|
+
> stubby halt # Shut down if running, restore if not
|
70
72
|
> stubby help [COMMAND] # Describe available commands or one specific command
|
71
|
-
> stubby
|
73
|
+
> stubby restore # Restore defaults
|
74
|
+
> stubby start ENVIRONMENT # Starts stubby HTTP and DNS servers
|
72
75
|
> stubby status # View current rules
|
76
|
+
> stubby stop # Stops a running stubby process
|
73
77
|
|
74
78
|
## Getting Started
|
75
79
|
|
data/lib/stubby/stub.rb
CHANGED
@@ -38,7 +38,13 @@ module Stubby
|
|
38
38
|
|
39
39
|
def search(trigger)
|
40
40
|
options.each do |rule, instruction|
|
41
|
-
if Regexp.new(rule, Regexp::EXTENDED | Regexp::IGNORECASE).match(trigger)
|
41
|
+
if match=Regexp.new(rule, Regexp::EXTENDED | Regexp::IGNORECASE).match(trigger)
|
42
|
+
instruction = instruction.dup
|
43
|
+
|
44
|
+
match.to_a.each_with_index.map do |v, i|
|
45
|
+
instruction.gsub!("$#{i}", v)
|
46
|
+
end
|
47
|
+
|
42
48
|
return instruction
|
43
49
|
end
|
44
50
|
end
|