stubby 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +5 -1
  2. data/lib/stubby/stub.rb +7 -1
  3. 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 start ENVIRONMENT # Starts stubby HTTP and DNS servers, default env ENVIRONMENT
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stubby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: