aws_memfix 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: af1017ab3cb11c1d8d3ee225e65ef7bf6aa4609e
4
+ data.tar.gz: 32874459d260bc9ede3873271ae8ced99376ec7b
5
+ SHA512:
6
+ metadata.gz: 0e5a8639f1773d67c54a286145a19d186eb573201a14ab164ee736f274e56f0436a70868f1ce3307c52ac8408e7d511802a2f75b1808aaa7ee69895c109729fd
7
+ data.tar.gz: cc50448df51875754339d61fb9bedd39ecb5713fd9e133f8399ece7b4ee74a9a1317c7a7904cd55322d89942dfaf6afe5bd85c00cfeaac483ae2e0edf9b6c47d
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.2.1
5
+ - 2.2.2
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aws_memfix.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ # AwsMemfix
2
+
3
+ Fixes Ruby 2.2 StringIO memory leaks for AWS Seahorse client.
4
+ [Issue 785](https://github.com/aws/aws-sdk-ruby/issues/785)
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "aws_memfix"
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+
19
+ ## Testing
20
+
21
+ Install Elastic MQ: https://github.com/adamw/elasticmq
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task default: "test"
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << "test"
8
+ t.pattern = "test/**/test_*.rb"
9
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aws_memfix/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aws_memfix"
8
+ spec.version = AwsMemfix::VERSION
9
+ spec.authors = ["Milovan Zogovic"]
10
+ spec.email = ["milovan.zogovic@gmail.com"]
11
+
12
+ spec.summary = %q{Fixes ruby 2.2.x StringIO memory leaks for AWS Seahorse client}
13
+ spec.homepage = "https://github.com/assembler/aws-sdk-ruby-memory-fix"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "bin"
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = [">= 2.2.0", ">= 2.2.2"]
22
+
23
+ spec.add_dependency "aws-sdk", "~> 2.0"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.8"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aws_memfix"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require "aws_memfix/version"
2
+ require "seahorse/stringio"
3
+
4
+ module AwsMemfix
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module AwsMemfix
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,53 @@
1
+ module Seahorse
2
+ class StringIO
3
+ def initialize(data = '')
4
+ @data = data
5
+ @offset = 0
6
+ end
7
+
8
+ def write(data)
9
+ @data << data
10
+ data.bytesize
11
+ end
12
+
13
+ def read(bytes = nil, output_buffer = nil)
14
+ if bytes
15
+ data = partial_read(bytes)
16
+ else
17
+ data = full_read
18
+ end
19
+ output_buffer ? output_buffer.replace(data || '') : data
20
+ end
21
+
22
+ def rewind
23
+ @offset = 0
24
+ end
25
+
26
+ def truncate(bytes)
27
+ @data = @data[0,bytes]
28
+ bytes
29
+ end
30
+
31
+ private
32
+
33
+ def partial_read(bytes)
34
+ if @offset >= @data.bytesize
35
+ nil
36
+ else
37
+ data = @data[@offset,@offset+bytes]
38
+ bump_offset(bytes)
39
+ data
40
+ end
41
+ end
42
+
43
+ def full_read
44
+ data = @offset == 0 ? @data : @data[@offset,-1]
45
+ @offset = @data.bytesize
46
+ data
47
+ end
48
+
49
+ def bump_offset(bytes)
50
+ @offset = [@data.bytesize, @offset + bytes].min
51
+ end
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws_memfix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Milovan Zogovic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - milovan.zogovic@gmail.com
58
+ executables:
59
+ - console
60
+ - setup
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - ".travis.yml"
66
+ - CODE_OF_CONDUCT.md
67
+ - Gemfile
68
+ - README.md
69
+ - Rakefile
70
+ - aws_memfix.gemspec
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/aws_memfix.rb
74
+ - lib/aws_memfix/version.rb
75
+ - lib/seahorse/stringio.rb
76
+ homepage: https://github.com/assembler/aws-sdk-ruby-memory-fix
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 2.2.0
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 2.2.2
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.4.5
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Fixes ruby 2.2.x StringIO memory leaks for AWS Seahorse client
103
+ test_files: []