keepgoing 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 14820183bb25ef55e7878bbe1ce3fdf6c87bafc64a71102d8462a67f4eae927e
4
+ data.tar.gz: 0fbbf1c8ed8c9383a5089e56309f458d2d56dc28af7969a500108c53650110d6
5
+ SHA512:
6
+ metadata.gz: a163e5125850e0665485309151b5d642fb164fe75928307d5c1b59ab390b4bee2a1ee4dc4f3ba5bbee1eea46e3101fc786a304bffa0e270c77a8ba70610b31e0
7
+ data.tar.gz: ffbd4e5f2876f85a2aa22111afa91c00b9048111cd7d372a747be65bbb3552c2a569d3070011daa754bcacec398371489073d730f1375fa142f5c501260f6a9d
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.1
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-05-11
4
+
5
+ - Initial release of keepgoing, my first gem ever 🎉
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at me@wolfgangrittner.dev. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in keepgoing.gemspec
6
+ gemspec
7
+
8
+ # A make-like build utility for Ruby
9
+ gem "rake", "~> 13.0"
10
+
11
+ # Ruby Style Guide, with linter & automatic code fixer
12
+ gem "standard", "~> 1.3"
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ keepgoing (0.1.0)
5
+ guard (~> 2.18)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ ffi (1.15.5)
13
+ formatador (1.1.0)
14
+ guard (2.18.0)
15
+ formatador (>= 0.2.4)
16
+ listen (>= 2.7, < 4.0)
17
+ lumberjack (>= 1.0.12, < 2.0)
18
+ nenv (~> 0.1)
19
+ notiffany (~> 0.0)
20
+ pry (>= 0.13.0)
21
+ shellany (~> 0.0)
22
+ thor (>= 0.18.1)
23
+ listen (3.7.1)
24
+ rb-fsevent (~> 0.10, >= 0.10.3)
25
+ rb-inotify (~> 0.9, >= 0.9.10)
26
+ lumberjack (1.2.8)
27
+ method_source (1.0.0)
28
+ nenv (0.3.0)
29
+ notiffany (0.1.3)
30
+ nenv (~> 0.1)
31
+ shellany (~> 0.0)
32
+ parallel (1.22.1)
33
+ parser (3.1.2.0)
34
+ ast (~> 2.4.1)
35
+ pry (0.14.1)
36
+ coderay (~> 1.1)
37
+ method_source (~> 1.0)
38
+ rainbow (3.1.1)
39
+ rake (13.0.6)
40
+ rb-fsevent (0.11.1)
41
+ rb-inotify (0.10.1)
42
+ ffi (~> 1.0)
43
+ regexp_parser (2.4.0)
44
+ rexml (3.2.5)
45
+ rubocop (1.28.2)
46
+ parallel (~> 1.10)
47
+ parser (>= 3.1.0.0)
48
+ rainbow (>= 2.2.2, < 4.0)
49
+ regexp_parser (>= 1.8, < 3.0)
50
+ rexml
51
+ rubocop-ast (>= 1.17.0, < 2.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 1.4.0, < 3.0)
54
+ rubocop-ast (1.17.0)
55
+ parser (>= 3.1.1.0)
56
+ rubocop-performance (1.13.3)
57
+ rubocop (>= 1.7.0, < 2.0)
58
+ rubocop-ast (>= 0.4.0)
59
+ ruby-progressbar (1.11.0)
60
+ shellany (0.0.1)
61
+ standard (1.11.0)
62
+ rubocop (= 1.28.2)
63
+ rubocop-performance (= 1.13.3)
64
+ thor (1.2.1)
65
+ unicode-display_width (2.1.0)
66
+
67
+ PLATFORMS
68
+ arm64-darwin-21
69
+
70
+ DEPENDENCIES
71
+ keepgoing!
72
+ rake (~> 13.0)
73
+ standard (~> 1.3)
74
+
75
+ BUNDLED WITH
76
+ 2.3.13
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Wolfgang Rittner
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Keepgoing
2
+
3
+ keepgoing uses [guard](https://github.com/guard/guard) to tighten the feedback loop on your single-file Ruby script that uses [bundler/inline](https://bundler.io/guides/bundler_in_a_single_file_ruby_script.html).
4
+ When added as a gem to your script, it will run your script once when started like you are used to, but it won't exit and rather keep it going and re-run it every time you modify your script. You keep tinkering and once you save your script runs again and you 💥 immediately see the result 🤯.
5
+
6
+ ## bundler/inline
7
+ When trying out things with Ruby, and maybe a new Ruby gem or [even full blown Rails](https://christoph.luppri.ch/single-file-rails-applications-for-fun-and-bug-reporting), an awesome way to do this is using "bundler/inline".
8
+ It allows you to put a whole application including a "gemfile" into a single-file Ruby script, which gives you a quick feedback loop and allows you to share the whole thing as one self-contained file.
9
+
10
+ ## automate > manual
11
+ It would be great if we could tighten things up even more and supercharge the feedback loop by combining bundler/inline with guard auto-run.
12
+ I was wondering if guard could be inlined into that single-file Ruby script as well, and set up to execute that single file whenever it changed. This would allow us to start things up once, then keep editing and see results immediately.
13
+ Turns out you can, meet keepgoing!
14
+
15
+
16
+ ## Usage
17
+
18
+ Example Ruby single-file script:
19
+ ```ruby:test.rb
20
+ require "bundler/inline"
21
+
22
+ gemfile do
23
+ source "https://rubygems.org"
24
+ gem "keepgoing"
25
+ end
26
+
27
+ puts "Woohoo"
28
+ ```
29
+
30
+ When you run this script in a terminal with `ruby test.rb`, it will execute like it would without keepgoing, printing out "Woohoo".
31
+ But you'll notice it won't exit back to your terminal prompt. If you go back to your editor and change something, say add another `puts` and save, you'll notice it gets executed again and you see the results of your edit right away.
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies.
36
+
37
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wolfgangrittner/keepgoing. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/wolfgangrittner/keepgoing/blob/main/CODE_OF_CONDUCT.md).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Code of Conduct
48
+
49
+ Everyone interacting in the Keepgoing project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wolfgangrittner/keepgoing/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "standard/rake"
5
+
6
+ task default: :standard
data/keepgoing.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/keepgoing/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "keepgoing"
7
+ spec.version = Keepgoing::VERSION
8
+ spec.authors = ["Wolfgang Rittner"]
9
+ spec.email = ["me@wolfgangrittner.dev"]
10
+
11
+ spec.summary = "Supercharge your ruby script with auto-run on save."
12
+ spec.description = <<~DESC
13
+ This gem is intended for use in a single file Ruby script that uses bundler/inline.
14
+ You start your script once with `ruby your-script.rb` and keepgoing will take control,
15
+ and re-run you script every time you save your script.
16
+ You can concentrate on tinkering, while keepgoing will, well keep going,
17
+ providing you with a fast and effortless feedback loop for your ruby experiments.
18
+ DESC
19
+ spec.homepage = "https://github.com/wolfgangrittner/keepgoing"
20
+ spec.license = "MIT"
21
+ spec.required_ruby_version = ">= 2.6.0"
22
+
23
+ spec.metadata["homepage_uri"] = spec.homepage
24
+ spec.metadata["source_code_uri"] = "https://github.com/wolfgangrittner/keepgoing"
25
+ spec.metadata["changelog_uri"] = "https://github.com/wolfgangrittner/keepgoing/blob/main/CHANGELOG.md"
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
+ `git ls-files -z`.split("\x0").reject do |f|
31
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
32
+ end
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_dependency "guard", "~> 2.18"
39
+
40
+ # For more information and examples about making a new gem, check out our
41
+ # guide at: https://bundler.io/guides/creating_gem.html
42
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ::Guard
4
+ # Guard plugin for keepgoing, which will `load` the file it is given as an option,
5
+ # on start and on modification.
6
+ class Keepgoing < Plugin
7
+ attr_reader :runs
8
+
9
+ def initialize(options = {})
10
+ puts options
11
+ opts = options.dup
12
+ @runs = 0
13
+ super(opts) # important to call + avoid passing options Guard doesn't understand
14
+ end
15
+
16
+ def start
17
+ @runs = 1
18
+ puts "Hi! I'll keepgoing until you press Ctrl+C. Just edit and save away, you can do this 🎉\n\n"
19
+ run_all
20
+ end
21
+
22
+ def run_all
23
+ do_run
24
+ end
25
+
26
+ def run_on_modifications(_paths)
27
+ puts "Press Ctrl+C to quit keepgoing. Just edit and save away, you can do this 🎉\n\n"
28
+ do_run
29
+ end
30
+
31
+ private
32
+
33
+ def do_run
34
+ @runs += 1
35
+ load options[:file]
36
+ rescue ScriptError, StandardError => e
37
+ # prevent any script errors from stopping guard/keepgoing, but print error
38
+ puts e.inspect
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Keepgoing
4
+ VERSION = "0.1.0"
5
+ end
data/lib/keepgoing.rb ADDED
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "keepgoing/version"
4
+
5
+ require "guard"
6
+ require "guard/commander" # needed because of https://github.com/guard/guard/issues/793
7
+ require_relative "guard/keepgoing"
8
+
9
+ # keepgoing's core, that keeps things going
10
+ module Keepgoing
11
+ # The .start method will start up Guard using .guardfile as configuration.
12
+ # This mehtod is idempotent, it will start guard only once on the first call.
13
+ # If guard is already active, it will do nothing.
14
+ def self.start
15
+ return if Guard.state
16
+
17
+ Guard::UI.level = :warn
18
+ Guard.start(guardfile_contents: guardfile)
19
+
20
+ exit
21
+ end
22
+
23
+ # @private
24
+ def self.script_file
25
+ $PROGRAM_NAME
26
+ end
27
+
28
+ # @private
29
+ def self.guardfile
30
+ <<~GUARDFILE
31
+ clearing :on
32
+ interactor :off
33
+ guard "keepgoing", file: "#{script_file}" do
34
+ watch("#{script_file}")
35
+ end
36
+ GUARDFILE
37
+ end
38
+ end
39
+
40
+ # Automatically start keepgoing
41
+ Keepgoing.start
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: keepgoing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Wolfgang Rittner
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.18'
27
+ description: |
28
+ This gem is intended for use in a single file Ruby script that uses bundler/inline.
29
+ You start your script once with `ruby your-script.rb` and keepgoing will take control,
30
+ and re-run you script every time you save your script.
31
+ You can concentrate on tinkering, while keepgoing will, well keep going,
32
+ providing you with a fast and effortless feedback loop for your ruby experiments.
33
+ email:
34
+ - me@wolfgangrittner.dev
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".ruby-version"
40
+ - ".standard.yml"
41
+ - CHANGELOG.md
42
+ - CODE_OF_CONDUCT.md
43
+ - Gemfile
44
+ - Gemfile.lock
45
+ - LICENSE.txt
46
+ - README.md
47
+ - Rakefile
48
+ - keepgoing.gemspec
49
+ - lib/guard/keepgoing.rb
50
+ - lib/keepgoing.rb
51
+ - lib/keepgoing/version.rb
52
+ homepage: https://github.com/wolfgangrittner/keepgoing
53
+ licenses:
54
+ - MIT
55
+ metadata:
56
+ homepage_uri: https://github.com/wolfgangrittner/keepgoing
57
+ source_code_uri: https://github.com/wolfgangrittner/keepgoing
58
+ changelog_uri: https://github.com/wolfgangrittner/keepgoing/blob/main/CHANGELOG.md
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 2.6.0
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubygems_version: 3.3.7
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Supercharge your ruby script with auto-run on save.
78
+ test_files: []