clientside_aws 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0849125e1155b6cce69acffe5f673ccbe82d06ae
4
- data.tar.gz: 5d4a21502b07598ac8501ad7bf871e4453bcce3d
3
+ metadata.gz: 212e6dd842f718ed8cd4e1601348f2705dfbae0b
4
+ data.tar.gz: cd0fcf3aad613d98713d0e974dd3d999ddb4a72c
5
5
  SHA512:
6
- metadata.gz: 3fc189751988578833582ff590ea92b1f5bae861f3bd948604de1718f226908b0a50b25498c44ddfb6856e66627b90b58b0fa594ad220e613b47d7ec90caabba
7
- data.tar.gz: db12a96665260f6c2a96d30c68962a064ae01acb4becbfdaee0edab873da715237b879a9821622481984ebfb1ed046970804ddb5397231f777d8576a8e86949e
6
+ metadata.gz: 8f8380aab2765db7790d046d34a09dd1d76167779d2af57f2602256950671c4e039ede96724787c34259ed30bee8340183129c4632316f163033c7445ab8eaee
7
+ data.tar.gz: a3ea6a6eecbfdc8e94ac6f8e1e2181d9b2442f4802becab0f613f635cfa855f2f619a162759175dc0e4004c38e6b74fa0d6d8cd71e1d26b9baef29de37e9a415
data/Gemfile CHANGED
@@ -19,5 +19,4 @@ gem 'redis', '3.2.0'
19
19
  gem 'rspec', '2.14.1'
20
20
  gem 'sinatra', '1.4.8'
21
21
  gem 'sinatra-reloader', '0.5.0'
22
- gem 'uuid', '2.3.1'
23
22
  gem 'webmock', '3.1.0'
data/README.md CHANGED
@@ -1,6 +1,24 @@
1
1
  clientside_aws
2
2
  ===================
3
3
 
4
+ Run selected AWS services via a docker container locally, for more effective development and testing.
5
+
6
+ ## Install
7
+
8
+ In your gemfile:
9
+
10
+ gem 'clientside_aws', require: 'clientside_aws'
11
+
12
+ ## Features
13
+
14
+ - Write code on a plane: Interact with AWS services like S3, SQS and DynamoDb, without internet access
15
+ - No more tedious configuration of mocked responses in your unit tests
16
+ - Save time and money by avoiding the need for a 'test' account in AWS where you upload S3 files and interact with DynamoDb databases along with other developers on your team
17
+ - Instantly restore your development and test environments to known good states
18
+
19
+ Think about how
20
+
21
+
4
22
  This code is meant to be used by developers who are attempting to build web applications on AWS but wish to run client-side testing and validation. Presently, this project mocks DynamoDB and SQS.
5
23
 
6
24
  While creating and tearing down "free-tier" SQS and DynamoDB databases may be an acceptable solution for some, the time required (tens of seconds or minutes) quickly makes TDD (test-driven development) impractical. Just like we can use an in-memory sqlite3-based solution for mocking Mysql databases with ActiveRecord, we can now mock SQS and DynamoDB databases in memory using Redis.
@@ -1,5 +1,3 @@
1
- require 'uuid'
2
-
3
1
  module AWS
4
2
  # Mock SES and enable retrieval of last message sent
5
3
  # We also save messages to message_directory, if set
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'rake', '10.1.0'
22
22
  spec.add_development_dependency 'rack-test', '0.5.7'
23
- spec.add_development_dependency 'rspec', '2.14.1'
24
23
  spec.add_development_dependency 'bundler', '~> 1.3'
25
24
  spec.add_dependency 'aws-sdk-v1', '1.66.0'
26
25
  spec.add_dependency 'aws-sdk', '~> 2.0'
@@ -28,4 +27,5 @@ Gem::Specification.new do |spec|
28
27
  spec.add_dependency 'httparty', '~> 0.15'
29
28
  spec.add_dependency 'json', '~> 1.8'
30
29
  spec.add_dependency 'webmock', '~> 3.1'
30
+ spec.add_dependency 'rspec', '~> 2.14'
31
31
  end
@@ -0,0 +1,24 @@
1
+ FROM phusion/baseimage:0.9.22
2
+ ENV HOME /root
3
+
4
+ # Use baseimage-docker's init system.
5
+ CMD ["/sbin/my_init"]
6
+
7
+ # Install ruby
8
+ RUN apt-add-repository ppa:brightbox/ruby-ng -y
9
+ RUN apt-get update && apt-get install -y ruby2.4 ruby2.4-dev git-core build-essential zlib1g-dev
10
+ RUN apt-get install -y wget curl
11
+
12
+ # Install app code
13
+ RUN gem install bundler
14
+ RUN cd /opt
15
+ COPY app/ /opt/app/
16
+ RUN cd /opt/app ; bundle install
17
+
18
+ # Use runit to start the app
19
+ RUN mkdir /etc/service/app
20
+ ADD app-run /etc/service/app/run
21
+ RUN chmod 755 /etc/service/app/run
22
+
23
+ EXPOSE 4567
24
+ WORKDIR /opt/app
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'aws-sdk', '2.10.26'
4
+ gem 'sinatra', '1.4.8'
5
+ gem 'webmock', '3.1.0'
6
+ gem 'clientside_aws'
@@ -0,0 +1,32 @@
1
+ require 'rubygems'
2
+ require 'clientside_aws'
3
+ require 'sinatra'
4
+
5
+ config = { region: 'us-mockregion-1',
6
+ access_key_id: '...',
7
+ secret_access_key: '...' }
8
+
9
+ Aws.config.update(config)
10
+ AWS.config(config)
11
+
12
+ get '/' do
13
+ erb :index
14
+ end
15
+
16
+ post '/image' do
17
+ s3 = Aws::S3::Client.new
18
+ s3.create_bucket(bucket: 'test')
19
+
20
+ bucket = Aws::S3::Resource.new.bucket('test')
21
+
22
+ # Now, store a JSON document
23
+ object = bucket.object('image')
24
+ object.put(body: params['data'], content_type: 'image/jpeg')
25
+ end
26
+
27
+ get '/image' do
28
+ object = bucket.object('image')
29
+
30
+ content_type 'image/jpeg'
31
+ object.get.body.read
32
+ end
@@ -0,0 +1,19 @@
1
+ <html>
2
+ <head>
3
+ <title>Clientside AWS Test</title>
4
+ </head>
5
+ <body>
6
+ <p>
7
+ Upload an image
8
+ </p>
9
+ <p>
10
+ <form method='post' action='/image' enctype='multipart/form-data'>
11
+ File: <input type="file" name="image" id="image"/>
12
+ <input type="submit" value="Upload Image" name="submit"/>
13
+ </form>
14
+ </p>
15
+ <hr>
16
+ <p>Here is the image:</p>
17
+ <image src='/image' />
18
+ </body>
19
+ </html>
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ exec /usr/bin/ruby /opt/app/index.rb -o 0.0.0.0
@@ -0,0 +1,22 @@
1
+ version: '2'
2
+ services:
3
+ app:
4
+ image: clientside_aws_test_app
5
+ container_name: clientside_aws_test_app
6
+ links:
7
+ - aws
8
+ build:
9
+ context: ./
10
+ dockerfile: ./Dockerfile
11
+ command:
12
+ /sbin/my_init
13
+ aws:
14
+ image: clientside_aws:latest
15
+ container_name: clientside_aws_test_aws
16
+ build:
17
+ context: ../../
18
+ dockerfile: ./Dockerfile
19
+ command: /sbin/my_init
20
+ ports:
21
+ - '4567'
22
+
File without changes
data/index.rb CHANGED
@@ -7,7 +7,6 @@ require 'redis'
7
7
  require 'bigdecimal'
8
8
  require 'builder'
9
9
  require 'digest'
10
- require 'uuid'
11
10
  require 'base64'
12
11
  require 'rack'
13
12
  require 'rack/cors'
@@ -1,3 +1,3 @@
1
1
  module ClientsideAws
2
- VERSION = '0.0.22'.freeze
2
+ VERSION = '0.0.23'.freeze
3
3
  end
@@ -4,6 +4,8 @@
4
4
  # docker container
5
5
 
6
6
  require File.dirname(__FILE__) + '/clientside_aws/configuration'
7
+ require 'aws-sdk-v1'
8
+ require 'aws-sdk'
7
9
 
8
10
  module ClientsideAws
9
11
  require File.dirname(__FILE__) + '/clientside_aws/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clientside_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perry Street Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.7
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 2.14.1
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 2.14.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: bundler
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +136,20 @@ dependencies:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
138
  version: '3.1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.14'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.14'
153
153
  description: This code is meant to be used by developers who are attempting to build
154
154
  web applications on AWS but wish to run client-side testing and validation.
155
155
  email:
@@ -187,6 +187,13 @@ files:
187
187
  - clientside_aws/sqs.rb
188
188
  - docker/clientside-aws-run
189
189
  - docker/redis-server-run
190
+ - examples/dockerized/Dockerfile
191
+ - examples/dockerized/app-run
192
+ - examples/dockerized/app/Gemfile
193
+ - examples/dockerized/app/index.rb
194
+ - examples/dockerized/app/views/index.erb
195
+ - examples/dockerized/docker-compose.yml
196
+ - examples/local/test.rb
190
197
  - index.rb
191
198
  - lib/clientside_aws.rb
192
199
  - lib/clientside_aws/configuration.rb
@@ -203,7 +210,6 @@ files:
203
210
  - spec/sns_spec.rb
204
211
  - spec/spec_helper.rb
205
212
  - spec/sqs_spec.rb
206
- - spec/test_client/test.rb
207
213
  - spec/transcoder_spec.rb
208
214
  homepage: https://github.com/perrystreetsoftware/clientside_aws
209
215
  licenses:
@@ -238,5 +244,4 @@ test_files:
238
244
  - spec/sns_spec.rb
239
245
  - spec/spec_helper.rb
240
246
  - spec/sqs_spec.rb
241
- - spec/test_client/test.rb
242
247
  - spec/transcoder_spec.rb