From 9fa9e7332efa7d1ec304b4ac36602a3914617e31 Mon Sep 17 00:00:00 2001 From: Maxwell Creamer Date: Wed, 24 Apr 2024 09:40:02 -0700 Subject: [PATCH] run bundle gem . --- .gitignore | 18 ++-- .rspec | 3 + .rubocop.yml | 13 +++ Gemfile | 12 +++ README.md | 146 +++-------------------------- Rakefile | 12 +++ acts_as_versionable.gemspec | 38 ++++++++ bin/console | 15 +++ bin/setup | 8 ++ lib/acts_as_versionable.rb | 8 ++ lib/acts_as_versionable/version.rb | 5 + sig/acts_as_versionable.rbs | 4 + spec/acts_as_versionable_spec.rb | 11 +++ spec/spec_helper.rb | 15 +++ 14 files changed, 169 insertions(+), 139 deletions(-) create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 acts_as_versionable.gemspec create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 lib/acts_as_versionable.rb create mode 100644 lib/acts_as_versionable/version.rb create mode 100644 sig/acts_as_versionable.rbs create mode 100644 spec/acts_as_versionable_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index d5eb30e..b04a8c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ \ No newline at end of file +# 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..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..a326c5b --- /dev/null +++ b/Gemfile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in acts_as_versionable.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "rspec", "~> 3.0" + +gem "rubocop", "~> 1.21" diff --git a/README.md b/README.md index db5e2a2..7a6aed3 100644 --- a/README.md +++ b/README.md @@ -1,145 +1,29 @@ -# Example README +# ActsAsVersionable -This is an example of what we expect in a README. +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/acts_as_versionable`. To experiment with that code, run `bin/console` for an interactive prompt. -## What? +TODO: Delete this and the text above, and describe your gem -A summary of the purpose of this piece of software, for example: -Delivery of Learnosity assessments to students and reporting student results to teachers. +## Installation -### Diagram +Install the gem and add to the application's Gemfile by executing: -A diagram showing all of the following: + $ bundle add acts_as_versionable -* project inputs -* projects end users -* project outputs -* project data stores +If bundler is not being used to manage dependencies, install the gem by executing: -([see mermaid documentation on how to create these diagrams](https://mermaid-js.github.io/mermaid/#/./flowchart?id=flowcharts-basic-syntax)) + $ gem install acts_as_versionable -For example: +## Usage -```mermaid -graph LR - subgraph project_components[Hypothetical Service] +TODO: Write usage instructions here - project_api[Hypothetical Service API] - project_frontend[Hypothetical Service Frontend] - subgraph datastores[Data Stores] - postgres[PostgreSQL] - queue[SQS queue service] - end - end +## Development - subgraph inputs[Inputs] - event_platform_input[Event Platform] - cloud_canvas[Cloud Canvas API] - identity[Identity Server] - end +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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). - subgraph end_users[End Users] - student[Student] - administrator[Administrator] - end +## Contributing - subgraph outputs[Outputs] - event_platform_out[Event Platform] - end - - event_platform_input -->|Canvas Change Events| project_api - cloud_canvas -->|Canvas User API get| project_api - identity -->|Authentication of users| project_frontend - - project_frontend -->|Views a thing| student - administrator -->|Creates things| project_frontend - - project_api -->|Sends create and view messages| event_platform_out - -``` - -## Where? - -### Links - -A list of links to deployed software -For example: - -* stage: [stage-project.strongmind.com](https://stage-project.strongmind.com) -* prod: [project.strongmind.com](https://project.strongmind.com) - -### CI/CD - -A link to CI/CD for this repository -For example: - -* [https://github.com/StrongMind/project/actions](https://github.com/StrongMind/project/actions) - -### Administration - -A list of links to operational information, for example: - -* [Logs](https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logsV2:logs-insights$3FqueryDetail$%5B%E2%80%A6%5D*2flambda*2fid-mapper-prod$2529$2529) -* [Exception Tracking](https://sentry.io/organizations/strongmind-4j/projects/id-mapper/?project=6262579) -* [Monitoring & Metrics Dashboard](https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#dashboards:name=identifier-mapper-prod) - -## Local Install - -A set of comprehensive instructions to install from scratch on a developer workstation. We suggest you test these with a member from another team. For example: - -### Mac - -In this source directory: - -1. Install homebrew -1. Install python 3.10 using homebrew `brew install python@3.10` -1. Install virtualenv and virtualenvwrapper `pip install virtualenv virtualenvwrapper` -1. Create virtual environment for project `mkvirtualenv project_name -p /opt/homebrew/opt/python@3.10/bin/python3` -1. Install project requirements `pip install -r requirements.txt` - -#### Known Issues and Fixes - -If your system python does not include pip, you will need to make sure pip is installed : - -```console -python -m ensurepip # if your system python is at least 3.4 -``` - -If your system python isn't at least 3.4, you will need to use your system package manager to install pip. - -### Windows - -In this source directory: - -1. [Install python](https://www.python.org/downloads/release/python-3105/) -1. Open project in pycharm -1. Set interpreter installed python 3.10 -1. Open shell -1. Install project requirements `pip install -r requirements.txt` - -## Run tests locally - -A set of instructions to run tests locally, for example: - -```console -pytest -``` - -## Run service locally - -A set of instructions to run service locally, for example: - -### Mac (service) - -```console -python manage.py runserver -``` - -### Windows (service) - -```console -py manage.py runserver -``` - -> Code owners can be found in [CODEOWNERS file](./CODEOWNERS) +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/acts_as_versionable. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..cca7175 --- /dev/null +++ b/Rakefile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/acts_as_versionable.gemspec b/acts_as_versionable.gemspec new file mode 100644 index 0000000..ffe1b8d --- /dev/null +++ b/acts_as_versionable.gemspec @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require_relative "lib/acts_as_versionable/version" + +Gem::Specification.new do |spec| + spec.name = "acts_as_versionable" + spec.version = ActsAsVersionable::VERSION + spec.authors = ["Maxwell Creamer"] + spec.email = ["maxwell.creamer@strongmind.com"] + + spec.summary = "TODO: Write a short summary, because RubyGems requires one." + spec.description = "TODO: Write a longer description or delete this line." + spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." + spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + + # 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| + (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}) + 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/bin/console b/bin/console new file mode 100755 index 0000000..ee00d51 --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "acts_as_versionable" + +# 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(__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/lib/acts_as_versionable.rb b/lib/acts_as_versionable.rb new file mode 100644 index 0000000..9fc324f --- /dev/null +++ b/lib/acts_as_versionable.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require_relative "acts_as_versionable/version" + +module ActsAsVersionable + class Error < StandardError; end + # Your code goes here... +end diff --git a/lib/acts_as_versionable/version.rb b/lib/acts_as_versionable/version.rb new file mode 100644 index 0000000..461e615 --- /dev/null +++ b/lib/acts_as_versionable/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module ActsAsVersionable + VERSION = "0.1.0" +end diff --git a/sig/acts_as_versionable.rbs b/sig/acts_as_versionable.rbs new file mode 100644 index 0000000..d0e856d --- /dev/null +++ b/sig/acts_as_versionable.rbs @@ -0,0 +1,4 @@ +module ActsAsVersionable + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides +end diff --git a/spec/acts_as_versionable_spec.rb b/spec/acts_as_versionable_spec.rb new file mode 100644 index 0000000..f399767 --- /dev/null +++ b/spec/acts_as_versionable_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe ActsAsVersionable do + it "has a version number" do + expect(ActsAsVersionable::VERSION).not_to be nil + end + + it "does something useful" do + expect(false).to eq(true) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..0c2c94e --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "acts_as_versionable" + +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