diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0cb6eeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/.bundle/ +/.yardoc +/Gemfile.lock +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..017f51e --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,13 @@ +PreCommit: + RuboCop: + enabled: true + required: false + on_warn: fail + + HardTabs: + enabled: true + required: false + +CommitMsg: + TrailingPeriod: + enabled: false 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..3c02b4e --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,11 @@ +inherit_gem: + salsify_rubocop: conf/rubocop.yml + +AllCops: + TargetRubyVersion: 2.4 + Exclude: + - 'vendor/**/*' + - 'gemfiles/vendor/**/*' + +Style/FrozenStringLiteralComment: + Enabled: true diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..a797def --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +tree_reject diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..d4bcea9 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.5.3 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..af584ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: ruby +rvm: + - 2.5.3 +before_install: gem install bundler -v 1.12.4 +script: + - bundle exec rubocop + - bundle exec rspec diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1b7a132 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). + +## Unreleased + +## 0.1.0 - 2019-03-28 +### Added +- Initial version diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..4e0b390 --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + + +source 'https://rubygems.org' + + +# override the :github shortcut to be secure by using HTTPS +git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" } + +# Specify your gem's dependencies in tree_reject.gemspec +gemspec diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..29006ee --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2019 Salsify, Inc + +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..257cd3b --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# TreeReject + +Welcome to your new gem! In this directory, you'll find the files you need to be +able to package up your Ruby library into a gem. Put your Ruby code in the file +`lib/tree_reject`. To experiment with that code, run +`bin/console` for an interactive prompt. + +TODO: Delete this and the text above, and describe your gem + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'tree_reject' +``` + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install tree_reject + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, +run `rake spec` to run the tests. You can also run `bin/console` for an +interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. + +To release a new version, update the version number in `version.rb`, and then +run `bundle exec rake release`, which will create a git tag for the version, +push git commits and tags, and push the `.gem` file to +[rubygems.org](https://rubygems.org) +. + +## Contributing + +Bug reports and pull requests are welcome on GitHub at +https://github.com/salsify/tree_reject.## License + +The gem is available as open source under the terms of the +[MIT License](http://opensource.org/licenses/MIT). + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c2094f3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' + + +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..90f19ef --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'bundler/setup' +require 'tree_reject' + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require 'irb' +IRB.start diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..d59b32d --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -v + +bundle update + +overcommit --install diff --git a/lib/tree_reject.rb b/lib/tree_reject.rb new file mode 100644 index 0000000..7690603 --- /dev/null +++ b/lib/tree_reject.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'tree_reject/version' + +# Top-level gem module +module TreeReject +end diff --git a/lib/tree_reject/version.rb b/lib/tree_reject/version.rb new file mode 100644 index 0000000..baf0cbc --- /dev/null +++ b/lib/tree_reject/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module TreeReject + VERSION = '0.1.0' +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..f0a8882 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +$LOAD_PATH.unshift File.expand_path('../lib', __dir__) +require 'tree_reject' diff --git a/spec/tree_reject_spec.rb b/spec/tree_reject_spec.rb new file mode 100644 index 0000000..529c2c7 --- /dev/null +++ b/spec/tree_reject_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +describe TreeReject do + it "has a version number" do + expect(TreeReject::VERSION).not_to be nil + end +end diff --git a/tree_reject.gemspec b/tree_reject.gemspec new file mode 100644 index 0000000..821a668 --- /dev/null +++ b/tree_reject.gemspec @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'tree_reject/version' + +Gem::Specification.new do |spec| + spec.name = 'tree_reject' + spec.version = TreeReject::VERSION + spec.authors = ['Salsify, Inc'] + spec.email = ['engineering@salsify.com'] + + spec.summary = 'Remove deeply nested keys from hash.' + spec.description = spec.summary + spec.homepage = 'https://github.com/salsify/tree_reject' + + spec.license = 'MIT' + + + # Set 'allowed_push_post' to control where this gem can be published. + if spec.respond_to?(:metadata) + spec.metadata['allowed_push_host'] = 'https://rubygems.org' + + else + raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' + end + + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + spec.bindir = 'bin' + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.require_paths = ['lib'] + + spec.required_ruby_version = '>= 2.4' + + spec.add_development_dependency 'bundler', '~> 1.12' + spec.add_development_dependency 'overcommit' + spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'rspec', '~> 3.4' + + spec.add_development_dependency 'salsify_rubocop', '~> 0.60.0' + +end