sluice 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c06649f92ec59027bc5d30eb5146ee66b4d2a518
4
- data.tar.gz: c28481f3eecd7a60d23e50b5809a7c11d94ae5c0
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzUwNTNjNWE1ZTIyNjhiMjIyN2FjN2UzMjliMjEyNGNlNWI5N2IzYQ==
5
+ data.tar.gz: !binary |-
6
+ OGFhOGIyOTUwMmJlMzNmZWU1M2YzYWJkZjZiYTkzN2FmYjc5ZGRmMw==
5
7
  SHA512:
6
- metadata.gz: 99ead2169b18814ab2f993ae559ae03210bff3d899e06a29371d6fdcc2131bc21f682f538e9b68f0de20ee80c4f7133ab7da82c98dc63a70e64839beae11e89b
7
- data.tar.gz: 6f640d9e1caff23b2f0a89ecc90453dc2d7bbb5d769af434570e5fd79048c592a853a7adca50bb40ef4fae616fe87a426abf946c490e282e1231f0e78d681c44
8
+ metadata.gz: !binary |-
9
+ MDQxYTFjNjdjZjA1YzZiM2QyMTA2ZDBhMjlmYWIyNjE1OGVmMmViZjA0ZDBj
10
+ OGE1YzAzYWMxMzc1YThlMDM4M2NmN2JiYWZlMzVjMjg1Mzk3N2E3MGY2NGJh
11
+ ZDcxNGUwNzI0NDQ4YzQwYzRjYzJlZTlkZDMxN2NjMzBkMTY0M2M=
12
+ data.tar.gz: !binary |-
13
+ ZGUzNDA5OTE5MzZiNTlhMDgwMWIyMzBkMDYxMWQ1N2MxZGVjZDE3OWM2NWM3
14
+ ZmJiNDQyZDM1OWE5NTkyYjMxNjBmOWYyZWI4YzdlZTYzMzRhZTNhOGQ2YTI4
15
+ ZTA2ODBjMjllNGMwNGRmMDQ5ODRlNDcxN2Y1OWFiMDNhZWYwYWY=
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+
19
+ # Vagrant
20
+ .vagrant
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ Version 0.2.2 (2015-04-08)
2
+ --------------------------
3
+ Stuck Fog dependency to version 1.24 to prevent AWS Regions issue, thanks @epantera! (#33)
4
+ Now tolerates nil passed to trail_slash (#38)
5
+ Added License button to README (#34)
6
+ Added Vagrant quickstart to README (#36)
7
+ Added dedicated Vagrant setup (#35)
8
+
1
9
  Version 0.2.1 (2014-05-20)
2
10
  --------------------------
3
11
  Renamed lambda and alter_filename_lambda in rename_file (#27)
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/snowplow/sluice.png)](https://travis-ci.org/snowplow/sluice)
4
4
  [![Code Climate](https://codeclimate.com/github/snowplow/sluice.png)](https://codeclimate.com/github/snowplow/sluice)
5
5
  [![Coverage Status](https://coveralls.io/repos/snowplow/sluice/badge.png?branch=master)](https://coveralls.io/r/snowplow/sluice?branch=master)
6
+ [![License][license-image]][license]
6
7
 
7
8
  Sluice is a Ruby gem (built with [Bundler] [bundler]) to help you build cloud-friendly ETL (extract, transform, load) processes.
8
9
 
@@ -25,34 +26,34 @@ Sluice has been extracted from a pair of Ruby ETL applications built by the [Sno
25
26
 
26
27
  Or in your Gemfile:
27
28
 
28
- gem 'sluice', '~> 0.2.0'
29
+ gem 'sluice', '~> 0.2.2'
29
30
 
30
31
  ## Usage
31
32
 
32
33
  Rubydoc and usage examples to come.
33
34
 
34
- ## Hacking and contributing
35
+ ## Developer quickstart
35
36
 
36
- To hack on Sluice locally:
37
+ Assuming git, **[Vagrant] [vagrant-install]** and **[VirtualBox] [virtualbox-install]** installed:
37
38
 
38
- $ gem build sluice.gemspec
39
- $ sudo gem install sluice-0.2.0.gem
39
+ ```bash
40
+ host$ git clone https://github.com/snowplow/sluice.git
41
+ host$ cd sluice
42
+ host$ vagrant up && vagrant ssh
43
+ guest$ cd /vagrant
44
+ guest$ gem install bundler
45
+ guest$ rspec
46
+ ```
40
47
 
41
- To contribute:
48
+ ## Publishing
42
49
 
43
- 1. Fork it
44
- 2. Create your feature branch (`git checkout -b my-new-feature`)
45
- 3. Commit your changes (`git commit -am 'Added some feature'`)
46
- 4. Push to the branch (`git push origin my-new-feature`)
47
- 5. Create new Pull Request
48
-
49
- ## Credits and thanks
50
-
51
- Sluice was developed by [Alex Dean] [alexanderdean] ([Snowplow Analytics] [snowplow-analytics]) and [Michael Tibben] [mtibben] ([99designs] [99designs]).
50
+ ```bash
51
+ host$ vagrant push
52
+ ```
52
53
 
53
54
  ## Copyright and license
54
55
 
55
- Sluice is copyright 2012-2014 Snowplow Analytics Ltd.
56
+ Sluice is copyright 2012-2015 Snowplow Analytics Ltd.
56
57
 
57
58
  Licensed under the [Apache License, Version 2.0] [license] (the "License");
58
59
  you may not use this software except in compliance with the License.
@@ -65,6 +66,9 @@ limitations under the License.
65
66
 
66
67
  [bundler]: http://gembundler.com/
67
68
 
69
+ [license-image]: http://img.shields.io/badge/license-Apache--2-blue.svg?style=flat
70
+ [license]: http://www.apache.org/licenses/LICENSE-2.0
71
+
68
72
  [snowplow-analytics]: http://snowplowanalytics.com
69
73
  [alexanderdean]: https://github.com/alexanderdean
70
74
  [mtibben]: https://github.com/mtibben
@@ -73,4 +77,7 @@ limitations under the License.
73
77
  [emr-etl-runner]: https://github.com/snowplow/snowplow/tree/master/3-enrich/emr-etl-runner
74
78
  [storage-loader]: https://github.com/snowplow/snowplow/tree/master/4-storage/storage-loader
75
79
 
80
+ [vagrant-install]: http://docs.vagrantup.com/v2/installation/index.html
81
+ [virtualbox-install]: https://www.virtualbox.org/wiki/Downloads
82
+
76
83
  [license]: http://www.apache.org/licenses/LICENSE-2.0
data/Vagrantfile ADDED
@@ -0,0 +1,23 @@
1
+ Vagrant.configure("2") do |config|
2
+
3
+ config.vm.box = "ubuntu/trusty64"
4
+ config.vm.hostname = "sluice"
5
+ config.ssh.forward_agent = true
6
+
7
+ config.vm.provider :virtualbox do |vb|
8
+ vb.name = Dir.pwd().split("/")[-1] + "-" + Time.now.to_f.to_i.to_s
9
+ vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
10
+ vb.customize [ "guestproperty", "set", :id, "--timesync-threshold", 10000 ]
11
+ vb.memory = 2048
12
+ end
13
+
14
+ config.vm.provision :shell do |sh|
15
+ sh.path = "vagrant/up.bash"
16
+ end
17
+
18
+ # Requires Vagrant 1.7.0+
19
+ config.push.define "gem", strategy: "local-exec" do |push|
20
+ push.script = "vagrant/push.bash"
21
+ end
22
+
23
+ end
@@ -38,13 +38,15 @@ module Sluice
38
38
  end
39
39
  module_function :files_between
40
40
 
41
- # Add a trailing slash to a path if missing
41
+ # Add a trailing slash to a path if missing.
42
+ # Tolerates a nil path.
42
43
  #
43
44
  # Parameters:
44
45
  # +path+:: path to add a trailing slash to
45
46
  def trail_slash(path)
46
-
47
- path[-1].chr != '/' ? path << '/' : path
47
+ unless path.nil?
48
+ path[-1].chr != '/' ? path << '/' : path
49
+ end
48
50
  end
49
51
  module_function :trail_slash
50
52
 
@@ -15,5 +15,5 @@
15
15
 
16
16
  module Sluice
17
17
  NAME = "sluice"
18
- VERSION = "0.2.1"
18
+ VERSION = "0.2.2"
19
19
  end
data/sluice.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |gem|
36
36
 
37
37
  # Dependencies
38
38
  gem.add_dependency 'contracts', '~> 0.4'
39
- gem.add_dependency 'fog', '~> 1.22'
39
+ gem.add_dependency 'fog', '1.24'
40
40
 
41
41
  gem.add_development_dependency "rspec", "~> 2.14", ">= 2.14.1"
42
42
  gem.add_development_dependency "rspec-nc"
@@ -0,0 +1,3 @@
1
+ oss-playbooks
2
+ ansible
3
+ .peru
@@ -0,0 +1,2 @@
1
+ [vagrant]
2
+ 127.0.0.1:2222
data/vagrant/peru.yaml ADDED
@@ -0,0 +1,14 @@
1
+ imports:
2
+ ansible: ansible
3
+ ansible_playbooks: oss-playbooks
4
+
5
+ curl module ansible:
6
+ # Equivalent of git cloning tags/v1.6.6 but much, much faster
7
+ url: https://codeload.github.com/ansible/ansible/zip/69d85c22c7475ccf8169b6ec9dee3ee28c92a314
8
+ unpack: zip
9
+ export: ansible-69d85c22c7475ccf8169b6ec9dee3ee28c92a314
10
+
11
+ git module ansible_playbooks:
12
+ url: https://github.com/snowplow/ansible-playbooks.git
13
+ # Comment out to fetch a specific rev instead of master:
14
+ # rev: xxx
data/vagrant/push.bash ADDED
@@ -0,0 +1,79 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Constants
5
+ rubygems_user=snowplow
6
+ rubygems_gem=sluice
7
+
8
+ # Check if our Vagrant box is running. Expects `vagrant status` to look like:
9
+ #
10
+ # > Current machine states:
11
+ # >
12
+ # > default poweroff (virtualbox)
13
+ # >
14
+ # > The VM is powered off. To restart the VM, simply run `vagrant up`
15
+ function running {
16
+ set +e
17
+ vagrant status | sed -n 3p | grep -q "^default\s*running (virtualbox)$"
18
+ local is_running=$?
19
+ set -e
20
+ echo $is_running
21
+ }
22
+
23
+ # Reads the version out of the version.rb
24
+ function parse_version {
25
+ cat "lib/${rubygems_gem}/version.rb" | awk '/ VERSION =/ {v=$3; gsub(/\047/, "", v)} END {print v}'
26
+ }
27
+
28
+ # Installs RubyGems.org credentials in our guest
29
+ #
30
+ # Parameters:
31
+ # 1. rubygems_password
32
+ function install_creds {
33
+ vagrant ssh -c "curl -u ${rubygems_user}:${1} https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials"
34
+ vagrant ssh -c "chmod 0600 ~/.gem/credentials"
35
+ }
36
+
37
+ # Builds our gem
38
+ function build_gem {
39
+ vagrant ssh -c "cd /vagrant && gem build ${rubygems_gem}.gemspec"
40
+ }
41
+
42
+ # Installs our gem
43
+ #
44
+ # Parameters:
45
+ # 1. rubygems_version
46
+ function install_gem {
47
+ vagrant ssh -c "cd /vagrant && sudo gem install ./${rubygems_gem}-${1}.gem"
48
+ }
49
+
50
+ # Pushes our gem to RubyGems.org
51
+ #
52
+ # Parameters:
53
+ # 1. rubygems_version
54
+ function push_gem {
55
+ vagrant ssh -c "cd /vagrant && gem push ./${rubygems_gem}-${1}.gem"
56
+ }
57
+
58
+
59
+ # Move to the parent directory of this script
60
+ source="${BASH_SOURCE[0]}"
61
+ while [ -h "${source}" ] ; do source="$(readlink "${source}")"; done
62
+ dir="$( cd -P "$( dirname "${source}" )/.." && pwd )"
63
+ cd ${dir}
64
+
65
+ # Precondition for running
66
+ if [ $(running) != "0" ]; then
67
+ echo "Vagrant guest must be running to push"
68
+ exit 1
69
+ fi
70
+
71
+ # Can't pass args thru vagrant push so have to prompt
72
+ read -e -p "Please enter password for RubyGems.org user ${rubygems_user}: " rubygems_password
73
+
74
+ # Build, install & push
75
+ build_gem
76
+ rubygems_version=$(parse_version)
77
+ install_gem ${rubygems_version}
78
+ install_creds ${rubygems_password}
79
+ push_gem ${rubygems_version}
data/vagrant/up.bash ADDED
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ vagrant_dir=/vagrant/vagrant
5
+ bashrc=/home/vagrant/.bashrc
6
+
7
+ echo "========================================"
8
+ echo "INSTALLING PERU AND ANSIBLE DEPENDENCIES"
9
+ echo "----------------------------------------"
10
+ apt-get update
11
+ apt-get install -y language-pack-en git unzip libyaml-dev python3-pip python-yaml python-paramiko python-jinja2
12
+
13
+ echo "==============="
14
+ echo "INSTALLING PERU"
15
+ echo "---------------"
16
+ sudo pip3 install peru
17
+
18
+ echo "======================================="
19
+ echo "CLONING ANSIBLE AND PLAYBOOKS WITH PERU"
20
+ echo "---------------------------------------"
21
+ cd ${vagrant_dir} && peru sync -v
22
+ echo "... done"
23
+
24
+ env_setup=${vagrant_dir}/ansible/hacking/env-setup
25
+ hosts=${vagrant_dir}/ansible.hosts
26
+
27
+ echo "==================="
28
+ echo "CONFIGURING ANSIBLE"
29
+ echo "-------------------"
30
+ touch ${bashrc}
31
+ echo "source ${env_setup}" >> ${bashrc}
32
+ echo "export ANSIBLE_HOSTS=${hosts}" >> ${bashrc}
33
+ echo "... done"
34
+
35
+ echo "=========================================="
36
+ echo "RUNNING PLAYBOOKS WITH ANSIBLE*"
37
+ echo "* no output while each playbook is running"
38
+ echo "------------------------------------------"
39
+ while read pb; do
40
+ su - -c "source ${env_setup} && ${vagrant_dir}/ansible/bin/ansible-playbook ${vagrant_dir}/${pb} --connection=local --inventory-file=${hosts}" vagrant
41
+ done <${vagrant_dir}/up.playbooks
42
+
43
+ guidance=${vagrant_dir}/up.guidance
44
+
45
+ if [ -f ${guidance} ]; then
46
+ echo "==========="
47
+ echo "PLEASE READ"
48
+ echo "-----------"
49
+ cat $guidance
50
+ fi
@@ -0,0 +1,5 @@
1
+ To get started:
2
+ vagrant ssh
3
+ cd /vagrant
4
+ bundle install
5
+ rspec
@@ -0,0 +1 @@
1
+ oss-playbooks/ruby-rvm.yml
metadata CHANGED
@@ -1,121 +1,122 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sluice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dean
8
8
  - Michael Tibben
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-20 00:00:00.000000000 Z
12
+ date: 2015-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: contracts
16
- version_requirements: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: '0.4'
21
16
  requirement: !ruby/object:Gem::Requirement
22
17
  requirements:
23
18
  - - ~>
24
19
  - !ruby/object:Gem::Version
25
20
  version: '0.4'
26
- prerelease: false
27
21
  type: :runtime
28
- - !ruby/object:Gem::Dependency
29
- name: fog
22
+ prerelease: false
30
23
  version_requirements: !ruby/object:Gem::Requirement
31
24
  requirements:
32
25
  - - ~>
33
26
  - !ruby/object:Gem::Version
34
- version: '1.22'
27
+ version: '0.4'
28
+ - !ruby/object:Gem::Dependency
29
+ name: fog
35
30
  requirement: !ruby/object:Gem::Requirement
36
31
  requirements:
37
- - - ~>
32
+ - - '='
38
33
  - !ruby/object:Gem::Version
39
- version: '1.22'
40
- prerelease: false
34
+ version: '1.24'
41
35
  type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: '1.24'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
- version_requirements: !ruby/object:Gem::Requirement
44
+ requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.14'
49
- - - '>='
49
+ - - ! '>='
50
50
  - !ruby/object:Gem::Version
51
51
  version: 2.14.1
52
- requirement: !ruby/object:Gem::Requirement
52
+ type: :development
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
53
55
  requirements:
54
56
  - - ~>
55
57
  - !ruby/object:Gem::Version
56
58
  version: '2.14'
57
- - - '>='
59
+ - - ! '>='
58
60
  - !ruby/object:Gem::Version
59
61
  version: 2.14.1
60
- prerelease: false
61
- type: :development
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec-nc
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
64
  requirement: !ruby/object:Gem::Requirement
70
65
  requirements:
71
- - - '>='
66
+ - - ! '>='
72
67
  - !ruby/object:Gem::Version
73
68
  version: '0'
74
- prerelease: false
75
69
  type: :development
76
- - !ruby/object:Gem::Dependency
77
- name: guard
70
+ prerelease: false
78
71
  version_requirements: !ruby/object:Gem::Requirement
79
72
  requirements:
80
- - - '>='
73
+ - - ! '>='
81
74
  - !ruby/object:Gem::Version
82
75
  version: '0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: guard
83
78
  requirement: !ruby/object:Gem::Requirement
84
79
  requirements:
85
- - - '>='
80
+ - - ! '>='
86
81
  - !ruby/object:Gem::Version
87
82
  version: '0'
88
- prerelease: false
89
83
  type: :development
90
- - !ruby/object:Gem::Dependency
91
- name: guard-rspec
84
+ prerelease: false
92
85
  version_requirements: !ruby/object:Gem::Requirement
93
86
  requirements:
94
- - - '>='
87
+ - - ! '>='
95
88
  - !ruby/object:Gem::Version
96
89
  version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: guard-rspec
97
92
  requirement: !ruby/object:Gem::Requirement
98
93
  requirements:
99
- - - '>='
94
+ - - ! '>='
100
95
  - !ruby/object:Gem::Version
101
96
  version: '0'
102
- prerelease: false
103
97
  type: :development
104
- - !ruby/object:Gem::Dependency
105
- name: coveralls
98
+ prerelease: false
106
99
  version_requirements: !ruby/object:Gem::Requirement
107
100
  requirements:
108
- - - '>='
101
+ - - ! '>='
109
102
  - !ruby/object:Gem::Version
110
103
  version: '0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: coveralls
111
106
  requirement: !ruby/object:Gem::Requirement
112
107
  requirements:
113
- - - '>='
108
+ - - ! '>='
114
109
  - !ruby/object:Gem::Version
115
110
  version: '0'
116
- prerelease: false
117
111
  type: :development
118
- description: A Ruby gem to help you build ETL processes involving Amazon S3. Uses Fog
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ description: A Ruby gem to help you build ETL processes involving Amazon S3. Uses
119
+ Fog
119
120
  email:
120
121
  - support@snowplowanalytics.com
121
122
  executables: []
@@ -130,6 +131,7 @@ files:
130
131
  - Guardfile
131
132
  - LICENSE-2.0.txt
132
133
  - README.md
134
+ - Vagrantfile
133
135
  - lib/sluice.rb
134
136
  - lib/sluice/errors.rb
135
137
  - lib/sluice/storage/s3/contracts.rb
@@ -142,28 +144,35 @@ files:
142
144
  - spec/spec_helper.rb
143
145
  - spec/storage/s3/location_spec.rb
144
146
  - spec/storage/s3/s3_spec.rb
147
+ - vagrant/.gitignore
148
+ - vagrant/ansible.hosts
149
+ - vagrant/peru.yaml
150
+ - vagrant/push.bash
151
+ - vagrant/up.bash
152
+ - vagrant/up.guidance
153
+ - vagrant/up.playbooks
145
154
  homepage: http://snowplowanalytics.com
146
155
  licenses:
147
156
  - Apache-2.0
148
157
  metadata: {}
149
- post_install_message:
158
+ post_install_message:
150
159
  rdoc_options: []
151
160
  require_paths:
152
161
  - lib
153
162
  required_ruby_version: !ruby/object:Gem::Requirement
154
163
  requirements:
155
- - - '>='
164
+ - - ! '>='
156
165
  - !ruby/object:Gem::Version
157
166
  version: '0'
158
167
  required_rubygems_version: !ruby/object:Gem::Requirement
159
168
  requirements:
160
- - - '>='
169
+ - - ! '>='
161
170
  - !ruby/object:Gem::Version
162
171
  version: '0'
163
172
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.2.2
166
- signing_key:
173
+ rubyforge_project:
174
+ rubygems_version: 2.4.6
175
+ signing_key:
167
176
  specification_version: 4
168
177
  summary: Ruby toolkit for cloud-friendly ETL
169
178
  test_files: