[DRE-commits] [ruby-aruba] 65/98: Make it look like other classes in aruba

Hideki Yamane henrich at moszumanska.debian.org
Tue Mar 22 12:20:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository ruby-aruba.

commit 15d4aa4218b799670060d0f98d755ef0c6bfe64f
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date:   Mon Jan 4 18:01:36 2016 +0100

    Make it look like other classes in aruba
---
 lib/aruba/cucumber/command.rb       |  2 +-
 lib/aruba/generators/script_file.rb | 23 ++++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/lib/aruba/cucumber/command.rb b/lib/aruba/cucumber/command.rb
index 8897649..7e07a18 100644
--- a/lib/aruba/cucumber/command.rb
+++ b/lib/aruba/cucumber/command.rb
@@ -36,7 +36,7 @@ When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) do
   shell ||= Aruba.platform.default_shell
 
   Aruba::ScriptFile.new(:interpreter => shell, :content => commands,
-                 :path => expand_path('bin/myscript')).call
+                        :path => expand_path('bin/myscript')).call
   step 'I run `myscript`'
 end
 
diff --git a/lib/aruba/generators/script_file.rb b/lib/aruba/generators/script_file.rb
index e55fd7c..859ec2e 100644
--- a/lib/aruba/generators/script_file.rb
+++ b/lib/aruba/generators/script_file.rb
@@ -1,7 +1,13 @@
 # Aruba
 module Aruba
-  # ScriptFile
+  # Generate script files on command line
   class ScriptFile
+    private
+
+    attr_reader :path, :content, :interpreter
+
+    public
+
     def initialize(opts = {})
       @path        = opts[:path]
       @content     = opts[:content]
@@ -9,8 +15,8 @@ module Aruba
     end
 
     def call
-      Aruba.platform.write_file(@path, "#{header}#{@content}")
-      Aruba.platform.chmod(0755, @path, {})
+      Aruba.platform.write_file(path, "#{header}#{content}")
+      Aruba.platform.chmod(0755, path, {})
     end
 
     private
@@ -19,23 +25,22 @@ module Aruba
       if script_starts_with_shebang?
         ''
       elsif interpreter_is_absolute_path?
-        format("#!%s\n", @interpreter)
+        format("#!%s\n", interpreter)
       elsif interpreter_is_just_the_name_of_shell?
-        format("#!/usr/bin/env %s\n", @interpreter)
+        format("#!/usr/bin/env %s\n", interpreter)
       end
     end
 
     def interpreter_is_absolute_path?
-      Aruba.platform.absolute_path? @interpreter
+      Aruba.platform.absolute_path? interpreter
     end
 
     def interpreter_is_just_the_name_of_shell?
-      @interpreter =~ /^[-_a-zA-Z.]+$/
+      interpreter =~ /^[-_a-zA-Z.]+$/
     end
 
     def script_starts_with_shebang?
-      @content.start_with? '#!'
+      content.start_with? '#!'
     end
-
   end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git



More information about the Pkg-ruby-extras-commits mailing list