lhs 24.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundler-version +1 -0
- data/.gitignore +39 -0
- data/.rubocop.localch.yml +325 -0
- data/.rubocop.yml +52 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.activesupport4 +5 -0
- data/Gemfile.activesupport5 +4 -0
- data/LICENSE +674 -0
- data/README.md +2836 -0
- data/Rakefile +25 -0
- data/cider-ci.yml +6 -0
- data/cider-ci/bin/bundle +51 -0
- data/cider-ci/bin/ruby_install +8 -0
- data/cider-ci/bin/ruby_version +25 -0
- data/cider-ci/jobs/rspec-activesupport-4.yml +27 -0
- data/cider-ci/jobs/rspec-activesupport-5.yml +26 -0
- data/cider-ci/jobs/rspec-activesupport-latest.yml +24 -0
- data/cider-ci/jobs/rubocop.yml +18 -0
- data/cider-ci/task_components/bundle.yml +22 -0
- data/cider-ci/task_components/rspec.yml +37 -0
- data/cider-ci/task_components/rubocop.yml +29 -0
- data/cider-ci/task_components/ruby.yml +15 -0
- data/friday.yml +2 -0
- data/lhs.gemspec +43 -0
- data/lib/lhs.rb +100 -0
- data/lib/lhs/collection.rb +84 -0
- data/lib/lhs/complex.rb +158 -0
- data/lib/lhs/concerns/autoload_records.rb +55 -0
- data/lib/lhs/concerns/collection/handle_nested.rb +43 -0
- data/lib/lhs/concerns/collection/internal_collection.rb +49 -0
- data/lib/lhs/concerns/configuration.rb +20 -0
- data/lib/lhs/concerns/data/becomes.rb +18 -0
- data/lib/lhs/concerns/data/equality.rb +14 -0
- data/lib/lhs/concerns/data/json.rb +14 -0
- data/lib/lhs/concerns/data/to_hash.rb +14 -0
- data/lib/lhs/concerns/inspect.rb +70 -0
- data/lib/lhs/concerns/is_href.rb +15 -0
- data/lib/lhs/concerns/item/destroy.rb +38 -0
- data/lib/lhs/concerns/item/endpoint_lookup.rb +27 -0
- data/lib/lhs/concerns/item/save.rb +55 -0
- data/lib/lhs/concerns/item/update.rb +50 -0
- data/lib/lhs/concerns/item/validation.rb +61 -0
- data/lib/lhs/concerns/o_auth.rb +25 -0
- data/lib/lhs/concerns/option_blocks.rb +26 -0
- data/lib/lhs/concerns/proxy/accessors.rb +132 -0
- data/lib/lhs/concerns/proxy/create.rb +45 -0
- data/lib/lhs/concerns/proxy/link.rb +25 -0
- data/lib/lhs/concerns/proxy/problems.rb +27 -0
- data/lib/lhs/concerns/record/attribute_assignment.rb +25 -0
- data/lib/lhs/concerns/record/batch.rb +40 -0
- data/lib/lhs/concerns/record/chainable.rb +465 -0
- data/lib/lhs/concerns/record/configuration.rb +103 -0
- data/lib/lhs/concerns/record/create.rb +24 -0
- data/lib/lhs/concerns/record/custom_setters.rb +22 -0
- data/lib/lhs/concerns/record/destroy.rb +18 -0
- data/lib/lhs/concerns/record/endpoints.rb +108 -0
- data/lib/lhs/concerns/record/equality.rb +14 -0
- data/lib/lhs/concerns/record/find.rb +86 -0
- data/lib/lhs/concerns/record/find_by.rb +38 -0
- data/lib/lhs/concerns/record/first.rb +20 -0
- data/lib/lhs/concerns/record/href_for.rb +19 -0
- data/lib/lhs/concerns/record/last.rb +27 -0
- data/lib/lhs/concerns/record/mapping.rb +25 -0
- data/lib/lhs/concerns/record/merge.rb +26 -0
- data/lib/lhs/concerns/record/model.rb +23 -0
- data/lib/lhs/concerns/record/pagination.rb +47 -0
- data/lib/lhs/concerns/record/provider.rb +23 -0
- data/lib/lhs/concerns/record/relations.rb +26 -0
- data/lib/lhs/concerns/record/request.rb +620 -0
- data/lib/lhs/concerns/record/scope.rb +25 -0
- data/lib/lhs/concerns/record/tracing.rb +24 -0
- data/lib/lhs/concerns/record/update.rb +17 -0
- data/lib/lhs/config.rb +24 -0
- data/lib/lhs/data.rb +165 -0
- data/lib/lhs/endpoint.rb +12 -0
- data/lib/lhs/interceptors/auto_oauth/interceptor.rb +33 -0
- data/lib/lhs/interceptors/auto_oauth/thread_registry.rb +18 -0
- data/lib/lhs/interceptors/extended_rollbar/handler.rb +40 -0
- data/lib/lhs/interceptors/extended_rollbar/interceptor.rb +20 -0
- data/lib/lhs/interceptors/extended_rollbar/thread_registry.rb +19 -0
- data/lib/lhs/interceptors/request_cycle_cache/interceptor.rb +41 -0
- data/lib/lhs/interceptors/request_cycle_cache/thread_registry.rb +18 -0
- data/lib/lhs/item.rb +59 -0
- data/lib/lhs/pagination/base.rb +90 -0
- data/lib/lhs/pagination/link.rb +21 -0
- data/lib/lhs/pagination/offset.rb +22 -0
- data/lib/lhs/pagination/page.rb +18 -0
- data/lib/lhs/pagination/start.rb +22 -0
- data/lib/lhs/problems/base.rb +113 -0
- data/lib/lhs/problems/errors.rb +69 -0
- data/lib/lhs/problems/nested/base.rb +54 -0
- data/lib/lhs/problems/nested/errors.rb +16 -0
- data/lib/lhs/problems/nested/warnings.rb +15 -0
- data/lib/lhs/problems/warnings.rb +24 -0
- data/lib/lhs/proxy.rb +68 -0
- data/lib/lhs/railtie.rb +34 -0
- data/lib/lhs/record.rb +112 -0
- data/lib/lhs/rspec.rb +10 -0
- data/lib/lhs/test/stubbable_records.rb +34 -0
- data/lib/lhs/unprocessable.rb +6 -0
- data/lib/lhs/version.rb +5 -0
- data/script/ci/build.sh +18 -0
- data/spec/auto_oauth_spec.rb +169 -0
- data/spec/autoloading_spec.rb +48 -0
- data/spec/collection/accessors_spec.rb +31 -0
- data/spec/collection/collection_items_spec.rb +44 -0
- data/spec/collection/configurable_spec.rb +43 -0
- data/spec/collection/delegate_spec.rb +21 -0
- data/spec/collection/enumerable_spec.rb +27 -0
- data/spec/collection/href_spec.rb +17 -0
- data/spec/collection/meta_data_spec.rb +57 -0
- data/spec/collection/respond_to_spec.rb +20 -0
- data/spec/collection/to_a_spec.rb +34 -0
- data/spec/collection/to_ary_spec.rb +40 -0
- data/spec/collection/without_object_items_spec.rb +27 -0
- data/spec/complex/reduce_spec.rb +202 -0
- data/spec/concerns/record/request_spec.rb +78 -0
- data/spec/data/collection_spec.rb +56 -0
- data/spec/data/equality_spec.rb +23 -0
- data/spec/data/inspect_spec.rb +88 -0
- data/spec/data/is_item_or_collection_spec.rb +40 -0
- data/spec/data/item_spec.rb +106 -0
- data/spec/data/merge_spec.rb +27 -0
- data/spec/data/parent_spec.rb +39 -0
- data/spec/data/raw_spec.rb +48 -0
- data/spec/data/respond_to_spec.rb +26 -0
- data/spec/data/root_spec.rb +25 -0
- data/spec/data/select_spec.rb +27 -0
- data/spec/data/to_ary_spec.rb +28 -0
- data/spec/data/to_json_spec.rb +68 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +26 -0
- data/spec/dummy/app/controllers/automatic_authentication_controller.rb +29 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/error_handling_with_chains_controller.rb +36 -0
- data/spec/dummy/app/controllers/extended_rollbar_controller.rb +10 -0
- data/spec/dummy/app/controllers/option_blocks_controller.rb +15 -0
- data/spec/dummy/app/controllers/request_cycle_cache_controller.rb +27 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/dummy_customer.rb +6 -0
- data/spec/dummy/app/models/dummy_record.rb +6 -0
- data/spec/dummy/app/models/dummy_record_with_auto_oauth_provider.rb +6 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_oauth_providers1.rb +7 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_oauth_providers2.rb +7 -0
- data/spec/dummy/app/models/dummy_record_with_multiple_providers_per_endpoint.rb +6 -0
- data/spec/dummy/app/models/dummy_record_with_oauth.rb +7 -0
- data/spec/dummy/app/models/dummy_user.rb +6 -0
- data/spec/dummy/app/models/providers/customer_system.rb +7 -0
- data/spec/dummy/app/models/providers/internal_services.rb +7 -0
- data/spec/dummy/app/views/error_handling_with_chains/error.html.erb +1 -0
- data/spec/dummy/app/views/error_handling_with_chains/show.html.erb +3 -0
- data/spec/dummy/app/views/form_for.html.erb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/config.ru +6 -0
- data/spec/dummy/config/application.rb +16 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +36 -0
- data/spec/dummy/config/environments/production.rb +77 -0
- data/spec/dummy/config/environments/test.rb +40 -0
- data/spec/dummy/config/initializers/assets.rb +10 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/inflections.rb +18 -0
- data/spec/dummy/config/initializers/mime_types.rb +6 -0
- data/spec/dummy/config/initializers/rollbar.rb +9 -0
- data/spec/dummy/config/initializers/session_store.rb +5 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +11 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +27 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/endpoint/for_url_spec.rb +27 -0
- data/spec/extended_rollbar_spec.rb +67 -0
- data/spec/item/access_errors_spec.rb +33 -0
- data/spec/item/accessors_spec.rb +21 -0
- data/spec/item/add_error_spec.rb +21 -0
- data/spec/item/becomes_spec.rb +38 -0
- data/spec/item/blacklisted_keywords_spec.rb +30 -0
- data/spec/item/delegate_spec.rb +32 -0
- data/spec/item/destroy_spec.rb +113 -0
- data/spec/item/dig_spec.rb +29 -0
- data/spec/item/error_codes_spec.rb +55 -0
- data/spec/item/errors_spec.rb +324 -0
- data/spec/item/fetch_spec.rb +39 -0
- data/spec/item/getter_spec.rb +24 -0
- data/spec/item/internal_data_structure_spec.rb +37 -0
- data/spec/item/map_spec.rb +46 -0
- data/spec/item/nested_errors_spec.rb +28 -0
- data/spec/item/partial_update_spec.rb +170 -0
- data/spec/item/respond_to_spec.rb +31 -0
- data/spec/item/save_spec.rb +115 -0
- data/spec/item/setter_spec.rb +44 -0
- data/spec/item/translate_errors_spec.rb +257 -0
- data/spec/item/update_spec.rb +161 -0
- data/spec/item/validation_spec.rb +131 -0
- data/spec/item/warning_codes_spec.rb +55 -0
- data/spec/item/warnings_spec.rb +52 -0
- data/spec/option_blocks/ensure_reset_between_requests_spec.rb +23 -0
- data/spec/option_blocks/main_spec.rb +55 -0
- data/spec/pagination/link/current_page_spec.rb +19 -0
- data/spec/pagination/link/pages_left_spec.rb +36 -0
- data/spec/pagination/link/parallel_spec.rb +19 -0
- data/spec/pagination/link/total_spec.rb +46 -0
- data/spec/pagination/offset/pages_left_spec.rb +26 -0
- data/spec/pagination/parameters_spec.rb +61 -0
- data/spec/proxy/create_sub_resource_spec.rb +182 -0
- data/spec/proxy/load_spec.rb +75 -0
- data/spec/proxy/record_identification_spec.rb +35 -0
- data/spec/rails_helper.rb +13 -0
- data/spec/record/all_spec.rb +133 -0
- data/spec/record/attribute_assignment_spec.rb +28 -0
- data/spec/record/build_spec.rb +26 -0
- data/spec/record/cast_nested_data_spec.rb +78 -0
- data/spec/record/create_spec.rb +160 -0
- data/spec/record/creation_failed_spec.rb +55 -0
- data/spec/record/custom_setters_spec.rb +45 -0
- data/spec/record/definitions_spec.rb +29 -0
- data/spec/record/destroy_spec.rb +38 -0
- data/spec/record/dig_configuration_spec.rb +75 -0
- data/spec/record/dup_spec.rb +20 -0
- data/spec/record/endpoint_inheritance_spec.rb +65 -0
- data/spec/record/endpoint_options_spec.rb +52 -0
- data/spec/record/endpoint_priorities_spec.rb +26 -0
- data/spec/record/endpoints_spec.rb +96 -0
- data/spec/record/equality_spec.rb +27 -0
- data/spec/record/error_handling_integration_spec.rb +25 -0
- data/spec/record/error_handling_spec.rb +40 -0
- data/spec/record/expanded_spec.rb +69 -0
- data/spec/record/fetch_spec.rb +41 -0
- data/spec/record/find_by_chains_spec.rb +21 -0
- data/spec/record/find_by_spec.rb +76 -0
- data/spec/record/find_each_spec.rb +57 -0
- data/spec/record/find_in_batches_spec.rb +122 -0
- data/spec/record/find_in_parallel_spec.rb +67 -0
- data/spec/record/find_spec.rb +104 -0
- data/spec/record/first_spec.rb +39 -0
- data/spec/record/force_merge_spec.rb +56 -0
- data/spec/record/handle_includes_errors_spec.rb +32 -0
- data/spec/record/has_many_spec.rb +120 -0
- data/spec/record/has_one_spec.rb +116 -0
- data/spec/record/href_for_spec.rb +25 -0
- data/spec/record/ignore_errors_spec.rb +139 -0
- data/spec/record/immutable_chains_spec.rb +22 -0
- data/spec/record/includes_first_page_spec.rb +737 -0
- data/spec/record/includes_spec.rb +693 -0
- data/spec/record/includes_warning_spec.rb +46 -0
- data/spec/record/item_key_spec.rb +81 -0
- data/spec/record/items_created_key_configuration_spec.rb +37 -0
- data/spec/record/last_spec.rb +68 -0
- data/spec/record/loading_twice_spec.rb +19 -0
- data/spec/record/mapping_spec.rb +102 -0
- data/spec/record/model_name_spec.rb +17 -0
- data/spec/record/new_spec.rb +106 -0
- data/spec/record/options_getter_spec.rb +26 -0
- data/spec/record/options_spec.rb +164 -0
- data/spec/record/paginatable_collection_spec.rb +360 -0
- data/spec/record/pagination_chain_spec.rb +101 -0
- data/spec/record/pagination_links_spec.rb +72 -0
- data/spec/record/pagination_spec.rb +71 -0
- data/spec/record/persisted_spec.rb +52 -0
- data/spec/record/provider_spec.rb +41 -0
- data/spec/record/references_spec.rb +53 -0
- data/spec/record/relation_caching_spec.rb +121 -0
- data/spec/record/reload_by_id_spec.rb +43 -0
- data/spec/record/reload_spec.rb +65 -0
- data/spec/record/request_spec.rb +90 -0
- data/spec/record/save_spec.rb +40 -0
- data/spec/record/scope_chains_spec.rb +39 -0
- data/spec/record/select_spec.rb +17 -0
- data/spec/record/to_ary_spec.rb +65 -0
- data/spec/record/to_hash_spec.rb +22 -0
- data/spec/record/to_json_spec.rb +22 -0
- data/spec/record/tracing_spec.rb +154 -0
- data/spec/record/update_spec.rb +62 -0
- data/spec/record/where_chains_spec.rb +57 -0
- data/spec/record/where_spec.rb +62 -0
- data/spec/record/where_values_hash_spec.rb +32 -0
- data/spec/request_cycle_cache_spec.rb +106 -0
- data/spec/require_lhs_spec.rb +9 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/stubs/all_spec.rb +72 -0
- data/spec/support/fixtures/json/feedback.json +11 -0
- data/spec/support/fixtures/json/feedbacks.json +174 -0
- data/spec/support/fixtures/json/localina_content_ad.json +23 -0
- data/spec/support/load_json.rb +5 -0
- data/spec/support/request_cycle_cache.rb +10 -0
- data/spec/support/reset.rb +67 -0
- data/spec/views/form_for_spec.rb +20 -0
- metadata +776 -0
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
rdoc.title = 'LHS'
|
11
|
+
rdoc.options << '--line-numbers'
|
12
|
+
rdoc.rdoc_files.include('README.rdoc')
|
13
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
require 'rspec/core/rake_task'
|
18
|
+
RSpec::Core::RakeTask.new(:spec)
|
19
|
+
task :default => :spec
|
20
|
+
rescue LoadError
|
21
|
+
# no rspec available
|
22
|
+
end
|
23
|
+
|
24
|
+
Bundler::GemHelper.install_tasks
|
25
|
+
|
data/cider-ci.yml
ADDED
data/cider-ci/bin/bundle
ADDED
@@ -0,0 +1,51 @@
|
|
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
|
+
# install bundler v. 1.17.3 in order to be able to run the tests with
|
12
|
+
# ACTIVESUPPORT=4 because rails (= 4.2.0) depends on bundler (< 2.0, >= 1.3.0)
|
13
|
+
gem install bundler:1.17.3
|
14
|
+
|
15
|
+
sed "s/^source 'https:\/\/rubygems\.intra\.local\.ch'*/source 'http\:\/\/52.29.7.59:9292'/g" Gemfile > Gemfile.tmp
|
16
|
+
mv Gemfile.tmp Gemfile
|
17
|
+
|
18
|
+
DIGEST=$(git ls-tree HEAD --\
|
19
|
+
cider-ci.yml cider-ci Gemfile.lock \
|
20
|
+
| openssl dgst -sha1 | cut -d ' ' -f 2)
|
21
|
+
|
22
|
+
if [ ! -z ${ACTIVESUPPORT:-} ]; then
|
23
|
+
DIGEST=$(echo "$DIGEST $ACTIVESUPPORT")
|
24
|
+
fi
|
25
|
+
|
26
|
+
DIGEST=$(echo "$DIGEST $PATH" \
|
27
|
+
| openssl dgst -sha1 | cut -d ' ' -f 2)
|
28
|
+
|
29
|
+
echo "DIGEST"
|
30
|
+
echo "${DIGEST}"
|
31
|
+
|
32
|
+
CACHE_SIGNATURE_FILE="/tmp/bundle_cache_signature_${DIGEST}"
|
33
|
+
|
34
|
+
if [ ! -f $CACHE_SIGNATURE_FILE ] ; then
|
35
|
+
if [ ! -z ${ACTIVESUPPORT:-} ]; then
|
36
|
+
if [ ! -z ${BUNDLER:-} ]; then
|
37
|
+
echo "BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER install"
|
38
|
+
BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER install
|
39
|
+
else
|
40
|
+
echo "BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle install"
|
41
|
+
BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle install
|
42
|
+
fi
|
43
|
+
else
|
44
|
+
echo "bundle install"
|
45
|
+
bundle $BUNDLER install
|
46
|
+
fi
|
47
|
+
touch $CACHE_SIGNATURE_FILE
|
48
|
+
fi
|
49
|
+
|
50
|
+
echo "bundle install"
|
51
|
+
bundle $BUNDLER install
|
@@ -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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
rspec-active-support-v4:
|
2
|
+
name: 'rspec with ActiveSupport v4'
|
3
|
+
|
4
|
+
run_when:
|
5
|
+
'some HEAD has been updated':
|
6
|
+
type: branch
|
7
|
+
include_match: ^.*$
|
8
|
+
|
9
|
+
context:
|
10
|
+
|
11
|
+
script_defaults:
|
12
|
+
template_environment_variables: true
|
13
|
+
|
14
|
+
task_defaults:
|
15
|
+
environment_variables:
|
16
|
+
ACTIVESUPPORT: '4'
|
17
|
+
BUNDLER: '_1.17.3_'
|
18
|
+
max_trials: 2
|
19
|
+
dispatch_storm_delay_duration: 1 Seconds
|
20
|
+
include:
|
21
|
+
- cider-ci/task_components/ruby.yml
|
22
|
+
- cider-ci/task_components/bundle.yml
|
23
|
+
- cider-ci/task_components/rspec.yml
|
24
|
+
|
25
|
+
tasks:
|
26
|
+
all-rspec:
|
27
|
+
name: All rspec tests, using ActiveSupport v4
|
@@ -0,0 +1,26 @@
|
|
1
|
+
rspec-active-support-v5:
|
2
|
+
name: 'rspec with ActiveSupport v5'
|
3
|
+
|
4
|
+
run_when:
|
5
|
+
'some HEAD has been updated':
|
6
|
+
type: branch
|
7
|
+
include_match: ^.*$
|
8
|
+
|
9
|
+
context:
|
10
|
+
|
11
|
+
script_defaults:
|
12
|
+
template_environment_variables: true
|
13
|
+
|
14
|
+
task_defaults:
|
15
|
+
environment_variables:
|
16
|
+
ACTIVESUPPORT: '5'
|
17
|
+
max_trials: 2
|
18
|
+
dispatch_storm_delay_duration: 1 Seconds
|
19
|
+
include:
|
20
|
+
- cider-ci/task_components/ruby.yml
|
21
|
+
- cider-ci/task_components/bundle.yml
|
22
|
+
- cider-ci/task_components/rspec.yml
|
23
|
+
|
24
|
+
tasks:
|
25
|
+
all-rspec:
|
26
|
+
name: All rspec tests, using ActiveSupport v5
|
@@ -0,0 +1,24 @@
|
|
1
|
+
rspec-active-support-latest:
|
2
|
+
name: 'rspec with ActiveSupport latest'
|
3
|
+
|
4
|
+
run_when:
|
5
|
+
'some HEAD has been updated':
|
6
|
+
type: branch
|
7
|
+
include_match: ^.*$
|
8
|
+
|
9
|
+
context:
|
10
|
+
|
11
|
+
script_defaults:
|
12
|
+
template_environment_variables: true
|
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
|
21
|
+
|
22
|
+
tasks:
|
23
|
+
all-rspec:
|
24
|
+
name: All rspec tests, using ActiveSupport latest
|
@@ -0,0 +1,18 @@
|
|
1
|
+
rubocop:
|
2
|
+
name: 'Rubocop'
|
3
|
+
|
4
|
+
run_when:
|
5
|
+
'some HEAD has been updated':
|
6
|
+
type: branch
|
7
|
+
include_match: ^.*$
|
8
|
+
|
9
|
+
context:
|
10
|
+
|
11
|
+
tasks:
|
12
|
+
|
13
|
+
rubocop:
|
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,22 @@
|
|
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
|
+
environment_variables:
|
11
|
+
BUNDLER:
|
12
|
+
read_and_replace_with: .bundler-version
|
13
|
+
|
14
|
+
scripts:
|
15
|
+
|
16
|
+
bundle:
|
17
|
+
exclusive_executor_resource: ruby-install_{{$RUBY}}
|
18
|
+
timeout: 20 Minutes
|
19
|
+
body: cider-ci/bin/bundle
|
20
|
+
start_when:
|
21
|
+
'ruby installed':
|
22
|
+
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
|
+
BUNDLER:
|
13
|
+
read_and_replace_with: .bundler-version
|
14
|
+
|
15
|
+
scripts:
|
16
|
+
rspec:
|
17
|
+
body: |
|
18
|
+
#!/usr/bin/env bash
|
19
|
+
set -eux
|
20
|
+
mkdir -p tmp/cache
|
21
|
+
export PATH=~/.rubies/$RUBY/bin:$PATH
|
22
|
+
if [ ! -z ${ACTIVESUPPORT:-} ]; then BUNDLE_GEMFILE=Gemfile.activesupport$ACTIVESUPPORT bundle $BUNDLER exec rspec; else bundle exec rspec; fi
|
23
|
+
|
24
|
+
start_when:
|
25
|
+
'bundled':
|
26
|
+
script_key: bundle
|
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
|
+
|
data/friday.yml
ADDED
data/lhs.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require "lhs/version"
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = "lhs"
|
11
|
+
s.version = LHS::VERSION
|
12
|
+
s.authors = ['https://github.com/local-ch/lhs/graphs/contributors']
|
13
|
+
s.email = ['web@localsearch.ch']
|
14
|
+
s.homepage = 'https://github.com/local-ch/lhs'
|
15
|
+
s.summary = 'REST services accelerator: Rails gem providing an easy, active-record-like interface for http (hypermedia) json services'
|
16
|
+
s.description = 'LHS ia a Rails-Gem, providing an ActiveRecord like interface to access HTTP-JSON-Services from Rails Applications. Special features provided by this gem are: Multiple endpoint configuration per resource, active-record-like query-chains, scopes, error handling, relations, request cycle cache, batch processing, including linked resources (hypermedia), data maps (data accessing), nested-resource handling, ActiveModel like backend validation conversion, formbuilder-compatible, three types of pagination support, service configuration per resource, kaminari-support and much more.'
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
|
22
|
+
s.requirements << 'Ruby >= 2.3.0'
|
23
|
+
s.required_ruby_version = '>= 2.3.0'
|
24
|
+
|
25
|
+
s.add_dependency 'activemodel'
|
26
|
+
s.add_dependency 'activesupport', '>= 4.2.11'
|
27
|
+
s.add_dependency 'lhc', '>= 12.1.1', '< 13'
|
28
|
+
s.add_dependency 'local_uri'
|
29
|
+
|
30
|
+
s.add_development_dependency 'capybara'
|
31
|
+
s.add_development_dependency 'json', '>= 1.8.2'
|
32
|
+
s.add_development_dependency 'pry'
|
33
|
+
s.add_development_dependency 'pry-byebug'
|
34
|
+
s.add_development_dependency 'rails', '>= 4.2.11'
|
35
|
+
s.add_development_dependency 'rollbar', '<= 2.24.0'
|
36
|
+
s.add_development_dependency 'rspec-rails', '>= 3.7.0'
|
37
|
+
s.add_development_dependency 'rubocop', '~> 0.57.1'
|
38
|
+
s.add_development_dependency 'rubocop-rspec', '~> 1.26.0'
|
39
|
+
s.add_development_dependency 'sprockets', '< 4'
|
40
|
+
s.add_development_dependency 'webmock'
|
41
|
+
|
42
|
+
s.license = 'GPL-3.0'
|
43
|
+
end
|
data/lib/lhs.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lhc'
|
4
|
+
|
5
|
+
module LHS
|
6
|
+
autoload :Configuration,
|
7
|
+
'lhs/concerns/configuration'
|
8
|
+
autoload :AutoloadRecords,
|
9
|
+
'lhs/concerns/autoload_records'
|
10
|
+
autoload :Collection,
|
11
|
+
'lhs/collection'
|
12
|
+
autoload :Complex,
|
13
|
+
'lhs/complex'
|
14
|
+
autoload :Config,
|
15
|
+
'lhs/config'
|
16
|
+
autoload :Data,
|
17
|
+
'lhs/data'
|
18
|
+
autoload :ExtendedRollbar,
|
19
|
+
'lhs/interceptors/extended_rollbar/interceptor'
|
20
|
+
autoload :Endpoint,
|
21
|
+
'lhs/endpoint'
|
22
|
+
autoload :Inspect,
|
23
|
+
'lhs/concerns/inspect'
|
24
|
+
module Interceptors
|
25
|
+
module AutoOauth
|
26
|
+
autoload :ThreadRegistry,
|
27
|
+
'lhs/interceptors/auto_oauth/thread_registry'
|
28
|
+
autoload :Interceptor,
|
29
|
+
'lhs/interceptors/auto_oauth/interceptor'
|
30
|
+
end
|
31
|
+
module RequestCycleCache
|
32
|
+
autoload :ThreadRegistry,
|
33
|
+
'lhs/interceptors/request_cycle_cache/thread_registry'
|
34
|
+
autoload :Interceptor,
|
35
|
+
'lhs/interceptors/request_cycle_cache/interceptor'
|
36
|
+
end
|
37
|
+
module ExtendedRollbar
|
38
|
+
autoload :ThreadRegistry,
|
39
|
+
'lhs/interceptors/extended_rollbar/thread_registry'
|
40
|
+
autoload :Interceptor,
|
41
|
+
'lhs/interceptors/extended_rollbar/interceptor'
|
42
|
+
autoload :Handler,
|
43
|
+
'lhs/interceptors/extended_rollbar/handler'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
autoload :IsHref,
|
47
|
+
'lhs/concerns/is_href'
|
48
|
+
autoload :Item,
|
49
|
+
'lhs/item'
|
50
|
+
autoload :OAuth,
|
51
|
+
'lhs/concerns/o_auth.rb'
|
52
|
+
autoload :OptionBlocks,
|
53
|
+
'lhs/concerns/option_blocks'
|
54
|
+
autoload :Pagination,
|
55
|
+
'lhs/pagination/base'
|
56
|
+
module Pagination
|
57
|
+
autoload :Offset,
|
58
|
+
'lhs/pagination/offset'
|
59
|
+
autoload :Page,
|
60
|
+
'lhs/pagination/page'
|
61
|
+
autoload :Start,
|
62
|
+
'lhs/pagination/start'
|
63
|
+
autoload :Link,
|
64
|
+
'lhs/pagination/link'
|
65
|
+
end
|
66
|
+
autoload :Problems,
|
67
|
+
'lhs/problems/base'
|
68
|
+
module Problems
|
69
|
+
autoload :Base,
|
70
|
+
'lhs/problems/base'
|
71
|
+
autoload :Errors,
|
72
|
+
'lhs/problems/errors'
|
73
|
+
autoload :Nested,
|
74
|
+
'lhs/problems/nested/base'
|
75
|
+
module Nested
|
76
|
+
autoload :Base,
|
77
|
+
'lhs/problems/nested/base'
|
78
|
+
autoload :Errors,
|
79
|
+
'lhs/problems/nested/errors'
|
80
|
+
autoload :Warnings,
|
81
|
+
'lhs/problems/nested/warnings'
|
82
|
+
end
|
83
|
+
autoload :Warnings,
|
84
|
+
'lhs/problems/warnings'
|
85
|
+
end
|
86
|
+
autoload :Proxy,
|
87
|
+
'lhs/proxy'
|
88
|
+
autoload :Record,
|
89
|
+
'lhs/record'
|
90
|
+
autoload :Unprocessable,
|
91
|
+
'lhs/unprocessable'
|
92
|
+
|
93
|
+
include Configuration
|
94
|
+
include AutoloadRecords if defined?(Rails)
|
95
|
+
include OptionBlocks
|
96
|
+
|
97
|
+
require 'lhs/record' # as lhs records in an application are directly inheriting it
|
98
|
+
|
99
|
+
require 'lhs/railtie' if defined?(Rails)
|
100
|
+
end
|