From e39da2b70087938d9b1197bd6cdd3730c13e8b74 Mon Sep 17 00:00:00 2001 From: Christian Gregg Date: Mon, 23 Sep 2019 18:07:28 +0100 Subject: [PATCH] Initial commit --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++++++++ .gitignore | 11 +++++++ .rspec | 3 ++ .rubocop.yml | 3 ++ Gemfile | 6 ++++ Gemfile.lock | 71 ++++++++++++++++++++++++++++++++++++++++++++ LICENSE.txt | 21 +++++++++++++ README.md | 26 ++++++++++++++++ Rakefile | 8 +++++ lib/umbra.rb | 8 +++++ lib/umbra/version.rb | 5 ++++ spec/spec_helper.rb | 16 ++++++++++ spec/umbra_spec.rb | 7 +++++ umbra.gemspec | 37 +++++++++++++++++++++++ 14 files changed, 277 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Rakefile create mode 100644 lib/umbra.rb create mode 100644 lib/umbra/version.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/umbra_spec.rb create mode 100644 umbra.gemspec diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..b52fa97 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,55 @@ +ruby: &ruby + image: carwow/ruby-ci:2.6 + +version: 2 + +jobs: + bundle: + working_directory: ~/umbra + docker: + - *ruby + steps: + - checkout + - restore_cache: + keys: + - bundle-{{ checksum "Gemfile.lock" }} + - bundle- + - run: | + bundle config --local path vendor/bundle && + bundle check || bundle install --jobs=4 --retry=3 + - save_cache: + key: bundle-{{ checksum "Gemfile.lock" }} + paths: [~/umbra/vendor/bundle] + - persist_to_workspace: + root: '~' + paths: [umbra] + + rubocop: + working_directory: ~/umbra + docker: + - *ruby + steps: + - attach_workspace: + at: '~' + - run: bundle exec rubocop + + tests: + working_directory: ~/umbra + docker: + - *ruby + steps: + - attach_workspace: + at: '~' + - run: | + bundle exec rspec + +workflows: + version: 2 + build: + jobs: + - bundle + - rubocop: + requires: [bundle] + - tests: + requires: [bundle] + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b04a8c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..856c871 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,3 @@ +inherit_gem: + carwow_rubocop: + - default.yml diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..01bec52 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +# Specify your gem's dependencies in umbra.gemspec +gemspec diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..1a7e7f2 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,71 @@ +PATH + remote: . + specs: + umbra (0.1.0) + multi_json (~> 1.13) + oj (~> 3.9) + redis (~> 4.1) + typhoeus (~> 1.3) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.0) + carwow_rubocop (3.0.3) + rubocop (>= 0.68) + rubocop-performance + rubocop-rspec + diff-lcs (1.3) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.11.1) + jaro_winkler (1.5.3) + multi_json (1.13.1) + oj (3.9.1) + parallel (1.17.0) + parser (2.6.4.1) + ast (~> 2.4.0) + rainbow (3.0.0) + rake (10.5.0) + redis (4.1.3) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) + rubocop (0.74.0) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.6) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 1.7) + rubocop-performance (1.4.1) + rubocop (>= 0.71.0) + rubocop-rspec (1.35.0) + rubocop (>= 0.60.0) + ruby-progressbar (1.10.1) + typhoeus (1.3.1) + ethon (>= 0.9.0) + unicode-display_width (1.6.0) + +PLATFORMS + ruby + +DEPENDENCIES + bundler (~> 2.0) + carwow_rubocop + rake (~> 10.0) + rspec (~> 3.0) + umbra! + +BUNDLED WITH + 2.0.2 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..73d5497 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Christian Gregg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6f9247 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# umbra - A shadow requesting tool for rack-based apps + + +```ruby +gem 'umbra' +``` + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install umbra + +## Usage + +TODO: Write usage instructions here + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/carwow/umbra. + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..82bb534 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/lib/umbra.rb b/lib/umbra.rb new file mode 100644 index 0000000..f1ba682 --- /dev/null +++ b/lib/umbra.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'umbra/version' + +module Umbra + class Error < StandardError; end + # Your code goes here... +end diff --git a/lib/umbra/version.rb b/lib/umbra/version.rb new file mode 100644 index 0000000..0acf453 --- /dev/null +++ b/lib/umbra/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Umbra + VERSION = '0.1.0' +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..89ce88a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'bundler/setup' +require 'umbra' + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = '.rspec_status' + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end diff --git a/spec/umbra_spec.rb b/spec/umbra_spec.rb new file mode 100644 index 0000000..77866a0 --- /dev/null +++ b/spec/umbra_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +RSpec.describe Umbra do + it 'has a version number' do + expect(Umbra::VERSION).not_to be nil + end +end diff --git a/umbra.gemspec b/umbra.gemspec new file mode 100644 index 0000000..544fc5d --- /dev/null +++ b/umbra.gemspec @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'umbra/version' + +Gem::Specification.new do |spec| + spec.name = 'umbra' + spec.version = Umbra::VERSION + spec.authors = ['carwow Developers'] + spec.email = ['developers@carwow.co.uk'] + + spec.summary = 'A shadow requesting library for rack based applications' + spec.homepage = 'https://github.com/carwow/umbra' + spec.license = 'MIT' + + spec.metadata['allowed_push_host'] = 'https://rubygems.org' + spec.metadata['homepage_uri'] = spec.homepage + spec.metadata['source_code_uri'] = spec.homepage + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(File.expand_path(__dir__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + end + spec.require_paths = ['lib'] + + spec.add_development_dependency 'bundler', '~> 2.0' + spec.add_development_dependency 'carwow_rubocop' + spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'rspec', '~> 3.0' + + spec.add_dependency 'typhoeus', '~> 1.3' + spec.add_dependency 'redis', '~> 4.1' + spec.add_dependency 'multi_json', '~> 1.13' + spec.add_dependency 'oj', '~> 3.9' +end