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 +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.github/workflows/ruby.yml +22 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +19 -16
- data/LICENSE +21 -0
- data/README.md +17 -17
- data/Rakefile +9 -1
- data/lib/bloat/version.rb +1 -1
- data/lib/template.rb +11 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df8e72f2edded321c4ccaa7ec273791ad2682220e094069aba9d522f29a3d1f3
|
4
|
+
data.tar.gz: 1f6c880f8627be91775f0f892054aa93ed285868649b90999c03737b7ef1f25f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31def16a0b73c10be91e986d66c105554588f256351f64b4418da2a834a75f4f6f0a5562cbd7083c324d55d9c3aa09dd7c0c3b5b7b7c06bd209a33d556fa4672
|
7
|
+
data.tar.gz: e3dfda69943c0d3af7b16c11dfdf769ce616356e1d93e89c2babf7c21ef34552fd74503016bea4ec3a41efa89c594e3716cd3db0568cb33359b8d0e2b9b970fa
|
data/.github/FUNDING.yml
ADDED
@@ -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
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bloat (
|
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.
|
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 (
|
21
|
-
regexp_parser (1.
|
21
|
+
rake (13.0.1)
|
22
|
+
regexp_parser (1.8.2)
|
22
23
|
rexml (3.2.4)
|
23
|
-
rubocop (0.
|
24
|
+
rubocop (0.92.0)
|
24
25
|
parallel (~> 1.10)
|
25
|
-
parser (>= 2.7.
|
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
|
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
|
33
|
-
parser (>= 2.7.
|
34
|
-
rubocop-performance (1.
|
35
|
-
rubocop (>= 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.
|
38
|
-
rubocop (
|
39
|
-
rubocop-performance (
|
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 (~>
|
50
|
-
standard (~> 0.
|
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
|
-
|
3
|
+
[](https://badge.fury.io/rb/bloat)
|
4
|
+

|
4
5
|
|
5
|
-
|
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
|
-
|
10
|
+
In a ruby project, you can add `bloat` to your `Gemfile`
|
10
11
|
|
11
|
-
|
12
|
-
gem 'bloat'
|
13
|
-
```
|
12
|
+
For non-ruby projects, you'll need to install ruby, and then `gem install bloat`
|
14
13
|
|
15
|
-
|
14
|
+
## Usage
|
16
15
|
|
17
|
-
|
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
|
-
|
18
|
+
## Examples
|
20
19
|
|
21
|
-
|
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
|
-
|
22
|
+
#### We can add the lovely [StimulusJS](https://stimulusjs.org) library to Lucky our app with one command!
|
24
23
|
|
25
|
-
|
24
|
+
`bloat with https://railsbytes.com/script/zl0sKQ`
|
26
25
|
|
27
|
-
|
26
|
+
#### How about a Lucky app styled with TailwindCSS?
|
28
27
|
|
29
|
-
|
28
|
+
`bloat with https://railsbytes.com/script/VeKsGg`
|
30
29
|
|
31
|
-
|
30
|
+
#### Maybe we want to use TypeScript with Lucky?
|
32
31
|
|
33
|
-
|
32
|
+
`bloat with https://railsbytes.com/script/zl0sNL`
|
34
33
|
|
35
|
-
|
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
data/lib/bloat/version.rb
CHANGED
data/lib/template.rb
CHANGED
@@ -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 =
|
22
|
+
@error = ERROR_INVALID_URL
|
20
23
|
return
|
21
24
|
end
|
22
25
|
|
23
26
|
unless valid_content?
|
24
|
-
@error =
|
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
|
-
|
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:
|
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-
|
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
|