lhc 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 496730ce418b771c2178219b3d68a6866e5e9f91
4
- data.tar.gz: 50671f7af5a2634a70292307f05ff3250a05befd
3
+ metadata.gz: 3c8743276bc3e95f6692660682c68f0e1db0eb6d
4
+ data.tar.gz: d7e232ede3de6c48a8e03ae593ae7b95d895384b
5
5
  SHA512:
6
- metadata.gz: a40eca0b07af2be7f5e61cd2afd63aad473578bf484723d957019b20486ad35456644d199f8c564a705b45fbb7ce14019b417756e04312da3bd349e8678066d6
7
- data.tar.gz: 0a6414893434fc9e9f100d8f561d3215a4b14390d69b2477120fb4cf9f4c5214e69c4729dd9f70604d9019a0c3d37bc4320de28fafffa3dd81cba8cc0dc0a302
6
+ metadata.gz: 3a5c0ef4e4540459694ee0e1f6dbad6ab98c49429f4b4e047b650f5b275473a7bdb3c8e9c5b98260781af15fffb13199141306b564d7b2a632f6f03c94a270f0
7
+ data.tar.gz: 41275480184ac6fbcc56272e372b486e07953f2186d27611e0f3b2c49b85b5fa49cd701e7663a86646542a274ea1d9ba92d3d8caa56b269c7cb9054db3c63450
data/.gitignore CHANGED
@@ -24,7 +24,6 @@ config/secrets.yml
24
24
 
25
25
  # these should all be checked in to normalise the environment:
26
26
  Gemfile.lock
27
- .ruby-version
28
27
  .ruby-gemset
29
28
 
30
29
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
@@ -15,5 +15,23 @@ RSpec/AnyInstance:
15
15
  RSpec/DescribedClass:
16
16
  Enabled: false
17
17
 
18
+ RSpec/MultipleExpectations:
19
+ Enabled: false
20
+
21
+ RSpec/HookArgument:
22
+ Enabled: false
23
+
24
+ RSpec/ExampleLength:
25
+ Enabled: false
26
+
18
27
  Style/Lambda:
19
28
  Enabled: false
29
+
30
+ RSpec/NestedGroups:
31
+ Enabled: false
32
+
33
+ RSpec/VerifiedDoubles:
34
+ Enabled: false
35
+
36
+ Style/RedundantReturn:
37
+ Enabled: false
@@ -0,0 +1 @@
1
+ ruby-2.2.0
@@ -1,4 +1,4 @@
1
1
  jobs:
2
- _cider-ci_include:
2
+ include:
3
3
  - cider-ci/jobs/rubocop.yml
4
4
  - cider-ci/jobs/rspec.yml
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+
4
+ export PATH=~/.rubies/$RUBY/bin:$PATH
5
+ rm -f .bundle/config
6
+
7
+ if [ ! -f ~/.rubies/$RUBY/bin/bundle ]; then
8
+ gem install bundler
9
+ fi
10
+
11
+ sed "s/^source 'https:\/\/rubygems\.intra\.local\.ch'*/source 'http\:\/\/52.29.7.59:9292'/g" Gemfile > Gemfile.tmp
12
+ mv Gemfile.tmp Gemfile
13
+
14
+ DIGEST=$(git ls-tree HEAD --\
15
+ cider-ci.yml cider-ci Gemfile.lock \
16
+ | openssl dgst -sha1 | cut -d ' ' -f 2)
17
+
18
+ DIGEST=$(echo "$DIGEST $PATH" \
19
+ | openssl dgst -sha1 | cut -d ' ' -f 2)
20
+
21
+ CACHE_SIGNATURE_FILE="/tmp/bundle_cache_signature_${DIGEST}"
22
+
23
+ if [ ! -f $CACHE_SIGNATURE_FILE ] ; then
24
+ bundle install
25
+ touch $CACHE_SIGNATURE_FILE
26
+ fi
27
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+
4
+ export PATH=~/.rubies/$RUBY/bin:$PATH
5
+
6
+ if [ ! -d ~/.rubies/$RUBY ]; then
7
+ ruby-install --no-install-deps $RUBY
8
+ fi
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+
4
+ if [ -f ./.ruby-version ]; then
5
+ echo ".ruby-version file found"
6
+ fi
7
+
8
+ if [ ! -f ./.ruby-version ]; then
9
+ echo ".ruby-version file not found"
10
+ exit 1
11
+ fi
12
+
13
+ IFS='-' read -ra EXPLODED_RUBY <<< "$RUBY"
14
+
15
+ if [ "${#EXPLODED_RUBY[@]}" == "1" ]; then
16
+ echo 'No engine/version separator "-" found in .ruby-version file.'
17
+ exit 1
18
+ fi
19
+
20
+ if [ "${#EXPLODED_RUBY[@]}" != "1" ] && [ "${#EXPLODED_RUBY[@]}" != "2" ]; then
21
+ echo "Unknown format of .ruby-version file"
22
+ exit 1
23
+ fi
24
+
25
+ echo $RUBY
@@ -1,48 +1,24 @@
1
1
  rspec:
2
- name: 'RSPec tests'
2
+ name: 'rspec'
3
3
 
4
- run-on:
5
- - type: branch
6
- include-match: ^.*$
4
+ run_when:
5
+ 'some HEAD has been updated':
6
+ type: branch
7
+ include_match: ^.*$
7
8
 
8
9
  context:
9
- task-defaults:
10
- ports:
11
- CAPYBARA_PORT:
12
- inet_address: "localhost"
13
- min: 8000
14
- max: 8999
15
- PHANTOMJS_PORT:
16
- inet_address: "localhost"
17
- min: 44600
18
- max: 44999
19
10
 
20
- scripts:
21
- rspec:
22
- start-when:
23
- - script: bundle
24
- - script: ruby-version
25
- - script: tmp-cache
11
+ script_defaults:
12
+ template_environment_variables: true
26
13
 
14
+ task_defaults:
15
+ max_trials: 2
16
+ dispatch_storm_delay_duration: 1 Seconds
17
+ include:
18
+ - cider-ci/task_components/ruby.yml
19
+ - cider-ci/task_components/bundle.yml
20
+ - cider-ci/task_components/rspec.yml
27
21
 
28
- _cider-ci_include:
29
- - cider-ci/scripts/bundle.yml
30
- - cider-ci/scripts/tmp-cache.yml
31
- - cider-ci/scripts/ruby-version.yml
32
- - cider-ci/scripts/rspec.yml
33
-
34
-
35
- trial-attachments:
36
- logs:
37
- include-match: log\/.*\.log$
38
- content-type: text/plain
39
- image-screenshots:
40
- include-match: tmp\/capybara\/.*\.png$
41
- content-type: image/png
42
- html-screenshots:
43
- include-match: tmp\/capybara\/.*\.html$
44
- content-type: text/html
45
-
46
- _cider-ci_generate-tasks:
47
- include-match: spec/.*_spec.rb
48
- exclude-match: spec/support/shared/*
22
+ tasks:
23
+ all-rspec:
24
+ name: All rspec tests
@@ -1,55 +1,18 @@
1
1
  rubocop:
2
- name: 'Rubocop analysis'
2
+ name: 'Rubocop'
3
3
 
4
- run-on:
5
- - type: branch
6
- include-match: ^.*$
4
+ run_when:
5
+ 'some HEAD has been updated':
6
+ type: branch
7
+ include_match: ^.*$
7
8
 
8
9
  context:
9
- task-defaults:
10
- environment-variables:
11
- GIT_REPOSITORY: local-ch/location-app
12
- RESULT_PATH: 'tmp/checkstyle.json'
13
-
14
- scripts:
15
- rubocop:
16
- start-when:
17
- - script: bundle
18
- - script: ruby-version
19
- - script: tmp-cache
20
-
21
-
22
- github_comment:
23
- start-when:
24
- - script: rubocop
25
- states: [failed]
26
-
27
-
28
- _cider-ci_include:
29
- - cider-ci/scripts/bundle.yml
30
- - cider-ci/scripts/tmp-cache.yml
31
- - cider-ci/scripts/ruby-version.yml
32
- - cider-ci/scripts/rubocop.yml
33
-
34
- - cider-ci/scripts/github_comment.yml
35
-
36
-
37
- max-auto-trials: 1
38
-
39
- trial-attachments:
40
- logs:
41
- include-match: tmp\/checkstyle.json$
42
- content-type: application/json
43
-
44
- tree-attachments:
45
- logs:
46
- include-match: tmp\/checkstyle.json$
47
- content-type: application/json
48
10
 
49
11
  tasks:
12
+
50
13
  rubocop:
51
- scripts:
52
- rubocop: {}
53
-
54
- github_comment: {}
55
-
14
+
15
+ include:
16
+ - cider-ci/task_components/ruby.yml
17
+ - cider-ci/task_components/bundle.yml
18
+ - cider-ci/task_components/rubocop.yml
@@ -0,0 +1,18 @@
1
+ traits:
2
+ ruby-install: true
3
+ Bash: true
4
+
5
+ trial_attachments:
6
+ gemfile:
7
+ include_match: Gemfile
8
+ content_type: text/plain
9
+
10
+ scripts:
11
+
12
+ bundle:
13
+ exclusive_executor_resource: ruby-install_{{$RUBY}}
14
+ timeout: 20 Minutes
15
+ body: cider-ci/bin/bundle
16
+ start_when:
17
+ 'ruby installed':
18
+ script_key: ruby-install
@@ -0,0 +1,37 @@
1
+ ports:
2
+ CAPYBARA_PORT:
3
+ min: 8000
4
+ max: 8999
5
+ PHANTOMJS_PORT:
6
+ min: 44600
7
+ max: 44999
8
+
9
+ environment_variables:
10
+ RUBY:
11
+ read_and_replace_with: .ruby-version
12
+ RAILS_ENV: 'test'
13
+
14
+ scripts:
15
+ rspec:
16
+ body: |
17
+ #!/usr/bin/env bash
18
+ set -eux
19
+ mkdir -p tmp/cache
20
+ export PATH=~/.rubies/$RUBY/bin:$PATH
21
+ bundle exec rspec
22
+
23
+ start_when:
24
+ 'bundled':
25
+ script_key: bundle
26
+
27
+
28
+ trial_attachments:
29
+ logs:
30
+ include_match: log\/.*\.log$
31
+ content_type: text/plain
32
+ image-screenshots:
33
+ include_match: tmp\/capybara\/.*\.png$
34
+ content_type: image/png
35
+ html-screenshots:
36
+ include_match: tmp\/capybara\/.*\.html$
37
+ content_type: text/html
@@ -0,0 +1,29 @@
1
+ trial_attachments:
2
+ logs:
3
+ include_match: tmp\/checkstyle.json$
4
+ content_type: application/json
5
+
6
+ tree_attachments:
7
+ logs:
8
+ include_match: tmp\/checkstyle.json$
9
+ content_type: application/json
10
+
11
+ environment_variables:
12
+ RUBY:
13
+ read_and_replace_with: .ruby-version
14
+ RESULT_PATH: 'tmp/checkstyle.json'
15
+
16
+ max_trials: 1
17
+
18
+ scripts:
19
+ rubocop:
20
+ start_when:
21
+ 'bundled':
22
+ script_key: bundle
23
+ body: |
24
+ #!/usr/bin/env bash
25
+ set -eux
26
+ mkdir -p tmp/cache
27
+ export PATH=~/.rubies/$RUBY/bin:$PATH
28
+ bundle exec rubocop --config .rubocop.yml \
29
+ --format json --out $RESULT_PATH --format progress
@@ -0,0 +1,15 @@
1
+ environment_variables:
2
+ RUBY:
3
+ read_and_replace_with: .ruby-version
4
+
5
+ scripts:
6
+ ruby-version:
7
+ body: cider-ci/bin/ruby_version
8
+ ruby-install:
9
+ exclusive_executor_resource: ruby-install_{{$RUBY}}
10
+ timeout: 20 Minutes
11
+ body: cider-ci/bin/ruby_install
12
+ start_when:
13
+ 'ruby version checked':
14
+ script_key: ruby-version
15
+
@@ -29,7 +29,8 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'webmock'
30
30
  s.add_development_dependency 'geminabox'
31
31
  s.add_development_dependency 'pry'
32
- s.add_development_dependency 'ciderizer'
32
+ s.add_development_dependency 'rubocop'
33
+ s.add_development_dependency 'rubocop-rspec'
33
34
 
34
35
  s.license = 'GPL-3'
35
36
  end
@@ -10,7 +10,7 @@ class LHC::Config
10
10
 
11
11
  def endpoint(name, url, options = {})
12
12
  name = name.to_sym
13
- fail 'Endpoint already exists for that name' if @endpoints[name]
13
+ raise 'Endpoint already exists for that name' if @endpoints[name]
14
14
  @endpoints[name] = LHC::Endpoint.new(url, options)
15
15
  end
16
16
 
@@ -20,7 +20,7 @@ class LHC::Config
20
20
 
21
21
  def placeholder(name, value)
22
22
  name = name.to_sym
23
- fail 'Placeholder already exists for that name' if @placeholders[name]
23
+ raise 'Placeholder already exists for that name' if @placeholders[name]
24
24
  @placeholders[name] = value
25
25
  end
26
26
 
@@ -33,7 +33,7 @@ class LHC::Config
33
33
  end
34
34
 
35
35
  def interceptors=(interceptors)
36
- fail 'Default interceptors already set and can only be set once' if @interceptors
36
+ raise 'Default interceptors already set and can only be set once' if @interceptors
37
37
  @interceptors = interceptors
38
38
  end
39
39
 
@@ -20,7 +20,7 @@ class LHC::Endpoint
20
20
  else
21
21
  find_value(match, params)
22
22
  end
23
- replacement || fail("Compilation incomplete. Unable to find value for #{match.gsub(':', '')}.")
23
+ replacement || raise("Compilation incomplete. Unable to find value for #{match.gsub(':', '')}.")
24
24
  end
25
25
  end
26
26
 
@@ -15,7 +15,7 @@ class LHC::InterceptorProcessor
15
15
  interceptors.each do |interceptor|
16
16
  result = interceptor.send(name, target)
17
17
  if result.is_a? LHC::Response
18
- fail 'Response already set from another interceptor' if @response
18
+ raise 'Response already set from another interceptor' if @response
19
19
  request = target.is_a?(LHC::Request) ? target : target.request
20
20
  @response = request.response = result
21
21
  end
@@ -108,6 +108,6 @@ class LHC::Request
108
108
 
109
109
  def throw_error(response)
110
110
  error = LHC::Error.find(response)
111
- fail error.new(error, response)
111
+ raise error.new(error, response)
112
112
  end
113
113
  end
@@ -1,10 +1,11 @@
1
1
  # Response data is data provided through the response body
2
2
  # but made accssible in the ruby world
3
- class LHC::Response::Data
3
+ class LHC::Response::Data < OpenStruct
4
4
 
5
5
  def initialize(response)
6
6
  @response = response
7
7
  set_dynamic_accessor_methods
8
+ super(as_json)
8
9
  end
9
10
 
10
11
  def as_json
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION = "3.7.0"
2
+ VERSION = "3.7.1"
3
3
  end
@@ -54,7 +54,7 @@ describe LHC::Request do
54
54
  end
55
55
 
56
56
  it 'requests json and parses response body' do
57
- expect(->{
57
+ expect(-> {
58
58
  LHC.json.get('http://datastore/v2/feedbacks').data
59
59
  }).to raise_error(LHC::ParserError)
60
60
  end
@@ -63,7 +63,7 @@ describe LHC::Request do
63
63
  context 'custom error handler' do
64
64
  it 'handles errors with the provided handler and does not raise them' do
65
65
  stub_request(:get, "http://something").to_return(status: 400)
66
- handler = spy('handler')
66
+ handler = double('handler', call: -> {})
67
67
  LHC::Request.new(url: "http://something", error_handler: handler)
68
68
  expect(handler).to have_received(:call)
69
69
  end
@@ -25,5 +25,9 @@ describe LHC::Response do
25
25
  it 'can be converted to an open struct with the as_open_struct method' do
26
26
  expect(response.data.as_open_struct).to eq JSON.parse(response.body, object_class: OpenStruct)
27
27
  end
28
+
29
+ it 'returns nil when data is not available' do
30
+ expect(response.data.something).to be_nil
31
+ end
28
32
  end
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - local.ch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -109,7 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: ciderizer
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -133,18 +147,20 @@ files:
133
147
  - ".gitignore"
134
148
  - ".rubocop.localch.yml"
135
149
  - ".rubocop.yml"
150
+ - ".ruby-version"
136
151
  - Gemfile
137
152
  - README.md
138
153
  - Rakefile
139
154
  - cider-ci.yml
155
+ - cider-ci/bin/bundle
156
+ - cider-ci/bin/ruby_install
157
+ - cider-ci/bin/ruby_version
140
158
  - cider-ci/jobs/rspec.yml
141
159
  - cider-ci/jobs/rubocop.yml
142
- - cider-ci/scripts/bundle.yml
143
- - cider-ci/scripts/github_comment.yml
144
- - cider-ci/scripts/rspec.yml
145
- - cider-ci/scripts/rubocop.yml
146
- - cider-ci/scripts/ruby-version.yml
147
- - cider-ci/scripts/tmp-cache.yml
160
+ - cider-ci/task_components/bundle.yml
161
+ - cider-ci/task_components/rspec.yml
162
+ - cider-ci/task_components/rubocop.yml
163
+ - cider-ci/task_components/ruby.yml
148
164
  - docs/configuration.md
149
165
  - docs/exceptions.md
150
166
  - docs/interceptors.md
@@ -1,3 +0,0 @@
1
- bundle:
2
- exclusive-executor-resource: bundler
3
- body: sed 's/^source.*/source "http\:\/\/52.29.7.59:9292"/g' Gemfile > Gemfile.tmp ; mv Gemfile.tmp Gemfile && bundle install
@@ -1,6 +0,0 @@
1
- github_comment:
2
- ignore-state: true
3
- body: |
4
- #!/usr/bin/env bash
5
-
6
- bundle exec rake checkstyle
@@ -1,4 +0,0 @@
1
- rspec:
2
- body: |
3
- #!/usr/bin/env bash
4
- RAILS_ENV=test bundle exec rspec $CIDER_CI_TASK_FILE
@@ -1,5 +0,0 @@
1
- rubocop:
2
- body: |
3
- #!/usr/bin/env bash
4
-
5
- bundle exec rubocop --config .rubocop.yml --format json --out $RESULT_PATH --format progress
@@ -1,2 +0,0 @@
1
- ruby-version:
2
- body: ruby --version
@@ -1,2 +0,0 @@
1
- tmp-cache:
2
- body: mkdir -p tmp/cache