bloat 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 24b5fc435d18e45dc358f3e53db944b38c1a4cc6c2adba7cab143c5dc1771383
4
+ data.tar.gz: 82c36a45dc7a161a624972fde9c12b7153c44c16d80c68a9b17189025b42c980
5
+ SHA512:
6
+ metadata.gz: cc4430b03637b88a1caf44852c649ebd454eac2f2c87f0155b5e1f2b7f0c95ab001a761bdbf16d13c66ce8e73e4783959ffb38220b26d31c56c4aef35b5e5d30
7
+ data.tar.gz: 5fe6b0981ee0bd876467faa7072dffda8912e5fb8b7a088d922c494fbff1be4e5832ba61524fc54298c279e907e7da9188a75efb876ca3d9380961ebab005a22
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in bloat.gemspec
4
+ gemspec
5
+
6
+ gem "pry", "~> 0.13.1"
7
+ gem "rake", "~> 12.0"
8
+ gem "standard", "~> 0.4.7"
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bloat (0.1.0)
5
+ thor (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.1)
11
+ coderay (1.1.3)
12
+ method_source (1.0.0)
13
+ parallel (1.19.2)
14
+ parser (2.7.1.4)
15
+ ast (~> 2.4.1)
16
+ pry (0.13.1)
17
+ coderay (~> 1.1)
18
+ method_source (~> 1.0)
19
+ rainbow (3.0.0)
20
+ rake (12.3.3)
21
+ regexp_parser (1.7.1)
22
+ rexml (3.2.4)
23
+ rubocop (0.85.1)
24
+ parallel (~> 1.10)
25
+ parser (>= 2.7.0.1)
26
+ rainbow (>= 2.2.2, < 4.0)
27
+ regexp_parser (>= 1.7)
28
+ rexml
29
+ rubocop-ast (>= 0.0.3)
30
+ ruby-progressbar (~> 1.7)
31
+ 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)
36
+ ruby-progressbar (1.10.1)
37
+ standard (0.4.7)
38
+ rubocop (~> 0.85.0)
39
+ rubocop-performance (~> 1.6.0)
40
+ thor (1.0.1)
41
+ unicode-display_width (1.7.0)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ bloat!
48
+ pry (~> 0.13.1)
49
+ rake (~> 12.0)
50
+ standard (~> 0.4.7)
51
+
52
+ BUNDLED WITH
53
+ 2.1.4
@@ -0,0 +1,36 @@
1
+ # Bloat
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.
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 'bloat'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bloat
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
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.
30
+
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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bloat.
36
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bloat"
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(__FILE__)
@@ -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,27 @@
1
+ require_relative "lib/bloat/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "bloat"
5
+ spec.version = Bloat::VERSION
6
+ spec.authors = ["Stephen Dolan"]
7
+ spec.email = ["dolan.stephen1@gmail.com"]
8
+
9
+ spec.summary = "Quickly add functionality to applications"
10
+ spec.homepage = "https://github.com/stephendolan/bloat"
11
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
+
13
+ spec.metadata["homepage_uri"] = spec.homepage
14
+ spec.metadata["source_code_uri"] = "https://github.com/stephendolan/bloat"
15
+ spec.metadata["changelog_uri"] = "https://github.com/stephendolan/bloat"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "thor", "~> 1.0"
27
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bloat"
4
+
5
+ Bloat::CLI.start(ARGV)
@@ -0,0 +1,24 @@
1
+ require "thor"
2
+
3
+ require "bloat/version"
4
+ require "template"
5
+
6
+ module Bloat
7
+ class Error < StandardError; end
8
+
9
+ class CLI < Thor
10
+ include Thor::Actions
11
+
12
+ def self.exit_on_failure?
13
+ true
14
+ end
15
+
16
+ desc "with [TEMPLATE_URL]", "run a template"
17
+ def with(template_url)
18
+ template = Template.new(path: template_url)
19
+ raise Thor::Error, template.error unless template.error.nil?
20
+
21
+ apply(template_url)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Bloat
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ require "net/http"
2
+ require "uri"
3
+
4
+ class Template
5
+ attr_reader :path
6
+ attr_reader :error
7
+
8
+ def initialize(path:)
9
+ @path = path
10
+ @error = nil
11
+
12
+ validate_path
13
+ end
14
+
15
+ private
16
+
17
+ def validate_path
18
+ unless working_url?
19
+ @error = "You've provided an invalid URL"
20
+ return
21
+ end
22
+
23
+ unless valid_content?
24
+ @error = "Your URL needs to resolve to a Thor-supported template, and can't contain things like HTML tags."
25
+ end
26
+ end
27
+
28
+ def working_url?
29
+ uri = URI.parse(path)
30
+ uri.is_a?(URI::HTTP) && !uri.host.nil?
31
+ rescue URI::InvalidURIError
32
+ false
33
+ end
34
+
35
+ def valid_content?
36
+ content = Net::HTTP.get(URI.parse(path))
37
+
38
+ !content.match?(/<html>/)
39
+ end
40
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bloat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Dolan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
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
+ description:
28
+ email:
29
+ - dolan.stephen1@gmail.com
30
+ executables:
31
+ - bloat
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - README.md
39
+ - Rakefile
40
+ - bin/console
41
+ - bin/setup
42
+ - bloat.gemspec
43
+ - exe/bloat
44
+ - lib/bloat.rb
45
+ - lib/bloat/version.rb
46
+ - lib/template.rb
47
+ homepage: https://github.com/stephendolan/bloat
48
+ licenses: []
49
+ metadata:
50
+ homepage_uri: https://github.com/stephendolan/bloat
51
+ source_code_uri: https://github.com/stephendolan/bloat
52
+ changelog_uri: https://github.com/stephendolan/bloat
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.0
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.1.2
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Quickly add functionality to applications
72
+ test_files: []