bloat 0.1.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24b5fc435d18e45dc358f3e53db944b38c1a4cc6c2adba7cab143c5dc1771383
4
- data.tar.gz: 82c36a45dc7a161a624972fde9c12b7153c44c16d80c68a9b17189025b42c980
3
+ metadata.gz: df8e72f2edded321c4ccaa7ec273791ad2682220e094069aba9d522f29a3d1f3
4
+ data.tar.gz: 1f6c880f8627be91775f0f892054aa93ed285868649b90999c03737b7ef1f25f
5
5
  SHA512:
6
- metadata.gz: cc4430b03637b88a1caf44852c649ebd454eac2f2c87f0155b5e1f2b7f0c95ab001a761bdbf16d13c66ce8e73e4783959ffb38220b26d31c56c4aef35b5e5d30
7
- data.tar.gz: 5fe6b0981ee0bd876467faa7072dffda8912e5fb8b7a088d922c494fbff1be4e5832ba61524fc54298c279e907e7da9188a75efb876ca3d9380961ebab005a22
6
+ metadata.gz: 31def16a0b73c10be91e986d66c105554588f256351f64b4418da2a834a75f4f6f0a5562cbd7083c324d55d9c3aa09dd7c0c3b5b7b7c06bd209a33d556fa4672
7
+ data.tar.gz: e3dfda69943c0d3af7b16c11dfdf769ce616356e1d93e89c2babf7c21ef34552fd74503016bea4ec3a41efa89c594e3716cd3db0568cb33359b8d0e2b9b970fa
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: stephendolan
@@ -0,0 +1,22 @@
1
+ name: CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ LintandTest:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ - name: Install dependencies
16
+ run: bundle install
17
+ - name: Check StandardRB
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20
+ uses: amoeba/standardrb-action@v2
21
+ - name: Run tests
22
+ run: bundle exec rake test
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in bloat.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'minitest', '~> 5.14'
6
7
  gem "pry", "~> 0.13.1"
7
- gem "rake", "~> 12.0"
8
- gem "standard", "~> 0.4.7"
8
+ gem "rake", "~> 13.0"
9
+ gem "standard", "~> 0.7"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bloat (0.1.0)
4
+ bloat (1.0.0)
5
5
  thor (~> 1.0)
6
6
 
7
7
  GEM
@@ -10,33 +10,35 @@ GEM
10
10
  ast (2.4.1)
11
11
  coderay (1.1.3)
12
12
  method_source (1.0.0)
13
+ minitest (5.14.2)
13
14
  parallel (1.19.2)
14
- parser (2.7.1.4)
15
+ parser (2.7.2.0)
15
16
  ast (~> 2.4.1)
16
17
  pry (0.13.1)
17
18
  coderay (~> 1.1)
18
19
  method_source (~> 1.0)
19
20
  rainbow (3.0.0)
20
- rake (12.3.3)
21
- regexp_parser (1.7.1)
21
+ rake (13.0.1)
22
+ regexp_parser (1.8.2)
22
23
  rexml (3.2.4)
23
- rubocop (0.85.1)
24
+ rubocop (0.92.0)
24
25
  parallel (~> 1.10)
25
- parser (>= 2.7.0.1)
26
+ parser (>= 2.7.1.5)
26
27
  rainbow (>= 2.2.2, < 4.0)
27
28
  regexp_parser (>= 1.7)
28
29
  rexml
29
- rubocop-ast (>= 0.0.3)
30
+ rubocop-ast (>= 0.5.0)
30
31
  ruby-progressbar (~> 1.7)
31
32
  unicode-display_width (>= 1.4.0, < 2.0)
32
- rubocop-ast (0.0.3)
33
- parser (>= 2.7.0.1)
34
- rubocop-performance (1.6.1)
35
- rubocop (>= 0.71.0)
33
+ rubocop-ast (0.8.0)
34
+ parser (>= 2.7.1.5)
35
+ rubocop-performance (1.8.1)
36
+ rubocop (>= 0.87.0)
37
+ rubocop-ast (>= 0.4.0)
36
38
  ruby-progressbar (1.10.1)
37
- standard (0.4.7)
38
- rubocop (~> 0.85.0)
39
- rubocop-performance (~> 1.6.0)
39
+ standard (0.7)
40
+ rubocop (= 0.92)
41
+ rubocop-performance (= 1.8.1)
40
42
  thor (1.0.1)
41
43
  unicode-display_width (1.7.0)
42
44
 
@@ -45,9 +47,10 @@ PLATFORMS
45
47
 
46
48
  DEPENDENCIES
47
49
  bloat!
50
+ minitest (~> 5.14)
48
51
  pry (~> 0.13.1)
49
- rake (~> 12.0)
50
- standard (~> 0.4.7)
52
+ rake (~> 13.0)
53
+ standard (~> 0.7)
51
54
 
52
55
  BUNDLED WITH
53
56
  2.1.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Stephen Dolan
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.
data/README.md CHANGED
@@ -1,36 +1,36 @@
1
1
  # Bloat
2
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/bloat`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/bloat.svg)](https://badge.fury.io/rb/bloat)
4
+ ![CI](https://github.com/stephendolan/bloat/workflows/CI/badge.svg)
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ Bloat is a tiny wrapper around a [Thor](http://whatisthor.com) `apply` call, and allows running arbitrary Thor template code from anywhere!
6
7
 
7
8
  ## Installation
8
9
 
9
- Add this line to your application's Gemfile:
10
+ In a ruby project, you can add `bloat` to your `Gemfile`
10
11
 
11
- ```ruby
12
- gem 'bloat'
13
- ```
12
+ For non-ruby projects, you'll need to install ruby, and then `gem install bloat`
14
13
 
15
- And then execute:
14
+ ## Usage
16
15
 
17
- $ bundle install
16
+ Just run `bloat with {template_url}`, and the content at the template will be run from your current directory! For examples of what you might want to do, check out [RailsBytes](https://railsbytes.org).
18
17
 
19
- Or install it yourself as:
18
+ ## Examples
20
19
 
21
- $ gem install bloat
20
+ Let's check out using `bloat` to make templates from [RailsBytes](https://railsbytes.org) work in a [Lucky](https://luckyframework.org) application.
22
21
 
23
- ## Usage
22
+ #### We can add the lovely [StimulusJS](https://stimulusjs.org) library to Lucky our app with one command!
24
23
 
25
- TODO: Write usage instructions here
24
+ `bloat with https://railsbytes.com/script/zl0sKQ`
26
25
 
27
- ## Development
26
+ #### How about a Lucky app styled with TailwindCSS?
28
27
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ `bloat with https://railsbytes.com/script/VeKsGg`
30
29
 
31
- 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).
30
+ #### Maybe we want to use TypeScript with Lucky?
32
31
 
33
- ## Contributing
32
+ `bloat with https://railsbytes.com/script/zl0sNL`
34
33
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bloat.
34
+ #### Bloat can even manage getting your Lucky app deployed to Heroku!
36
35
 
36
+ `bloat with https://railsbytes.com/script/VQLsab`
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
- task default: :spec
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList["test/**/*_test.rb"]
7
+ t.verbose = true
8
+ end
9
+
10
+ task default: :test
@@ -1,3 +1,3 @@
1
1
  module Bloat
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -5,6 +5,9 @@ class Template
5
5
  attr_reader :path
6
6
  attr_reader :error
7
7
 
8
+ ERROR_INVALID_URL = "You've provided an invalid URL."
9
+ ERROR_INVALID_CONTENT = "Your URL needs to resolve to a Thor-supported template, and can't contain things like HTML tags."
10
+
8
11
  def initialize(path:)
9
12
  @path = path
10
13
  @error = nil
@@ -16,12 +19,12 @@ class Template
16
19
 
17
20
  def validate_path
18
21
  unless working_url?
19
- @error = "You've provided an invalid URL"
22
+ @error = ERROR_INVALID_URL
20
23
  return
21
24
  end
22
25
 
23
26
  unless valid_content?
24
- @error = "Your URL needs to resolve to a Thor-supported template, and can't contain things like HTML tags."
27
+ @error = ERROR_INVALID_CONTENT
25
28
  end
26
29
  end
27
30
 
@@ -35,6 +38,11 @@ class Template
35
38
  def valid_content?
36
39
  content = Net::HTTP.get(URI.parse(path))
37
40
 
38
- !content.match?(/<html>/)
41
+ invalid_patterns = [
42
+ /<html.*>/,
43
+ /<!DOCTYPE html.*>/
44
+ ]
45
+
46
+ !content.match?(Regexp.union(invalid_patterns))
39
47
  end
40
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bloat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Dolan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -32,9 +32,12 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".github/FUNDING.yml"
36
+ - ".github/workflows/ruby.yml"
35
37
  - ".gitignore"
36
38
  - Gemfile
37
39
  - Gemfile.lock
40
+ - LICENSE
38
41
  - README.md
39
42
  - Rakefile
40
43
  - bin/console