gridium 1.0.0 → 1.0.1

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: 0760717c783e365d6af7f505001cc465de38fb54
4
- data.tar.gz: 4f49bca1f7cfba116f17912dd9e59e79156a7f09
3
+ metadata.gz: 6dc29df3a04ae8f95ff1c46bcfa7a89c674d8093
4
+ data.tar.gz: 9f6ebb099df861db7955dff000b64d4e150ee975
5
5
  SHA512:
6
- metadata.gz: 72f5b466294567a7028d0623c395f6fccfcfb70c5346910d39e1a7a782733d71ba84e73a0733176050420b5bdeb3aa887dd076afdefe3be36a0a25b5aee98c8c
7
- data.tar.gz: 71712e430341993dab8522938572af4b804f21a8d04c08b9b63f83d68feefba9e22d11faf87e9a790eb46c77574a2919fd6684b07c21680de76d56cabb072a9a
6
+ metadata.gz: a7d619fc44d6ad485bd3f3eba756004128e7cc294ed96432e14099d72a6751758f5a468326c76a7a13fabddba2be8f71237a5488b8071d9558ec07b8d8f7325b
7
+ data.tar.gz: 58b0c9a013a9e2edfc59a6e3f8323acfc8da377c01edad71853d33f2784d97e90c69eb70aa07e64c54d2988c2d00afb57ce96619172c8d11dd7e0f82d6279b86
data/.gitignore CHANGED
@@ -22,9 +22,10 @@ Dockerfile-e
22
22
  /test/tmp/
23
23
  /test/version_tmp/
24
24
  /tmp/
25
+ /test_results
25
26
 
26
27
  # Used by dotenv library to load environment variables.
27
- # .env
28
+ .env
28
29
 
29
30
  ## Specific to RubyMotion:
30
31
  .dat*
data/.jenkins-docker ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env sh
2
+ set -eux
3
+ #set -o pipefail
4
+
5
+ _init_env() {
6
+ # leading colon force successful return code
7
+ : ${PUBLISH:=0} # If unset, default to 0
8
+ : ${REGISTRY:=docker.sendgrid.net}
9
+ : ${NAMESPACE:=${USER}}
10
+ : ${APPNAME=gridium}
11
+ : ${COMPOSE_PROJECT_NAME:=$APPNAME}
12
+
13
+ # If we're "jenkins" and on the "origin/master" branch, push to 'docker.sendgrid.net/sendgrid'
14
+ [[ "${USER}" == "jenkins" ]] && [[ "${GIT_BRANCH}" == "origin/master" ]] && NAMESPACE=sendgrid
15
+
16
+ export PUBLISH
17
+ export REGISTRY
18
+ export NAMESPACE
19
+ export APPNAME
20
+ export COMPOSE_PROJECT_NAME
21
+
22
+ }
23
+
24
+ run_test(){
25
+ docker exec $(docker-compose ps -q gridium) rake spec
26
+ }
27
+
28
+ main() {
29
+ echo "**** Arguments: $@"
30
+
31
+ # Cleanup regardless
32
+ trap bin/cleanup EXIT
33
+
34
+ _init_env
35
+
36
+ if [[ "${SKIPDOCKERPULL:=0}" -eq 1 ]]; then
37
+ echo "Skipping docker pull"
38
+ else
39
+ bin/pull
40
+ fi
41
+
42
+ bin/start -i
43
+ sleep 2
44
+
45
+ run_test
46
+ }
47
+
48
+
49
+ main
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
1
  FROM ruby:2.3
2
2
 
3
- WORKDIR /
3
+ WORKDIR /gridium
4
4
 
5
- COPY . /
5
+ COPY . /gridium
6
6
 
7
7
  CMD gem install bundle;
8
8
  RUN bundle;
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gemspec
6
6
  gem 'rspec-mocks'
7
7
  gem 'rspec'
8
8
  gem 'rake'
9
+ gem 'dotenv'
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec) do |t|
5
- t.pattern = 'spec/testrail_spec.rb'
5
+ t.pattern = 'spec/*_spec.rb'
6
6
  end
7
7
 
8
8
  task :default => :spec
data/bin/cleanup ADDED
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ main() {
4
+ docker-compose kill
5
+
6
+ docker-compose rm -fv
7
+
8
+ docker rmi $(docker images -f "dangling=true" -q)
9
+
10
+ docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
11
+
12
+ }
13
+
14
+ main
data/bin/pull ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ main() {
4
+ docker-compose pull
5
+ }
6
+
7
+ main
data/bin/start ADDED
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+
3
+ main(){
4
+ case $1 in
5
+ -i) #start normally
6
+ docker-compose up -d
7
+ ;;
8
+ -d) #start in development mode
9
+ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
10
+ ;;
11
+ *)
12
+ echo "Usage: $0 [-i] isolated [-d] gridium dev" 1>&2; exit 1;
13
+ ;;
14
+ esac
15
+ }
16
+
17
+ main $1
@@ -0,0 +1,5 @@
1
+ version: '2'
2
+ services:
3
+ gridium:
4
+ volumes:
5
+ - $GRIDIUMPATH:/gridium
data/lib/element.rb CHANGED
@@ -366,7 +366,7 @@ class Element
366
366
 
367
367
  def field_empty_afterward?(*args)
368
368
  Log.debug("Checking the field after sending #{args}, to see if it's empty")
369
- check_again = (not args.empty? and no_symbols? *args)
369
+ check_again = (has_characters? *args and no_symbols? *args)
370
370
  field_is_empty_but_should_not_be = (check_again and field_empty?)
371
371
  if field_is_empty_but_should_not_be
372
372
  raise "Browser Error: tried to input #{args} but found an empty string afterward: #{value}"
@@ -403,4 +403,17 @@ class Element
403
403
  false
404
404
  end
405
405
 
406
+ #
407
+ # helper to check if *args is not empty but contains only empty string(s)/symbol(s)
408
+ # if so, don't bother trying to validate the text afterward
409
+ #
410
+
411
+ def has_characters?(*args)
412
+ characters = args.select { |_| not _.is_a? Symbol }.join('')
413
+ if characters.empty?
414
+ return false
415
+ end
416
+ true
417
+ end
418
+
406
419
  end
@@ -1,3 +1,3 @@
1
1
  module Gridium
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/s3.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  require 'aws-sdk'
2
2
  module Gridium
3
3
 
4
-
5
4
  class GridiumS3
6
5
 
7
6
  DELIMITER = "/"
8
7
 
9
8
  def initialize(project_name, subdirectory_name='screenshots')
10
9
  Log.debug("initializing GridiumS3 with #{project_name} and #{subdirectory_name}")
11
- Aws.config.update({ credentials: Aws::Credentials.new(ENV['S3_ACCESS_KEY_ID'], ENV['S3_SECRET_ACCESS_KEY']) ,region: ENV['S3_DEFAULT_REGION']})
10
+ Aws.config.update({ credentials: Aws::Credentials.new(ENV['S3_ACCESS_KEY_ID'], ENV['S3_SECRET_ACCESS_KEY']) , region: ENV['S3_DEFAULT_REGION']})
12
11
  _validate_string(project_name)
13
12
  _validate_string(subdirectory_name)
14
13
  @project_name = _sanitize_string(project_name)
@@ -37,12 +36,12 @@ module Gridium
37
36
 
38
37
  def _sanitize_string(input_string)
39
38
  #remove left/right whitespace, split and join to collapse contiguous white space, replace whitespace and non-period special chars with underscore
40
- input_string = input_string.strip().split.join(" ").gsub(/[^\w.]/i, '_')
39
+ input_string = input_string.strip().split.join(" ").gsub(/[^\w.]/i, '_')
41
40
  input_string
42
41
  end
43
42
 
44
43
  def _validate_string(input_string)
45
- Log.debug("attempting to validate #{input_string} for use as a name")
44
+ Log.debug("attempting to validate #{input_string} for use as a name")
46
45
  if input_string.empty? or input_string.strip().empty? then
47
46
  raise(ArgumentError, "empty and/or whitespace file names are not wanted here.")
48
47
  end
@@ -59,7 +58,7 @@ module Gridium
59
58
  upload_size = @bucket.object(s3_name).content_length
60
59
  local_size = File.size local_absolute_path
61
60
  Log.debug("file upload verified: #{upload_size == local_size}. upload size is #{upload_size} and local size is #{local_size}")
62
- upload_size == local_size
61
+ upload_size == local_size
63
62
  end
64
63
  end
65
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Urban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -139,6 +139,7 @@ extensions: []
139
139
  extra_rdoc_files: []
140
140
  files:
141
141
  - ".gitignore"
142
+ - ".jenkins-docker"
142
143
  - ".rspec"
143
144
  - CODE_OF_CONDUCT.md
144
145
  - Dockerfile
@@ -146,10 +147,10 @@ files:
146
147
  - LICENSE
147
148
  - README.md
148
149
  - Rakefile
149
- - bin/console
150
- - bin/docker/cleanup.sh
151
- - bin/docker/start.sh
152
- - bin/setup
150
+ - bin/cleanup
151
+ - bin/pull
152
+ - bin/start
153
+ - docker-compose.dev.yml
153
154
  - docker-compose.yml
154
155
  - gridium.gemspec
155
156
  - lib/driver.rb
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  version: '0'
186
187
  requirements: []
187
188
  rubyforge_project:
188
- rubygems_version: 2.5.1
189
+ rubygems_version: 2.6.10
189
190
  signing_key:
190
191
  specification_version: 4
191
192
  summary: This Gem is used to make building Selenium Tests without Capybara Easier.
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "gridium"
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
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- #do normal docker cleanup
4
- docker rm -fv $(docker ps -qa)
5
-
6
- #purge any gridium images so docker-compose up will rebuild it
7
- docker rmi $(docker images gridium_gridium --format "{{.ID}}")
8
-
data/bin/docker/start.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- docker-compose up
4
-
5
- #now shell into gridium container and execute tests you want to see run
6
- # docker exec gridium_gridium_1 rspec /spec/element_spec.rb -e "text input"
data/bin/setup DELETED
@@ -1,7 +0,0 @@
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