From b1de04fabbe430df1dbb6823e12978023b625202 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Wed, 15 Nov 2023 19:43:19 +0100 Subject: [PATCH] feat: :sparkles: first commit of basic `bundle gem` setup --- .forgejo/workflows/rubocop.yml | 28 ++++++++++++ .rubocop.yml | 13 ++++++ Gemfile | 14 ++++++ Gemfile.lock | 82 ++++++++++++++++++++++++++++++++++ README.md | 32 ++++++++++++- Rakefile | 16 +++++++ bin/console | 11 +++++ bin/setup | 8 ++++ comfpile.gemspec | 38 ++++++++++++++++ lib/comfpile.rb | 8 ++++ lib/comfpile/version.rb | 5 +++ sig/comfpile.rbs | 4 ++ test/test_comfpile.rb | 13 ++++++ test/test_helper.rb | 6 +++ 14 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 .forgejo/workflows/rubocop.yml create mode 100644 .rubocop.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 comfpile.gemspec create mode 100644 lib/comfpile.rb create mode 100644 lib/comfpile/version.rb create mode 100644 sig/comfpile.rbs create mode 100644 test/test_comfpile.rb create mode 100644 test/test_helper.rb diff --git a/.forgejo/workflows/rubocop.yml b/.forgejo/workflows/rubocop.yml new file mode 100644 index 0000000..f0886f4 --- /dev/null +++ b/.forgejo/workflows/rubocop.yml @@ -0,0 +1,28 @@ +name: RuboCop + +on: [push, pull_request] + +jobs: + build: + runs-on: docker + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby 2.7 + uses: github.com/ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + - name: Cache gems + uses: actions/cache@v1 + with: + path: vendor/bundle + key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-rubocop- + - name: Install gems + run: | + bundle config path vendor/bundle + bundle config set without 'default doc job cable storage ujs test db' + bundle install --jobs 4 --retry 3 + - name: Run RuboCop + run: bundle exec rubocop --parallel \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..e3462a7 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +AllCops: + TargetRubyVersion: 2.6 + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..dcf5796 --- /dev/null +++ b/Gemfile @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in comfpile.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "minitest", "~> 5.0" + +gem "rubocop", "~> 1.21" + +gem "solargraph", "~> 0.49.0" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..af143db --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,82 @@ +PATH + remote: . + specs: + comfpile (0.1.0) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + backport (1.2.0) + benchmark (0.3.0) + diff-lcs (1.5.0) + e2mmap (0.1.0) + jaro_winkler (1.5.6) + json (2.6.3) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + language_server-protocol (3.17.0.3) + minitest (5.20.0) + nokogiri (1.15.4-x86_64-linux) + racc (~> 1.4) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + racc (1.7.3) + rainbow (3.1.1) + rake (13.1.0) + rbs (2.8.4) + regexp_parser (2.8.2) + reverse_markdown (2.1.1) + nokogiri + rexml (3.2.6) + rubocop (1.57.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.2.2.4) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + solargraph (0.49.0) + backport (~> 1.2) + benchmark + bundler (~> 2.0) + diff-lcs (~> 1.4) + e2mmap + jaro_winkler (~> 1.5) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + parser (~> 3.0) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) + thor (~> 1.0) + tilt (~> 2.0) + yard (~> 0.9, >= 0.9.24) + thor (1.3.0) + tilt (2.3.0) + unicode-display_width (2.5.0) + yard (0.9.34) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + comfpile! + minitest (~> 5.0) + rake (~> 13.0) + rubocop (~> 1.21) + solargraph (~> 0.49.0) + +BUNDLED WITH + 2.4.17 diff --git a/README.md b/README.md index 1374d2a..14530af 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ -# comfpile +# Comfpile -Comfortable compiling - in-source defs, no bloat, no mess \ No newline at end of file +TODO: Delete this and the text below, and describe your gem + +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/comfpile`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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 the created tag, 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/[USERNAME]/comfpile. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..21ef734 --- /dev/null +++ b/Rakefile @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rake/testtask" + +Rake::TestTask.new(:test) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["test/**/test_*.rb"] +end + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[test rubocop] diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..9c51cbc --- /dev/null +++ b/bin/console @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "comfpile" + +# 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. + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/comfpile.gemspec b/comfpile.gemspec new file mode 100644 index 0000000..d8df4ce --- /dev/null +++ b/comfpile.gemspec @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require_relative "lib/comfpile/version" + +Gem::Specification.new do |spec| + spec.name = "comfpile" + spec.version = Comfpile::VERSION + spec.authors = ["Xasin, Neira & Mesh"] + spec.email = ["davidbailey.2889@gmail.com"] + + spec.summary = "Comfy Compiling, language agnostic & flexible" + spec.description = "" + spec.homepage = "https://forgejo.lucidragons.de/lucidergs/comfpile" + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["allowed_push_host"] = "https://forgejo.lucidragons.de/" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://forgejo.lucidragons.de/lucidergs/comfpile" + + # 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(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + # Uncomment to register a new dependency of your gem + # spec.add_dependency "example-gem", "~> 1.0" + + # For more information and examples about making a new gem, check out our + # guide at: https://bundler.io/guides/creating_gem.html +end diff --git a/lib/comfpile.rb b/lib/comfpile.rb new file mode 100644 index 0000000..abc2a5f --- /dev/null +++ b/lib/comfpile.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require_relative "comfpile/version" + +module Comfpile + class Error < StandardError; end + # Your code goes here... +end diff --git a/lib/comfpile/version.rb b/lib/comfpile/version.rb new file mode 100644 index 0000000..ba0f811 --- /dev/null +++ b/lib/comfpile/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Comfpile + VERSION = "0.1.0" +end diff --git a/sig/comfpile.rbs b/sig/comfpile.rbs new file mode 100644 index 0000000..9996703 --- /dev/null +++ b/sig/comfpile.rbs @@ -0,0 +1,4 @@ +module Comfpile + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides +end diff --git a/test/test_comfpile.rb b/test/test_comfpile.rb new file mode 100644 index 0000000..f851859 --- /dev/null +++ b/test/test_comfpile.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestComfpile < Minitest::Test + def test_that_it_has_a_version_number + refute_nil ::Comfpile::VERSION + end + + def test_it_does_something_useful + assert false + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..fcf7e7f --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +$LOAD_PATH.unshift File.expand_path("../lib", __dir__) +require "comfpile" + +require "minitest/autorun"