From 7f3ec35e5c71698830d660dcf8ad6dfababf21f6 Mon Sep 17 00:00:00 2001 From: test_user Date: Sat, 14 Nov 2026 22:28:59 -0700 Subject: [PATCH] Initial commit --- .bundle/config | 2 + .gitignore | 110 ++++++++++++++++++++++++++++++++++++++++ .rspec | 2 + .rubocop.yml | 3 ++ Gemfile | 9 ++++ Gemfile.lock | 70 +++++++++++++++++++++++++ README.md | 17 +++++++ Rakefile | 7 +++ lib/assignment.rb | 25 +++++++++ spec/assignment_spec.rb | 14 +++++ spec/spec_helper.rb | 6 +++ 11 files changed, 265 insertions(+) create mode 100644 .bundle/config 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 README.md create mode 100644 Rakefile create mode 100644 lib/assignment.rb create mode 100644 spec/assignment_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..2369228 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_PATH: "vendor/bundle" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ffadab3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,110 @@ +# ---> Emacs +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + +# undo-tree +*.~undo-tree~ + + +# ---> Ruby +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +# Ignore Byebug command history file. +.byebug_history + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +#/.bundle/ # We want to keep this one +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# Used by RuboCop. Remote config files pulled in from inherit_from directive. +# .rubocop-https?--* diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5be63fc --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--require spec_helper +--format documentation diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..6ccabc9 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,3 @@ +plugins: + - rubocop-rake + - rubocop-rspec diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..5c9db95 --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gem 'rake' +gem 'rspec' +gem 'rubocop' +gem 'rubocop-rake' +gem 'rubocop-rspec' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..dc2c7d0 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,70 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.3) + diff-lcs (1.6.2) + json (3.1.0) + language_server-protocol (3.17.0.6) + lint_roller (1.1.0) + parallel (2.3.0) + parser (3.3.13.0) + ast (~> 2.4.1) + racc + prism (2.1.0) + prism (2.1.0-x86_64-linux-gnu) + racc (1.8.1) + rainbow (3.1.1) + rake (13.4.2) + regexp_parser (2.13.1) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.7) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.9) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.8) + rubocop (1.92.2) + json (>= 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (>= 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.11.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.51.0) + parser (>= 3.3.7.2) + prism (>= 1.7) + rubocop-rake (0.7.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-rspec (3.10.2) + lint_roller (~> 1.1) + regexp_parser (>= 2.0) + rubocop (~> 1.86, >= 1.86.2) + ruby-progressbar (1.13.0) + unicode-display_width (3.3.0) + unicode-emoji (~> 4.3) + unicode-emoji (4.3.0) + +PLATFORMS + ruby + x86_64-linux-gnu + +DEPENDENCIES + rake + rspec + rubocop + rubocop-rake + rubocop-rspec + +BUNDLED WITH + 2.6.7 diff --git a/README.md b/README.md new file mode 100644 index 0000000..f74d331 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Project goal + +Write a program that will display the text `Hello World` + +# Instructions + +- Clone this Git repository by opening the link that got you here. Then click + the 'Use this template' button. Then name your repository. You can name it + anything you want but I sugguest something like 'PROG101-assignment-xx' where + xx is the assignment number. Then at the bottom of the page in the 'Template + Items' section check 'Git Content (Default Branch)'. Finally click the + 'Create Repository' button. +- Change dirrectories inxto the folder that you cloned. +- Install required tooling using the command `bundle install`. If bundle is not +available please refer to the help documents in Canvas. +- Complete the assignment, open the `assignment.rb` file in the `lib` folder. +- Modify the `say_text` function to include the line `puts 'Hello World'` diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..2023df4 --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'rubocop/rake_task' +require 'rspec/core/rake_task' + +RuboCop::RakeTask.new +RSpec::Core::RakeTask.new(:spec) diff --git a/lib/assignment.rb b/lib/assignment.rb new file mode 100644 index 0000000..a7f0f61 --- /dev/null +++ b/lib/assignment.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is where you (the student) will solve the homework. This file will +# have many comments and will note where you need to make changes. + +# This is a class, it allows us to use it as an object and will allow our +# testing/grading process to work. This generally will never be changed. +class Assignment + # This is a class function. The `initialize` function is a special one that + # is run whenever an object of the class is created. In this case, we will + # leave this empty as there are no default actions that need to be performed. + def initialize; end + + # This is our main task in this file. For this assignment we need to make the + # text `Hello World` appear on the screen. + def say_text + # Here is where you will change. In Ruby there are several ways to print + # text. In this case, we can use either the `puts` or the `print` + # function. There are slight differences which can be found at + # `https://docs.ruby-lang.org/en/3.3/`. I encourage you to look for these + # two functions and find the documentation. Becoming familar with this site + # will be a great benifit later as you will easily be able to find + # information about Ruby. + end +end diff --git a/spec/assignment_spec.rb b/spec/assignment_spec.rb new file mode 100644 index 0000000..b0ebbe0 --- /dev/null +++ b/spec/assignment_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Nathan Hinton +# Test file for the student's code + +require 'spec_helper' + +RSpec.describe Assignment do + describe '#say_text' do + it 'prints the text `Hello World`' do + expect { described_class.new.say_text }.to output("Hello World\n").to_stdout + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2a4e01e --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +# Nathan Hinton +# Helper file for the testing + +require_relative '../lib/assignment'