Skip to content

Commit

Permalink
Merge pull request #69 from yaxia/dev
Browse files Browse the repository at this point in the history
Changes for 0.11.4-preview
  • Loading branch information
vinjiang authored Nov 30, 2016
2 parents 18b9074 + e62ff95 commit 0ae87ed
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 24 deletions.
10 changes: 10 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2016.11 - version 0.11.4-preview

ALL
* Removed the unnecessary dependencies. [#55](https://github.com/Azure/azure-storage-ruby/issues/55), [#67](https://github.com/Azure/azure-storage-ruby/issues/67)

BLOB
* Fixed the issue when checking the content encoding.
* Fixed the wrong "Content-Encoding" value in the test cases.
* Fixed the issue where it cannot use the `create_block_blob` method with an IO/File object. [#61](https://github.com/Azure/azure-storage-ruby/issues/61)

2016.10 - version 0.11.3-preview

ALL
Expand Down
17 changes: 6 additions & 11 deletions azure-storage.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,16 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 1.9.3'

s.add_runtime_dependency('addressable', '~> 2.3')
s.add_runtime_dependency('azure-core', '~> 0.1')
s.add_runtime_dependency('faraday', '~> 0.9')
s.add_runtime_dependency('faraday_middleware', '~> 0.10')
s.add_runtime_dependency('json', '~> 1.8')
s.add_runtime_dependency('mime-types', '~> 2.0')
s.add_runtime_dependency('nokogiri', '~> 1.6')
s.add_runtime_dependency('systemu', '~> 2.6')
s.add_runtime_dependency('thor', '~> 0.19')

s.add_development_dependency('dotenv', '~> 2.0')
s.add_development_dependency('minitest', '~> 5')
s.add_development_dependency('minitest-reporters', '~> 1')
s.add_development_dependency('mocha', '~> 1.0')
s.add_development_dependency('rake', '~> 10.0')
s.add_development_dependency('timecop', '~> 0.7')
s.add_development_dependency('dotenv', '~> 2.0')
s.add_development_dependency('minitest', '~> 5')
s.add_development_dependency('minitest-reporters', '~> 1')
s.add_development_dependency('mocha', '~> 1.0')
s.add_development_dependency('rake', '~> 10.0')
s.add_development_dependency('timecop', '~> 0.7')
s.add_development_dependency('yard', '~> 0.8')
end
2 changes: 0 additions & 2 deletions lib/azure/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
require 'base64'
require 'openssl'
require 'uri'
require 'rexml/document'
require 'addressable/uri'
require 'faraday'
require 'faraday_middleware'

Expand Down
2 changes: 1 addition & 1 deletion lib/azure/storage/blob/blob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_blob(container, blob, options={})
#
# See http://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
#
# Returns a Blob
# Returns the blob properties
def get_blob_properties(container, blob, options={})
query = { }
StorageService.with_query query, 'snapshot', options[:snapshot]
Expand Down
4 changes: 2 additions & 2 deletions lib/azure/storage/blob/blob_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def initialize(options = {})

def call(method, uri, body=nil, headers={}, options={})
# Force the request.body to the content encoding of specified in the header
if headers && !body.nil? && !(body.encoding.to_s <=> 'ASCII_8BIT')
if headers && !body.nil? && (body.is_a? String) && ((body.encoding.to_s <=> 'ASCII_8BIT') != 0)
if headers['x-ms-blob-content-type'].nil?
Service::StorageService.with_header headers, 'x-ms-blob-content-type', "text/plain; charset=#{body.encoding.to_s}"
else
charset = parse_charset_from_content_type(headers['x-ms-blob-content-type'])
body.force_encoding(charset)
body.force_encoding(charset) if charset
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/azure/storage/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Version
# Fields represent the parts defined in http://semver.org/
MAJOR = 0 unless defined? MAJOR
MINOR = 11 unless defined? MINOR
UPDATE = 3 unless defined? UPDATE
UPDATE = 4 unless defined? UPDATE
PRE = 'preview' unless defined? PRE

class << self
Expand Down
2 changes: 1 addition & 1 deletion test/integration/blob/append_blob_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
it 'sets additional properties when the options hash is used' do
options = {
:content_type=>"application/xml",
:content_encoding=>"utf-8",
:content_encoding=>"gzip",
:content_language=>"en-US",
:cache_control=>"max-age=1296000",
:metadata => { "CustomMetadataProperty"=>"CustomMetadataValue"}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/blob/blob_properties_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
let(:options){{
:content_type=>"application/my-special-format",
:content_encoding=>"utf-16",
:content_encoding=>"gzip",
:content_language=>"klingon",
:cache_control=>"max-age=1296000",
}}
Expand Down
19 changes: 18 additions & 1 deletion test/integration/blob/block_blob_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@
blob = subject.create_block_blob container_name, blob_name, content
blob.name.must_equal blob_name
end

it 'creates a block blob with IO' do
begin
file = File.open blob_name, 'w+'
file.write content
file.seek 0
subject.create_block_blob container_name, blob_name, file
blob = subject.get_blob_properties container_name, blob_name
blob.name.must_equal blob_name
blob.properties[:content_length].must_equal content.length
ensure
unless file.nil?
file.close
File.delete blob_name
end
end
end

it 'should create a block blob with spaces in name' do
blob_name = 'blob with spaces'
Expand All @@ -57,7 +74,7 @@
it 'sets additional properties when the options hash is used' do
options = {
:content_type=>"application/xml",
:content_encoding=>"utf-8",
:content_encoding=>"gzip",
:content_language=>"en-US",
:cache_control=>"max-age=1296000",
:metadata => { "CustomMetadataProperty"=>"CustomMetadataValue"}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/blob/create_page_blob_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
it 'sets additional properties when the options hash is used' do
options = {
:content_type=>"application/xml",
:content_encoding=>"utf-8",
:content_encoding=>"gzip",
:content_language=>"en-US",
:cache_control=>"max-age=1296000",
:metadata => { "CustomMetadataProperty"=>"CustomMetadataValue"}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/core/auth/shared_access_signature_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ip_range: '168.1.5.60-168.1.5.70',
cache_control: 'public',
content_disposition: 'inline, filename=nyan.cat',
content_encoding: 'utf-8',
content_encoding: 'gzip',
content_language: 'English',
content_type: 'binary'
}
Expand All @@ -66,7 +66,7 @@
subject.signable_string_for_service(service_type, path, service_options).must_equal(
"rwd\n#{Time.parse('2020-12-10T00:00:00Z').utc.iso8601}\n#{Time.parse('2020-12-11T00:00:00Z').utc.iso8601}\n" +
"/blob/account-name/example/path\n\n168.1.5.60-168.1.5.70\nhttps,http\n#{Azure::Storage::Default::STG_VERSION}\n" +
"public\ninline, filename=nyan.cat\nutf-8\nEnglish\nbinary"
"public\ninline, filename=nyan.cat\ngzip\nEnglish\nbinary"
)
end

Expand Down Expand Up @@ -95,7 +95,7 @@
query_hash['spr'].must_equal 'https,http'
query_hash['rscc'].must_equal 'public'
query_hash['rscd'].must_equal 'inline, filename=nyan.cat'
query_hash['rsce'].must_equal 'utf-8'
query_hash['rsce'].must_equal 'gzip'
query_hash['rscl'].must_equal 'English'
query_hash['rsct'].must_equal 'binary'
end
Expand Down

0 comments on commit 0ae87ed

Please sign in to comment.