diff options
| author | mo khan <mo@mokhan.ca> | 2021-06-05 12:51:28 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-06-05 12:51:28 -0600 |
| commit | ab9eeb30e53ad95d9d1d3a8e538cb9d9a8a478b8 (patch) | |
| tree | 49e9c928ac478e5f4281f87281e51320acbe59c2 | |
initial commit
| -rw-r--r-- | .github/workflows/ci.yml | 24 | ||||
| -rw-r--r-- | .gitignore | 11 | ||||
| -rw-r--r-- | .rspec | 3 | ||||
| -rw-r--r-- | .rubocop.yml | 60 | ||||
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | Gemfile | 9 | ||||
| -rw-r--r-- | Gemfile.lock | 55 | ||||
| -rw-r--r-- | LICENSE.txt | 21 | ||||
| -rw-r--r-- | README.md | 28 | ||||
| -rw-r--r-- | Rakefile | 10 | ||||
| -rwxr-xr-x | bin/console | 8 | ||||
| -rwxr-xr-x | bin/setup | 7 | ||||
| -rwxr-xr-x | bin/style | 7 | ||||
| -rwxr-xr-x | bin/test | 7 | ||||
| -rwxr-xr-x | exe/hcl2 | 4 | ||||
| -rw-r--r-- | hcl2.gemspec | 29 | ||||
| -rw-r--r-- | lib/hcl2.rb | 7 | ||||
| -rw-r--r-- | lib/hcl2/version.rb | 5 | ||||
| -rw-r--r-- | spec/hcl2_spec.rb | 5 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 12 |
20 files changed, 317 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..368f3de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: ci +on: [push,pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + ruby: ['2.6', '2.7', '3.0'] + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: ./bin/test + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - run: ./bin/style 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 @@ -0,0 +1,3 @@ +--format progress +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..c8bfd56 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,60 @@ +AllCops: + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 2.6 + +Layout/ArgumentAlignment: + EnforcedStyle: with_fixed_indentation + +Layout/ParameterAlignment: + EnforcedStyle: with_fixed_indentation + IndentationWidth: 2 + +Layout/EndOfLine: + EnforcedStyle: lf + +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: indented + +Lint/AmbiguousBlockAssociation: + Exclude: + - 'spec/**/*.rb' + + +Metrics/BlockLength: + Exclude: + - '*.gemspec' + - 'Rakefile' + - 'spec/**/*.rb' + +Metrics/ModuleLength: + Exclude: + - 'spec/**/*.rb' + +Layout/LineLength: + IgnoredPatterns: + - '^#*' + +Naming/RescuedExceptionsVariableName: + PreferredName: error + +Style/Documentation: + Enabled: false + +Style/StringLiterals: + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +Style/TrailingCommaInArrayLiteral: + Enabled: false + +Style/TrailingCommaInHashLiteral: + Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b3a2cf1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2021-06-05 + +- Initial release @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec + +gem "rake", "~> 13.0" +gem "rspec", "~> 3.0" +gem "rubocop", "~> 1.7" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..4d1aefd --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,55 @@ +PATH + remote: . + specs: + hcl2 (0.1.0) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + diff-lcs (1.4.4) + parallel (1.20.1) + parser (3.0.1.1) + ast (~> 2.4.1) + rainbow (3.0.0) + rake (13.0.3) + regexp_parser (2.1.1) + rexml (3.2.5) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-support (3.10.2) + rubocop (1.16.0) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.7.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.7.0) + parser (>= 3.0.1.1) + ruby-progressbar (1.11.0) + unicode-display_width (2.0.0) + +PLATFORMS + x86_64-darwin-20 + +DEPENDENCIES + hcl2! + rake (~> 13.0) + rspec (~> 3.0) + rubocop (~> 1.7) + +BUNDLED WITH + 2.2.19 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d425916 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 mo khan + +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..709bc39 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# HCL2 + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'hcl2' +``` + +And then execute: + + $ bundle install + +Or install it yourself as: + + $ gem install hcl2 + +## Development + +After checking out the repo, run `./bin/setup` to install dependencies. +Then, run `./bin/test` to run the tests. + +## License + +The gem is available as open source under the terms of the [MIT License][mit]. + +[mit]: https://opensource.org/licenses/MIT diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..d9b6e5e --- /dev/null +++ b/Rakefile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" +require "rubocop/rake_task" + +RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..90659e7 --- /dev/null +++ b/bin/console @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "hcl2" + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..facbcce --- /dev/null +++ b/bin/setup @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +cd "$(dirname "$0")/.." + +bundle install diff --git a/bin/style b/bin/style new file mode 100755 index 0000000..84c1e00 --- /dev/null +++ b/bin/style @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +cd "$(dirname "$0")/.." + +bundle exec rubocop "$@" diff --git a/bin/test b/bin/test new file mode 100755 index 0000000..b94afd3 --- /dev/null +++ b/bin/test @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +cd "$(dirname "$0")/.." + +bundle exec rspec "$@" diff --git a/exe/hcl2 b/exe/hcl2 new file mode 100755 index 0000000..4540c41 --- /dev/null +++ b/exe/hcl2 @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "hcl2" diff --git a/hcl2.gemspec b/hcl2.gemspec new file mode 100644 index 0000000..e8c5c70 --- /dev/null +++ b/hcl2.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative "lib/hcl2/version" + +Gem::Specification.new do |spec| + spec.name = "hcl2" + spec.version = Hcl2::VERSION + spec.authors = ["mo khan"] + spec.email = ["mo@mokhan.ca"] + + spec.summary = "A HCL v2 parser." + spec.description = "A HCL v2 parser." + spec.homepage = "https://github.com/xlgmokha/hcl2" + spec.license = "MIT" + spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0") + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://github.com/xlgmokha/hcl2" + spec.metadata["changelog_uri"] = "https://github.com/xlgmokha/hcl2/blob/main/CHANGELOG.md" + + spec.files = Dir.chdir(File.expand_path(__dir__)) do + Dir.glob("exe/*") + + Dir.glob("lib/**/**/*.{rb}") + + Dir.glob("*.{md,gemspec,txt}") + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] +end diff --git a/lib/hcl2.rb b/lib/hcl2.rb new file mode 100644 index 0000000..fa7b2e7 --- /dev/null +++ b/lib/hcl2.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require_relative "hcl2/version" + +module Hcl2 + class Error < StandardError; end +end diff --git a/lib/hcl2/version.rb b/lib/hcl2/version.rb new file mode 100644 index 0000000..4b261a2 --- /dev/null +++ b/lib/hcl2/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Hcl2 + VERSION = "0.1.0" +end diff --git a/spec/hcl2_spec.rb b/spec/hcl2_spec.rb new file mode 100644 index 0000000..a08b6fd --- /dev/null +++ b/spec/hcl2_spec.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +RSpec.describe Hcl2 do + specify { expect(Hcl2::VERSION).not_to be nil } +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2cd21bf --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "hcl2" + +RSpec.configure do |config| + config.example_status_persistence_file_path = ".rspec_status" + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end |
