Class: XamarinTestCloud::TestFile
- Inherits:
-
Object
- Object
- XamarinTestCloud::TestFile
- Defined in:
- lib/xamarin-test-cloud/test_file.rb
Overview
Appropriate for files under features/, <tmpdir>/ and test_servers/
Not appropriate for app and dysm files.
To create a Cucumber configuration instance, use ‘TestFile.cucumber_config`.
Instance Attribute Summary collapse
-
#digest ⇒ Object
readonly
Returns the value of attribute digest.
-
#file_instance ⇒ Object
readonly
Returns the value of attribute file_instance.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#remote_path ⇒ Object
readonly
Returns the value of attribute remote_path.
Class Method Summary collapse
-
.cucumber_config(file) ⇒ Object
Special handling for Cucumber configuration files.
- .file_digest(file, digest = :SHA256) ⇒ Object
Instance Method Summary collapse
-
#initialize(path, basedir) ⇒ TestFile
constructor
A new instance of TestFile.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path, basedir) ⇒ TestFile
Returns a new instance of TestFile.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 39 def initialize(path, basedir) @path = path @basedir = basedir = File.(path) if path != File.() raise ArgumentError, %Q[Path must be expanded: path: #{path} expanded: #{} ] end if !path.start_with?(basedir) raise ArgumentError, %Q[Path must start with basedir: path: #{path} basedir: #{basedir} ] end end |
Instance Attribute Details
#digest ⇒ Object (readonly)
Returns the value of attribute digest.
35 36 37 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 35 def digest @digest end |
#file_instance ⇒ Object (readonly)
Returns the value of attribute file_instance.
35 36 37 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 35 def file_instance @file_instance end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
35 36 37 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 35 def path @path end |
#remote_path ⇒ Object (readonly)
Returns the value of attribute remote_path.
35 36 37 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 35 def remote_path @remote_path end |
Class Method Details
.cucumber_config(file) ⇒ Object
Special handling for Cucumber configuration files.
The server expects the remote file name to be exactly config/cucumber.yml
29 30 31 32 33 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 29 def self.cucumber_config(file) test_file = TestFile.new(file, File.dirname(file)) test_file.instance_variable_set(:@remote_path, "config/cucumber.yml") test_file end |
.file_digest(file, digest = :SHA256) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 11 def self.file_digest(file, digest=:SHA256) case digest when :SHA256 require "digest" Digest::SHA256.file(file).hexdigest when :MD5 require "digest/md5" Digest::MD5.file(file).hexdigest else raise ArgumentError, %Q[Invalid digest type: #{digest}. Only :SHA256 or :MD5 are supported ] end end |
Instance Method Details
#inspect ⇒ Object
66 67 68 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 66 def inspect to_s end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/xamarin-test-cloud/test_file.rb', line 62 def to_s %Q[#<TestFile: #{@path} #{@digest} #{@remote_path}>] end |