diff --git a/.rubocop.yml b/.rubocop.yml index aeaa913..027fe58 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,10 @@ Metrics/BlockLength: Exclude: - 'spec/**/*' +Style/FrozenStringLiteralComment: + Exclude: + - 'snippets/**/*' + AllCops: TargetRubyVersion: 2.3 diff --git a/.ruby-version b/.ruby-version index 2bf1c1c..437459c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 +2.5.0 diff --git a/Gemfile b/Gemfile index c8fab92..e1e3a7a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,10 +2,10 @@ # frozen_string_literal: true source 'https://rubygems.org' -ruby '2.3.1' -gem 'byebug', '~> 9.0' -gem 'pry', '~> 0.10' -gem 'pry-byebug', '~> 3.3' -gem 'rake', '~> 11.3' -gem 'rspec', '~> 3.5' -gem 'rubocop', '~> 0.46' +ruby '2.5.0' +gem 'byebug', '~> 10.0.0' +gem 'pry', '~> 0.11.3' +gem 'pry-byebug', '~> 3.6.0' +gem 'rake', '~> 12.3' +gem 'rspec', '~> 3.7.0' +gem 'rubocop', '~> 0.52.1' diff --git a/Gemfile.lock b/Gemfile.lock index dfb736c..d1c8b4d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,59 +1,59 @@ GEM remote: https://rubygems.org/ specs: - ast (2.3.0) - byebug (9.0.6) - coderay (1.1.1) - diff-lcs (1.2.5) - method_source (0.8.2) - parser (2.3.3.1) - ast (~> 2.2) + ast (2.4.0) + byebug (10.0.0) + coderay (1.1.2) + diff-lcs (1.3) + method_source (0.9.0) + parallel (1.12.1) + parser (2.4.0.2) + ast (~> 2.3) powerpack (0.1.1) - pry (0.10.4) + pry (0.11.3) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-byebug (3.4.0) - byebug (~> 9.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) pry (~> 0.10) - rainbow (2.1.0) - rake (11.3.0) - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rainbow (3.0.0) + rake (12.3.0) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.1) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - rubocop (0.46.0) - parser (>= 2.3.1.1, < 3.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.1) + rubocop (0.52.1) + parallel (~> 1.10) + parser (>= 2.4.0.2, < 3.0) powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) + rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) - slop (3.6.0) - unicode-display_width (1.1.2) + ruby-progressbar (1.9.0) + unicode-display_width (1.3.0) PLATFORMS ruby DEPENDENCIES - byebug (~> 9.0) - pry (~> 0.10) - pry-byebug (~> 3.3) - rake (~> 11.3) - rspec (~> 3.5) - rubocop (~> 0.46) + byebug (~> 10.0.0) + pry (~> 0.11.3) + pry-byebug (~> 3.6.0) + rake (~> 12.3) + rspec (~> 3.7.0) + rubocop (~> 0.52.1) RUBY VERSION - ruby 2.3.1p112 + ruby 2.5.0p0 BUNDLED WITH - 1.13.5 + 1.16.1 diff --git a/README.md b/README.md index d282221..4aa30ce 100644 --- a/README.md +++ b/README.md @@ -27,41 +27,6 @@ in [`lib/tasks/aliases.rake`](lib/tasks/aliases.rake). Developers should store ruby files in [`lib`](lib), or perhaps a subdirectory. If a command line script is needed, it should go in [`bin`](bin). -## Code blocks - -With this in the markdown: - -<!-- start code block file="lib/example.rb" --> - -This gets replaced with the contents of `lib/example.rb` - -<!-- end code block --> - -running: - -```sh -cp README.md README.bak -bin/add-code-block.rb README.bak >README.md -``` - -produces: - - -```rb -# frozen_string_literal: true - -# An example class -class Example - attr_accessor :value - def initialize(value = 0) - @value = value - end -end -``` - - -Check the markdown source to see what happens. - ## Tasks Developers should run these often! diff --git a/bin/add-code-block.rb b/bin/add-code-block.rb deleted file mode 100755 index 20cae51..0000000 --- a/bin/add-code-block.rb +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -infile_name = ARGV[0] -infile_name || abort('filename required') -outfile = $stdout - -File.open infile_name do |markdown| - in_code_block = false - markdown.each do |line| - if in_code_block - in_code_block = !(line =~ //) - unless in_code_block - outfile.write "```\n" - outfile.write line - end - else - outfile.write line - in_code_block = line =~ // - if in_code_block - filename = /.+ +file="(?.+)"/.match(line)[:filename] - extension = File.extname(filename)[1..-1] - outfile.write "```#{extension}\n" - File.open filename do |file| - file.each do |code| - outfile.write code - end - end - end - end - end -end diff --git a/bin/rake b/bin/rake index 799748f..ffdf2b5 100755 --- a/bin/rake +++ b/bin/rake @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -# + # This file was generated by Bundler. # # The application 'rake' is installed as part of a gem, and diff --git a/bin/rspec b/bin/rspec index 59573e7..6859e4c 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -# + # This file was generated by Bundler. # # The application 'rspec' is installed as part of a gem, and diff --git a/bin/rubocop b/bin/rubocop index e4ed62f..7c7bf1a 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -# + # This file was generated by Bundler. # # The application 'rubocop' is installed as part of a gem, and diff --git a/lib/tasks/aliases.rake b/lib/tasks/aliases.rake index f2f191e..58c0465 100644 --- a/lib/tasks/aliases.rake +++ b/lib/tasks/aliases.rake @@ -7,4 +7,4 @@ desc 'Check code' task test: :spec desc 'lint and run tests' -task default: [:nag, :test] +task default: %i[nag test]