On 02/27/2012 12:19 PM, Jim Meyering wrote:
Jan Provaznik wrote:
> On 02/24/2012 10:46 PM, Jim Meyering wrote:
>> jprovazn(a)redhat.com wrote:
>>> From: Jan Provaznik<jprovazn(a)redhat.com>
>>>
>>> Theis patch allows locally stopping of instances or deployments if
>>> the instance's/deployment's provider is not accessible.
>>>
>>> It fixes a bug in passing user param to queue_action method, also simplifies
>>> used error messages - only (stop|reboot)_invalid_action can be raised.
>>>
>>> This patch doesn't cover deletion of deployments which are not
>>> accessible - this is difficult
>>> because there is a before_destroy hook on deployment which tries to
>>> destroy instances
>>> on provider side.
>> ...
>>
>> Hi Jan,
>>
>> I noticed that these regexps can be simplified:
>>
>>> diff --git a/src/features/step_definitions/deployment_steps.rb
>>> b/src/features/step_definitions/deployment_steps.rb
>> ...
>>> +Given /^"([^"]*)" deployment's provider is not
accessible$/ do |arg1|
>>
>> Using non-greedy matching like this is equivalent, and more readable:
>>
>> Given /^"(.*?)" deployment's provider is not accessible$/ do
|arg1|
>>
>> ...
>>> diff --git a/src/features/step_definitions/instance_steps.rb
>>> b/src/features/step_definitions/instance_steps.rb
>> ...
>>> +Given /^"([^"]*)" instance's provider is not accessible$/
do |arg1|
>>
>> Given /^"(.*?)" instance's provider is not accessible$/ do
|arg1|
>
> Hi Jim, this is nice tip.
>
> Cucumber pregenerates current version (Given /^([^"]*)"" ...$/ do
> |arg1|) and prints it on stderr when it finds a test with missing step
> definition - so a user can just copy&paste this into step definition
> file. So this improvement could be ideally done on upper (cucumber)
> level.
Thanks, Jan.
I cloned upstream cucumber sources and wrote a partial patch,
(didn't yet make tests reflect the change) but when I try to run the
tests, I get this on Fedora 16:
$ rake
...
Could not find gem 'spork (>= 0.9.0.rc9)' in any of the gem sources\
listed in your Gemfile
Sounds like I need to point Gemfile at dev. sources at least
for spork and capybara, but I don't know how to do that.
You probably don't have spork gem installed - easiest way is to run
'bundle install' in cucumber dir (where you run 'rake' cmd) - this will
install all missing dependencies, or run 'gem install spork' which
installs 'spork' gem but none of others deps, so you would have to run
'gem isntall ...' repeatedly for each dependency.
Hints for a ruby-noob?
From a27fedddeb29d2f8903e210e2180fec80a3a0193 Mon Sep 17 00:00:00 2001
From: Jim Meyering<meyering(a)redhat.com>
Date: Mon, 27 Feb 2012 12:14:47 +0100
Subject: [PATCH] emit readable, more concise /"(.*?)"/ rather than
/"([^"]*)"/
---
lib/cucumber/js_support/js_snippets.rb | 2 +-
lib/cucumber/rb_support/rb_language.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/cucumber/js_support/js_snippets.rb
b/lib/cucumber/js_support/js_snippets.rb
index 3b9de0b..c90b70c 100644
--- a/lib/cucumber/js_support/js_snippets.rb
+++ b/lib/cucumber/js_support/js_snippets.rb
@@ -1,7 +1,7 @@
module Cucumber
module JsSupport
module JsSnippets
- PARAM_PATTERN = /"([^"]*)"/
+ PARAM_PATTERN = /"(.*?)"/
ESCAPED_PARAM_PATTERN = '"([^\\"]*)"'
def snippet_text(code_keyword, step_name, multiline_arg_class)
diff --git a/lib/cucumber/rb_support/rb_language.rb
b/lib/cucumber/rb_support/rb_language.rb
index 63dbef8..7c9cdec 100644
--- a/lib/cucumber/rb_support/rb_language.rb
+++ b/lib/cucumber/rb_support/rb_language.rb
@@ -75,7 +75,7 @@ module Cucumber
end.compact
end
- ARGUMENT_PATTERNS = ['"([^"]*)"', '(\d+)']
+ ARGUMENT_PATTERNS = ['"(.*?)"', '(\d+)']
def snippet_text(code_keyword, step_name, multiline_arg_class)
snippet_pattern = Regexp.escape(step_name).gsub('\ ', '
').gsub('/', '\/')
--
1.7.9.2.278.g61e0c