toberead 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1cf4a0ee4acdf5e66a8ae444c90fa4c22fbced6a9842e796520577cdc5156ea6
4
+ data.tar.gz: c2caa689ef14600f9fd22ee831319c80666b04d6047509658dff932c54b9442e
5
+ SHA512:
6
+ metadata.gz: 94ae9c12d2dd766ba9204212b900e9d9c4752906436a05bd1e0239aedd80b8377af446337dc57cb65e0b82359d582459db7566a70514266ea9515d103bd90989
7
+ data.tar.gz: a83a0f41335c1b52617eba960db33a19cd3aa9846bda905c4628674c94cda716a8449c097b2291799a581870dc0281ad0b541420611e8eb13870ab12d306a16b
data/.gitignore ADDED
@@ -0,0 +1,70 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
57
+
58
+ Gemfile.lock
59
+
60
+ /.bundle/
61
+ /.yardoc
62
+ /_yardoc/
63
+ /coverage/
64
+ /doc/
65
+ /pkg/
66
+ /spec/reports/
67
+ /tmp/
68
+
69
+ # rspec failure tracking
70
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0.2
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.2
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 3.0.2
6
+ before_install: gem install bundler -v 2.2.22
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "rake", "~> 13.0"
8
+
9
+ gem "rspec", "~> 3.0"
10
+
11
+ gem "rubocop", "~> 1.7"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 ChronoSerrano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # ToBeRead
2
+
3
+ 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/toberead`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'toberead'
13
+ ```
14
+
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install toberead
23
+
24
+ ## Usage
25
+
26
+ TODO: Write usage instructions here
27
+
28
+ ## Development
29
+
30
+ 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.
31
+
32
+ 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).
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/toberead.
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "toberead"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/tbr ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "titleize"
5
+ require "erb"
6
+ require "yaml"
7
+ require "toberead"
8
+
9
+ prompts = ToBeRead::Deck.new("prompts")
10
+ answers = ToBeRead::Deck.new("answers")
11
+ puts [prompts.shuffle, answers.shuffle].join(": ")
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ToBeRead
4
+ class Deck
5
+ def initialize(deck_type)
6
+ @deck = ERB.new(
7
+ File.read(
8
+ File.join(ToBeRead.template_dir, "#{deck_type}.erb")
9
+ )
10
+ ).result(binding).split("\n")
11
+ end
12
+
13
+ def shuffle
14
+ @deck.sample.downcase.titleize
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ToBeRead
4
+ class Property
5
+ class << self
6
+ def select(property)
7
+ properties = YAML.safe_load(load_template)
8
+ abort("Unknown property: #{property}") unless properties.key? property.to_s
9
+ properties[property.to_s].sample
10
+ end
11
+
12
+ private
13
+
14
+ def load_template
15
+ @load_template ||= ERB.new(
16
+ File.read(
17
+ File.join(ToBeRead.template_dir, "properties.yaml.erb")
18
+ )
19
+ ).result(binding)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,48 @@
1
+ IS A 5 STAR PREDICTION.
2
+ OWNED FOR THE LONGEST TIME.
3
+ HAS SOMETHING SHINY ON IT.
4
+ FOR THE COVER.
5
+ IS OUTSIDE MY USUAL COMFORT ZONE.
6
+ HAS THE <%=Property.select(:most_least)%> AMOUNT OF PAGES OF ALL THE ONES ON MY T.B.R.
7
+ IS A SEQUEL TO A BOOK I’VE READ.
8
+ STARTS WITH THE LETTER... <%=Property.select(:letter)%>.
9
+ HAS AN AUTHOR WHOSE <%=Property.select(:first_last)%> NAME STARTS WITH THE LETTER... <%=Property.select(:letter)%>.
10
+ HAS/IS A <%=Property.select(:author_type)%> AUTHOR.
11
+ IS A BOOK CLUB PICK.
12
+ IS CONSIDERED A CLASSIC.
13
+ I DO NOT OWN PHYSICALLY YET.
14
+ HAS A TITLE OF <%=Property.select(:title_word_count)%> WORD(S).
15
+ I PICK AT RANDOM FROM MY GOODREADS T.B.R. LIST.
16
+ I ASK A FRIEND TO PICK OUT OF 5.
17
+ WITHOUT KNOWING MUCH ABOUT THE STORY.
18
+ I PICK AT RANDOM FROM MY PHYSICAL BOOKSHELVES (RANDOMIZED NUMBER).
19
+ I REALLY WANT TO READ RIGHT NOW.
20
+ I’M MOST EXCITED TO READ THIS MONTH.
21
+ HAS <%=Property.select(:color)%> ON IT.
22
+ IS THE <%=Property.select(:old_new)%> ON MY T.B.R.
23
+ IS THE <%=Property.select(:high_low)%> RATED ON MY T.B.R.
24
+ IS SET IN THE <%=Property.select(:past_future)%>.
25
+ I ALMOST GOT RID OF.
26
+ I WILL SWAP FOR UNHAULING ONE BOOK (ONE IN, ONE OUT).
27
+ IS THE SAME AS / SIMILAR TO THE LAST ONE I READ.
28
+ IS A GUILTY PLEASURE (RE- READ, HISTORICAL ROMANCE, EASY/ FAST READ).
29
+ MATCHES MY OUTFIT.
30
+ I THINK A FRIEND WOULD ENJOY.
31
+ I’VE READ BEFORE.
32
+ OUT OF FEAR OF MISSING OUT.
33
+ WAS INSPIRED BY A <%=Property.select(:source)%> recommendation.
34
+ STARTS WITH ONE OF MY INITIALS.
35
+ IS ILLUSTRATED.
36
+ IS TYPOGRAPHIC.
37
+ IS PHOTOGRAPHIC.
38
+ BOUGHT LAST.
39
+ IS THE FIRST OF A NEW SERIES.
40
+ WITH A FRIEND.
41
+ HAS A <%=Property.select(:setting)%> setting.
42
+ HAS A <%=Property.select(:trope)%> trope.
43
+ Is <%=Property.select(:length)%> pages long.
44
+ Has a publication Year of <%=Property.select(:year)%>.
45
+ Was obtained <%=Property.select(:year)%>.
46
+ has a/an <%=Property.select(:on_the_cover)%> on the cover.
47
+ has <%=Property.select(:representation)%> representation.
48
+ is about/includes <%=Property.select(:topic)%>.
@@ -0,0 +1,6 @@
1
+ A BOOK THAT/WHICH
2
+ A <%= Property.select(:genre) %> NOVEL THAT/WHICH
3
+ A <%= Property.select(:item_type) %> THAT/WHICH
4
+ A GENRE THAT/WHICH
5
+ AN AUTHOR WHO/THAT
6
+ A BOOK I BOUGHT
@@ -0,0 +1,56 @@
1
+ ---
2
+ letter: <%= ('A'..'Z').to_a %>
3
+ color:
4
+ - red
5
+ - yellow
6
+ - blue
7
+ - brown
8
+ - orange
9
+ - green
10
+ - black
11
+ - pink
12
+ - white
13
+ - gray
14
+ - purple
15
+ high_low: ['highest', 'lowest']
16
+ old_new: ['oldest', 'newest']
17
+ most_least: ['most', 'least']
18
+ past_future: ['past', 'future']
19
+ genre:
20
+ - romance
21
+ - fantasy
22
+ - contemporary
23
+ - adult
24
+ - nonfiction
25
+ - thriller
26
+ - horror
27
+ - rom-com
28
+ - mystery
29
+ - self-help
30
+ - adaptation
31
+ - poetry
32
+ - revenge
33
+ - indie
34
+ - mythology
35
+ - dystopian
36
+ - sapphic romance
37
+ - adult fantasy
38
+ - childrens classic
39
+ - young adult
40
+ - middle grade
41
+ - science fiction
42
+ - historical fiction
43
+ - graphic novel
44
+ item_type: ["story", "book", "cover", "novella"]
45
+ first_last: ["first", "last"]
46
+ author_type: ["new", "favorite", "asian", "black", "female", "LGBTQ+", "new to you"]
47
+ title_word_count: ["one", "two", "three", "4+"]
48
+ source: ["bookstagram", "booktube", "twitter", "goodreads"]
49
+ setting: ["North America", "South America", "Europe", "Asia", "Africa", "Australia", "Sea"]
50
+ trope: ["enemies to lovers", "animal sidekick", "friends to lovers", "marriage of convenience"]
51
+ length: ["<300", "300-400", "400-500", "500-600", "600+"]
52
+ year: <%= (["Before 2015"] << (2016..2021).to_a).flatten! %>
53
+ on_the_cover: ["person", "animal", "weapon", "hand", "bird", "nature", "water"]
54
+ representation: ["POC", "LGBTQ+", "Disability", "Asian", "Female", "Black"]
55
+ topic: ["cooking", "travel", "music"]
56
+ format: ["paperback", "hardcover", "audiobook", "ebook"]
data/lib/toberead.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "toberead/decks"
4
+ require_relative "toberead/properties"
5
+
6
+ module ToBeRead
7
+ VERSION = "0.1.0"
8
+
9
+ class Error < StandardError; end
10
+
11
+ class << self
12
+ attr_reader :template_dir
13
+
14
+ def template_dir = File.join(__dir__, "toberead", "templates")
15
+ end
16
+ end
data/toberead.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/toberead"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "toberead"
7
+ spec.version = ToBeRead::VERSION
8
+ spec.authors = ["ChronoSerrano"]
9
+ spec.email = ["619512+ChronoSerrano@users.noreply.github.com"]
10
+
11
+ spec.summary = "Write a short summary, because RubyGems requires one."
12
+ spec.description = "Write a longer description or delete this line."
13
+ spec.homepage = "https://github.com/chronoserrano/toberead"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.0.2"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://rubygems.org/toberead"
21
+ spec.metadata["changelog_uri"] = "https://github.com/chronoserrano/toberead/changelog.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "bin"
29
+ spec.executables = ["tbr"]
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ spec.add_dependency "titleize", "~> 1.4"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: toberead
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ChronoSerrano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: titleize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ description: Write a longer description or delete this line.
28
+ email:
29
+ - 619512+ChronoSerrano@users.noreply.github.com
30
+ executables:
31
+ - tbr
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - ".rubocop.yml"
38
+ - ".ruby-version"
39
+ - ".travis.yml"
40
+ - Gemfile
41
+ - LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - bin/console
45
+ - bin/setup
46
+ - bin/tbr
47
+ - lib/toberead.rb
48
+ - lib/toberead/decks.rb
49
+ - lib/toberead/properties.rb
50
+ - lib/toberead/templates/answers.erb
51
+ - lib/toberead/templates/prompts.erb
52
+ - lib/toberead/templates/properties.yaml.erb
53
+ - toberead.gemspec
54
+ homepage: https://github.com/chronoserrano/toberead
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ allowed_push_host: https://rubygems.org
59
+ homepage_uri: https://github.com/chronoserrano/toberead
60
+ source_code_uri: https://rubygems.org/toberead
61
+ changelog_uri: https://github.com/chronoserrano/toberead/changelog.md
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 3.0.2
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubygems_version: 3.2.22
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Write a short summary, because RubyGems requires one.
81
+ test_files: []