reading_list 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d886c933b4128065d8475b2b013b6d92b5ec77e9
4
+ data.tar.gz: c0f356cec9444ed3be8f526ce6d0ce923b1c0d08
5
+ SHA512:
6
+ metadata.gz: 7bb7592b7b473db1f0508f25562394bcabd1b0911d599ead6fd58c7090ca4aafee89f4b4778401007bf1a63c6dbefc21fa78c09485e8c1666de597f352e4d654
7
+ data.tar.gz: 69c44b75c2978b017161d1d607fa5786c7aedcac72acb60def4eb21af300e7344bb11bfabd5c9f4cc78e71ce88fe0dbe9ca86d93a219db31cd18cf47dff7e056
@@ -0,0 +1,52 @@
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
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ .sass-cache/
@@ -0,0 +1,7 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/Documentation:
4
+ Enabled: false
5
+
6
+ Style/FrozenStringLiteralComment:
7
+ Enabled: false
@@ -0,0 +1,39 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-04-01 21:01:15 -0700 using RuboCop version 0.47.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Metrics/AbcSize:
11
+ Max: 29
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments, ExcludedMethods.
15
+ Metrics/BlockLength:
16
+ Max: 37
17
+
18
+ # Offense count: 1
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 39
22
+
23
+ # Offense count: 11
24
+ # Cop supports --auto-correct.
25
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
26
+ # SupportedStyles: when_needed, always, never
27
+ Style/FrozenStringLiteralComment:
28
+ Exclude:
29
+ - 'spec/factories/book_factory_spec.rb'
30
+ - 'spec/factories/configuration_factory_spec.rb'
31
+ - 'spec/factories/template_factory_spec.rb'
32
+ - 'spec/ioc_container_spec.rb'
33
+ - 'spec/list_writer_spec.rb'
34
+ - 'spec/models/book_spec.rb'
35
+ - 'spec/models/configuration_spec.rb'
36
+ - 'spec/renderers/list_renderer_spec.rb'
37
+ - 'spec/repositories/book_repository_spec.rb'
38
+ - 'spec/resources/test_constants.rb'
39
+ - 'spec/spec_helper.rb'
@@ -0,0 +1 @@
1
+ 2.4.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in reading-list.gemspec
4
+ gemspec
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ reading_list (0.1.0)
5
+ codependent (~> 0.4)
6
+ mustache (~> 1.0)
7
+ trollop (~> 2.1, >= 2.1.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.3.0)
13
+ byebug (9.0.6)
14
+ codependent (0.4)
15
+ coderay (1.1.1)
16
+ diff-lcs (1.3)
17
+ docile (1.1.5)
18
+ json (2.0.3)
19
+ method_source (0.8.2)
20
+ mustache (1.0.3)
21
+ parser (2.4.0.0)
22
+ ast (~> 2.2)
23
+ powerpack (0.1.1)
24
+ pry (0.10.4)
25
+ coderay (~> 1.1.0)
26
+ method_source (~> 0.8.1)
27
+ slop (~> 3.4)
28
+ pry-byebug (3.4.2)
29
+ byebug (~> 9.0)
30
+ pry (~> 0.10)
31
+ rainbow (2.2.1)
32
+ rake (10.5.0)
33
+ rspec (3.5.0)
34
+ rspec-core (~> 3.5.0)
35
+ rspec-expectations (~> 3.5.0)
36
+ rspec-mocks (~> 3.5.0)
37
+ rspec-core (3.5.4)
38
+ rspec-support (~> 3.5.0)
39
+ rspec-expectations (3.5.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.5.0)
42
+ rspec-mocks (3.5.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.5.0)
45
+ rspec-support (3.5.0)
46
+ rubocop (0.47.1)
47
+ parser (>= 2.3.3.1, < 3.0)
48
+ powerpack (~> 0.1)
49
+ rainbow (>= 1.99.1, < 3.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (~> 1.0, >= 1.0.1)
52
+ ruby-progressbar (1.8.1)
53
+ sass (3.4.23)
54
+ simplecov (0.13.0)
55
+ docile (~> 1.1.0)
56
+ json (>= 1.8, < 3)
57
+ simplecov-html (~> 0.10.0)
58
+ simplecov-html (0.10.0)
59
+ slop (3.6.0)
60
+ trollop (2.1.2)
61
+ unicode-display_width (1.1.3)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ bundler (~> 1.13)
68
+ pry
69
+ pry-byebug
70
+ rake (~> 10.0)
71
+ reading_list!
72
+ rspec (~> 3.0)
73
+ rubocop (~> 0.47.1)
74
+ sass
75
+ simplecov
76
+
77
+ BUNDLED WITH
78
+ 1.14.6
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Joshua Tompkins
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ # reading_list
2
+
3
+ A static site generator for your reading list.
4
+
5
+ ## Installation
6
+
7
+ `$ gem install reading_list`
8
+
9
+ ## Usage
10
+
11
+ To generate your reading list website, you'll need two files: a YAML `config` file and a JSON `book` file.
12
+
13
+ ### The Config file
14
+
15
+ The basic structure of the config file looks like this:
16
+
17
+ ```
18
+ name: YOUR_NAME
19
+ email: YOUR_EMAIL
20
+
21
+ book_file: PATH_TO_BOOK_FILE
22
+
23
+ output:
24
+ dir: OUTPUT_DIRECTORY
25
+ theme: default
26
+ ```
27
+
28
+ | Key | Value |
29
+ | --- | ----- |
30
+ | `name` | Your name. Displayed in the header of the generated site. |
31
+ | `email` | _(Currently unused)_ Your email address. |
32
+ | `website` | _(Currently unused)_ Your website. |
33
+ | `book_file` | The _relative_ path to your `book` file. |
34
+ | `output/dir` | The _relative_ path to the output directory. The generated HTML and CSS files will be written there. **Caution**: Any existing HTML and CSS output will be overwritten. |
35
+ | `output/theme` | The name of the theme for your site. The only supported value (at least for now) is `default`. |
36
+
37
+ All of the values are required.
38
+
39
+ ### The Book file
40
+
41
+ The book file is a JSON file containing an array of JSON objects. The structure looks like this:
42
+
43
+ ```
44
+ [
45
+ {
46
+ "title": "The Lion, the Witch, and the Wardrobe",
47
+ "author": "C. S. Lewis",
48
+ "year": 2017,
49
+ "link": "https://www.amazon.com/Lion-Witch-Wardrobe-Chronicles-Narnia/dp/0064404994/"
50
+ },
51
+
52
+ {
53
+ // etc
54
+ }
55
+ ]
56
+ ```
57
+
58
+ | Key | Type | Value |
59
+ | --- | ---- | ----- |
60
+ | `title` | `string` | The title of the book |
61
+ | `author` | `string` | The author of the book |
62
+ | `year` | `int` | The year you _read_ the book (**not** the year it was published) |
63
+ | `link` | `string` | _(Optional)_ A link to the book's website or Amazon page. If provided, the book's title will be a link to this URL in the output. |
64
+
65
+ ### Running the generator
66
+
67
+ To generate your site, run the following command, passing in the relative path to your config file:
68
+
69
+ `reading_list -c [CONFIG_FILE]`
70
+
71
+ Run `reading_list -h` for help.
72
+
73
+ ### Sample output
74
+
75
+ See [reading.joshtompkins.com](http://reading.joshtompkins.com) for a sample site running the `default` theme.
76
+
77
+ ## Development
78
+
79
+ 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.
80
+
81
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
82
+
83
+ ## Contributing
84
+
85
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jtompkins/reading_list.
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RuboCop::RakeTask.new
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task ci: [:spec, :rubocop]
9
+
10
+ task :compile_sass do
11
+ theme_root = File.join('lib', 'reading_list', 'resources', 'themes')
12
+ bin_root = File.join(theme_root, 'bin')
13
+
14
+ Dir.mkdir(bin_root) unless Dir.exist?(bin_root)
15
+
16
+ Dir.glob(File.join(theme_root, '*.scss')) do |file|
17
+ f = File.basename(file).gsub('.scss', '.css')
18
+
19
+ `sass --sourcemap=none #{file} #{File.join(bin_root, f)}`
20
+ end
21
+ end
22
+
23
+ task default: :ci
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'reading_list'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require 'pry'
11
+ Pry.start
12
+
13
+ # require 'irb'
14
+ # IRB.start
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'trollop'
4
+ require 'reading_list'
5
+
6
+ opts = Trollop.options do
7
+ version "v#{ReadingList::VERSION}"
8
+
9
+ opt :config_file, 'Path to config file', default: '~/.reading_list.yml'
10
+ end
11
+
12
+ unless File.exist?(File.expand_path(opts[:config_file]))
13
+ Trollop.die :config_file, 'must exist'
14
+ end
15
+
16
+ ReadingList::App.new(opts[:config_file]).run
@@ -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
@@ -0,0 +1,42 @@
1
+ require 'reading_list/version'
2
+ require 'reading_list/models/configuration'
3
+ require 'reading_list/models/book'
4
+ require 'reading_list/factories/book_factory'
5
+ require 'reading_list/factories/configuration_factory'
6
+ require 'reading_list/factories/template_factory'
7
+ require 'reading_list/repositories/book_repository'
8
+ require 'reading_list/renderers/list_renderer'
9
+ require 'reading_list/ioc_container'
10
+ require 'reading_list/list_writer'
11
+
12
+ module ReadingList
13
+ class App
14
+ def initialize(config_file)
15
+ @container = IocContainer.new(config_file).container
16
+ end
17
+
18
+ attr_reader :container
19
+
20
+ def run
21
+ config = container.resolve(:configuration)
22
+
23
+ output = render_template(config)
24
+
25
+ write_template(config, output)
26
+ end
27
+
28
+ private
29
+
30
+ def render_template(config)
31
+ books = container.resolve(:book_repository).books
32
+ renderer = container.resolve(:list_renderer)
33
+
34
+ renderer.render(config, books)
35
+ end
36
+
37
+ def write_template(config, rendered_text)
38
+ writer = container.resolve(:list_writer)
39
+ writer.write(config, rendered_text)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ require 'reading_list/models/book'
2
+
3
+ module ReadingList
4
+ class BookFactory
5
+ def from_json(json_hash)
6
+ Book.new(json_hash)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ require 'yaml'
2
+ require 'reading_list/models/configuration'
3
+
4
+ module ReadingList
5
+ class ConfigurationFactory
6
+ def initialize(config_file:)
7
+ @config_file = config_file
8
+ end
9
+
10
+ def config
11
+ yaml_text = IO.read(File.expand_path(@config_file))
12
+ yaml_hash = YAML.safe_load(yaml_text)
13
+ Configuration.new(yaml_hash)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module ReadingList
2
+ class TemplateFactory
3
+ def load(template)
4
+ IO.read(File.expand_path("../resources/templates/#{template}", __dir__))
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,69 @@
1
+ require 'codependent'
2
+
3
+ module ReadingList
4
+ class IocContainer
5
+ def initialize(config_file)
6
+ @config_file = config_file
7
+ end
8
+
9
+ def container
10
+ @container ||= build_container
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :config_file
16
+
17
+ def build_container
18
+ Codependent::Container.new(config_file) do |config_file|
19
+ singleton :config_file do
20
+ from_value config_file
21
+ end
22
+
23
+ singleton :book_factory do
24
+ from_type ReadingList::BookFactory
25
+ end
26
+
27
+ singleton :configuration_factory do
28
+ from_type ReadingList::ConfigurationFactory
29
+ depends_on :config_file
30
+ end
31
+
32
+ singleton :configuration do
33
+ from_provider do |deps|
34
+ deps[:configuration_factory].config
35
+ end
36
+
37
+ depends_on :configuration_factory
38
+ end
39
+
40
+ singleton :template_factory do
41
+ from_type ReadingList::TemplateFactory
42
+ end
43
+
44
+ singleton :list_writer do
45
+ from_type ReadingList::ListWriter
46
+ end
47
+
48
+ instance :book_repository do
49
+ from_provider do |deps|
50
+ config = deps[:configuration]
51
+ book_factory = deps[:book_factory]
52
+
53
+ ReadingList::BookRepository.new(
54
+ json_file: config.book_file,
55
+ book_factory: book_factory
56
+ )
57
+ end
58
+
59
+ depends_on :configuration, :book_factory
60
+ end
61
+
62
+ instance :list_renderer do
63
+ from_type ReadingList::ListRenderer
64
+ depends_on :template_factory
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,32 @@
1
+ require 'fileutils'
2
+
3
+ module ReadingList
4
+ class ListWriter
5
+ def write(config, rendered_text)
6
+ make_output_directory!(config)
7
+ copy_style_sheet!(config)
8
+
9
+ output_file = File.join(config.output_dir, 'index.html')
10
+
11
+ IO.write(File.expand_path(output_file), rendered_text)
12
+ end
13
+
14
+ private
15
+
16
+ def make_output_directory!(config)
17
+ output_dir = File.expand_path(config.output_dir)
18
+
19
+ Dir.mkdir(output_dir) unless Dir.exist?(output_dir)
20
+ end
21
+
22
+ def copy_style_sheet!(config)
23
+ theme_file = "./resources/themes/bin/#{config.theme}.css"
24
+ output_file = File.join(config.output_dir, 'styles.css')
25
+
26
+ FileUtils.copy_entry(
27
+ File.expand_path(theme_file, __dir__),
28
+ File.expand_path(output_file)
29
+ )
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ module ReadingList
2
+ class Book
3
+ def initialize(json_hash)
4
+ @author = json_hash[:author]
5
+ @title = json_hash[:title]
6
+ @year = json_hash[:year]
7
+
8
+ @link = json_hash[:link]
9
+ end
10
+
11
+ attr_reader :author, :title, :year, :link
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module ReadingList
2
+ class Configuration
3
+ def initialize(hash)
4
+ @name = hash['name']
5
+ @email = hash['email']
6
+ @website = hash['website']
7
+ @book_file = hash['book_file']
8
+ @output_dir = hash.dig('output', 'dir')
9
+ @theme = hash.dig('output', 'theme')
10
+ end
11
+
12
+ attr_reader :name, :email, :website, :book_file, :output_dir, :theme
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ require 'mustache'
2
+
3
+ module ReadingList
4
+ class ListRenderer
5
+ def initialize(template_factory:)
6
+ @template_factory = template_factory
7
+ end
8
+
9
+ def render(config, books)
10
+ Mustache.render(template, **transform(config, books))
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :template_factory
16
+
17
+ def template
18
+ @template ||= template_factory.load('list.mustache')
19
+ end
20
+
21
+ def transform(config, books)
22
+ presenter = {}
23
+
24
+ presenter[:name] = config.name
25
+ presenter[:years] = books.map(&:year).uniq.sort.reverse
26
+ presenter[:sections] = books
27
+ .chunk(&:year)
28
+ .map { |s| { year: s.first, books: s.last } }
29
+ .sort_by { |s| s[:year] }
30
+ .reverse
31
+
32
+ presenter
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ require 'json'
2
+
3
+ module ReadingList
4
+ class BookRepository
5
+ def initialize(json_file:, book_factory:)
6
+ @json_file = json_file
7
+ @book_factory = book_factory
8
+ end
9
+
10
+ def books
11
+ @books ||= json.map { |json_book| book_factory.from_json(json_book) }
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :book_factory
17
+
18
+ def json
19
+ JSON.parse(IO.read(File.expand_path(@json_file)), symbolize_names: true)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <title>Reading List - {{name}}</title>
8
+
9
+ <link rel="stylesheet" href="styles.css"></link>
10
+ </head>
11
+
12
+ <body>
13
+ <div class="reading-list">
14
+ <header class="reading-list__header">
15
+ <div class="header__hero-image"></div>
16
+ <div class="header__avatar-image"></div>
17
+
18
+ <h1>{{name}}</h1>
19
+ <h2>Reading List</h2>
20
+ </header>
21
+
22
+ <section class="reading-list__content">
23
+ <nav class="reading-list__year-list">
24
+ <ul>
25
+ {{#years}}
26
+ <li><a href="#{{.}}">{{.}}</a></li>
27
+ {{/years}}
28
+ </ul>
29
+ </nav>
30
+
31
+ {{#sections}}
32
+ <div class="reading-list__year">
33
+ <h2><a id="{{year}}">{{year}}</a></h2>
34
+
35
+ <ul class="year__book-list">
36
+ {{#books}}
37
+ <li class="book-list__book">
38
+ <span class="book-list__title">
39
+ {{#link}}<a href="{{.}}">{{title}}</a>{{/link}}
40
+ {{^link}}{{title}}{{/link}}
41
+ </span>
42
+ by
43
+ <span class="book-list__author">{{author}}</span>
44
+ </li>
45
+ {{/books}}
46
+ </ul>
47
+ </div>
48
+ {{/sections}}
49
+ </section>
50
+
51
+ <footer class="reading-list__footer">
52
+ Created using the <a href="https://github.com/jtompkins/reading_list">Reading List</a> gem.
53
+ </footer>
54
+ </div>
55
+ </body>
56
+ </html>
@@ -0,0 +1,151 @@
1
+ @import url("https://fonts.googleapis.com/css?family=Monoton|Source+Code+Pro:300,600");
2
+ * {
3
+ box-sizing: border-box; }
4
+
5
+ html, body {
6
+ width: 100%;
7
+ height: 100%;
8
+ margin: 0;
9
+ padding: 0; }
10
+
11
+ body {
12
+ font-family: 'Source Code Pro', monospace;
13
+ font-size: 16pt;
14
+ font-weight: 300;
15
+ color: #333; }
16
+
17
+ h1, h2 {
18
+ margin: 0px;
19
+ padding: 0px;
20
+ font-weight: 300; }
21
+
22
+ h1 {
23
+ font-family: 'Monoton', cursive;
24
+ font-size: 3rem;
25
+ color: #87A23A; }
26
+
27
+ h2 a {
28
+ font-weight: 300;
29
+ color: #333; }
30
+
31
+ a {
32
+ font-weight: 600;
33
+ text-decoration: none;
34
+ color: #EC4E22; }
35
+
36
+ a:hover {
37
+ border-bottom: 1px solid #EC4E22; }
38
+
39
+ .reading-list {
40
+ display: flex;
41
+ flex-direction: column;
42
+ align-items: center;
43
+ min-height: 100%; }
44
+
45
+ .reading-list__header {
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ width: 100%;
50
+ flex-shrink: 0; }
51
+
52
+ .reading-list__header h1 {
53
+ margin-top: 25px; }
54
+
55
+ .reading-list__header h2 {
56
+ margin-top: -10px;
57
+ font-size: 1.75rem;
58
+ text-transform: uppercase; }
59
+
60
+ .header__hero-image {
61
+ height: 100px;
62
+ width: 100%;
63
+ background-color: #87A23A; }
64
+
65
+ .header__avatar-image {
66
+ height: 150px;
67
+ width: 150px;
68
+ margin-top: -75px;
69
+ border-radius: 75px;
70
+ box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
71
+ background-color: white;
72
+ background-image: url("avatar.jpg");
73
+ background-position: center;
74
+ background-size: cover; }
75
+
76
+ .reading-list__content {
77
+ display: flex;
78
+ flex-direction: column;
79
+ flex-grow: 1;
80
+ width: 50%;
81
+ margin-top: 25px; }
82
+
83
+ .reading-list__year-list {
84
+ display: none; }
85
+
86
+ .reading-list__year {
87
+ margin-top: 15px; }
88
+
89
+ .reading-list__year:first-of-type {
90
+ margin-top: 30px; }
91
+
92
+ .reading-list__year h2 {
93
+ font-size: 1.75rem;
94
+ font-weight: 300; }
95
+
96
+ .book-list__book {
97
+ margin-bottom: 5px; }
98
+
99
+ .book-list__title {
100
+ font-weight: 600; }
101
+
102
+ .reading-list__footer {
103
+ display: flex;
104
+ align-items: center;
105
+ flex-shrink: 0;
106
+ width: 100%;
107
+ height: 50px;
108
+ margin-top: 50px;
109
+ padding-left: 20px;
110
+ background-color: #EC4E22;
111
+ font-size: .85rem;
112
+ color: #FBCB3C; }
113
+
114
+ .reading-list__footer a {
115
+ color: #FBCB3C;
116
+ margin: 0 5px 0 5px; }
117
+
118
+ .reading-list__footer a:hover {
119
+ margin-bottom: -1px;
120
+ border-bottom: 1px solid #FBCB3C; }
121
+
122
+ @media (max-width: 1024px) {
123
+ .reading-list__content {
124
+ width: 70%; }
125
+
126
+ body {
127
+ font-size: 14pt; } }
128
+ @media (max-width: 375px) {
129
+ .header__hero-image {
130
+ height: 60px; }
131
+
132
+ .header__avatar-image {
133
+ height: 75px;
134
+ width: 75px;
135
+ margin-top: -40px; }
136
+
137
+ .reading-list__content {
138
+ width: 80%; }
139
+
140
+ .reading-list__year h2 {
141
+ font-size: 1.25rem; }
142
+
143
+ .reading-list__header h2 {
144
+ margin-top: 0px;
145
+ font-size: 1.3rem; }
146
+
147
+ body {
148
+ font-size: 12pt; }
149
+
150
+ h1 {
151
+ font-size: 1.75rem; } }
@@ -0,0 +1,216 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Monoton|Source+Code+Pro:300,600');
2
+
3
+ * {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html, body {
8
+ width: 100%;
9
+ height: 100%;
10
+
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ body {
16
+ font-family: 'Source Code Pro', monospace;
17
+ font-size: 16pt;
18
+ font-weight: 300;
19
+ color: #333;
20
+ }
21
+
22
+ h1, h2 {
23
+ margin: 0px;
24
+ padding: 0px;
25
+
26
+ font-weight: 300;
27
+ }
28
+
29
+ h1 {
30
+ font-family: 'Monoton', cursive;
31
+ font-size: 3rem;
32
+
33
+ color: #87A23A;
34
+ }
35
+
36
+ h2 a {
37
+ font-weight: 300;
38
+ color: #333;
39
+ }
40
+
41
+ a {
42
+ font-weight: 600;
43
+ text-decoration: none;
44
+ color: #EC4E22;
45
+ }
46
+
47
+ a:hover {
48
+ border-bottom: 1px solid #EC4E22;
49
+ }
50
+
51
+ .reading-list {
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+
56
+ min-height: 100%;
57
+ }
58
+
59
+ .reading-list__header {
60
+ display: flex;
61
+ flex-direction: column;
62
+ align-items: center;
63
+
64
+ width: 100%;
65
+
66
+ flex-shrink: 0;
67
+ }
68
+
69
+ .reading-list__header h1 {
70
+ margin-top: 25px;
71
+ }
72
+
73
+ .reading-list__header h2 {
74
+ margin-top: -10px;
75
+
76
+ font-size: 1.75rem;
77
+ text-transform: uppercase;
78
+ }
79
+
80
+ .header__hero-image {
81
+ height: 100px;
82
+ width: 100%;
83
+
84
+ background-color: #87A23A;
85
+ }
86
+
87
+ .header__avatar-image {
88
+ height: 150px;
89
+ width: 150px;
90
+
91
+ margin-top: -75px;
92
+ border-radius: 75px;
93
+ box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
94
+
95
+ background-color: white;
96
+
97
+ background-image: url("avatar.jpg");
98
+ background-position: center;
99
+ background-size: cover;
100
+ }
101
+
102
+ .reading-list__content {
103
+ display: flex;
104
+ flex-direction: column;
105
+ flex-grow: 1;
106
+
107
+ width: 50%;
108
+
109
+ margin-top: 25px;
110
+ }
111
+
112
+ .reading-list__year-list {
113
+ display: none;
114
+ }
115
+
116
+ .reading-list__year-list ul {}
117
+
118
+ .reading-list__year-list li {}
119
+
120
+ .reading-list__year {
121
+ margin-top: 15px;
122
+ }
123
+
124
+ .reading-list__year:first-of-type {
125
+ margin-top: 30px;
126
+ }
127
+
128
+ .reading-list__year h2 {
129
+ font-size: 1.75rem;
130
+ font-weight: 300;
131
+ }
132
+
133
+ .year__book-list {}
134
+
135
+ .book-list__book {
136
+ margin-bottom: 5px;
137
+ }
138
+
139
+ .book-list__title {
140
+ font-weight: 600;
141
+ }
142
+
143
+ .book-list__title a {}
144
+
145
+ .book-list__author {}
146
+
147
+ .reading-list__footer {
148
+ display: flex;
149
+ align-items: center;
150
+ flex-shrink: 0;
151
+
152
+ width: 100%;
153
+ height: 50px;
154
+
155
+ margin-top: 50px;
156
+ padding-left: 20px;
157
+
158
+ background-color: #EC4E22;
159
+
160
+ font-size: .85rem;
161
+ color: #FBCB3C;
162
+ }
163
+
164
+ .reading-list__footer a {
165
+ color: #FBCB3C;
166
+ margin: 0 5px 0 5px;
167
+ }
168
+
169
+ .reading-list__footer a:hover {
170
+ margin-bottom: -1px;
171
+ border-bottom: 1px solid #FBCB3C;
172
+ }
173
+
174
+ @media (max-width: 1024px) {
175
+ .reading-list__content {
176
+ width: 70%;
177
+ }
178
+
179
+ body {
180
+ font-size: 14pt;
181
+ }
182
+ }
183
+
184
+ @media (max-width: 375px) {
185
+ .header__hero-image {
186
+ height: 60px;
187
+ }
188
+
189
+ .header__avatar-image {
190
+ height: 75px;
191
+ width: 75px;
192
+
193
+ margin-top: -40px;
194
+ }
195
+
196
+ .reading-list__content {
197
+ width: 80%;
198
+ }
199
+
200
+ .reading-list__year h2 {
201
+ font-size: 1.25rem;
202
+ }
203
+
204
+ .reading-list__header h2 {
205
+ margin-top: 0px;
206
+ font-size: 1.3rem;
207
+ }
208
+
209
+ body {
210
+ font-size: 12pt;
211
+ }
212
+
213
+ h1 {
214
+ font-size: 1.75rem;
215
+ }
216
+ }
@@ -0,0 +1,3 @@
1
+ module ReadingList
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'reading_list/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'reading_list'
8
+ spec.version = ReadingList::VERSION
9
+ spec.authors = ['Joshua Tompkins']
10
+ spec.email = ['josh@joshtompkins.com']
11
+
12
+ spec.summary = 'A simple static generator for reading lists.'
13
+ spec.homepage = 'https://github.com/jtompkins/reading_list'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+
19
+ spec.bindir = 'bin'
20
+ spec.executables << 'reading_list'
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_dependency 'mustache', '~> 1.0'
24
+ spec.add_dependency 'codependent', '~> 0.4'
25
+ spec.add_dependency 'trollop', '~> 2.1', '>= 2.1.2'
26
+
27
+ spec.add_development_dependency 'bundler', '~> 1.13'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'pry'
31
+ spec.add_development_dependency 'pry-byebug'
32
+ spec.add_development_dependency 'rubocop', '~> 0.47.1'
33
+ spec.add_development_dependency 'simplecov'
34
+ spec.add_development_dependency 'sass'
35
+ end
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reading_list
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Tompkins
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mustache
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codependent
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: trollop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.1.2
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.1'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.1.2
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.13'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.13'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '10.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '10.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: pry
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: pry-byebug
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rubocop
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 0.47.1
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: 0.47.1
145
+ - !ruby/object:Gem::Dependency
146
+ name: simplecov
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ - !ruby/object:Gem::Dependency
160
+ name: sass
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ description:
174
+ email:
175
+ - josh@joshtompkins.com
176
+ executables:
177
+ - reading_list
178
+ extensions: []
179
+ extra_rdoc_files: []
180
+ files:
181
+ - ".gitignore"
182
+ - ".rubocop.yml"
183
+ - ".rubocop_todo.yml"
184
+ - ".ruby-version"
185
+ - Gemfile
186
+ - Gemfile.lock
187
+ - LICENSE
188
+ - README.md
189
+ - Rakefile
190
+ - bin/console
191
+ - bin/reading_list
192
+ - bin/setup
193
+ - lib/reading_list.rb
194
+ - lib/reading_list/factories/book_factory.rb
195
+ - lib/reading_list/factories/configuration_factory.rb
196
+ - lib/reading_list/factories/template_factory.rb
197
+ - lib/reading_list/ioc_container.rb
198
+ - lib/reading_list/list_writer.rb
199
+ - lib/reading_list/models/book.rb
200
+ - lib/reading_list/models/configuration.rb
201
+ - lib/reading_list/renderers/list_renderer.rb
202
+ - lib/reading_list/repositories/book_repository.rb
203
+ - lib/reading_list/resources/templates/list.mustache
204
+ - lib/reading_list/resources/themes/bin/default.css
205
+ - lib/reading_list/resources/themes/default.scss
206
+ - lib/reading_list/version.rb
207
+ - reading_list.gemspec
208
+ homepage: https://github.com/jtompkins/reading_list
209
+ licenses: []
210
+ metadata: {}
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ requirements: []
226
+ rubyforge_project:
227
+ rubygems_version: 2.6.8
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: A simple static generator for reading lists.
231
+ test_files: []