]> git.wincent.com - wikitext.git/commitdiff
DRY up gemspec
authorWincent Colaiuta <win@wincent.com>
Sun, 13 Jun 2010 17:37:24 +0000 (19:37 +0200)
committerWincent Colaiuta <win@wincent.com>
Sun, 13 Jun 2010 17:41:01 +0000 (19:41 +0200)
Rather than repeating the gem names (4 of them), repeat the
"respond_to?" check (1 check) each time through the loop.

Speed not an issue, here, so just run the check every time
through the loop rather than sacrificing readability by
cluttering things up with a local variable.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
wikitext.gemspec

index e5420ac39ed0bf24c79488a8329a370e19a2d8b0..dfcd8b95115af2034f1b6344a62411d2891a4f3e 100644 (file)
@@ -36,15 +36,11 @@ Gem::Specification.new do |s|
                             'spec/*.rb']
   s.extensions        = ['ext/extconf.rb']
   s.executables       = ['wikitext']
-  if s.respond_to? :add_development_dependency
-    s.add_development_dependency 'rspec'
-    s.add_development_dependency 'thor'
-    s.add_development_dependency 'wopen3'
-    s.add_development_dependency 'yard'
-  else
-    s.add_dependency 'rspec'
-    s.add_dependency 'thor'
-    s.add_dependency 'wopen3'
-    s.add_dependency 'yard'
+  %w{rspec thor wopen3 yard}.each do |dep|
+    if s.respond_to? :add_development_dependency
+      s.add_development_dependency dep
+    else
+      s.add_dependency dep
+    end
   end
 end