keepgoing 0.2.1 → 0.3.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: 71a3365eef25236c566cf33e0bcdd1c9b4390b75af47599af21cbface041946e
4
- data.tar.gz: 2c6b536fdc0f0f5a6e879041a1eac0763eeac3322cf7377c6e7d1ae40baf25d6
3
+ metadata.gz: '08dc1a3693c1a618e30850cab4683c0dcf7e333912106befafca0e66cf762072'
4
+ data.tar.gz: fa5456eb592c474e231367397b68689db83d66932020cf0e8c3386726e571bc0
5
5
  SHA512:
6
- metadata.gz: e3b94e2e9292d9c13f4513c2c71d3304a73194dbd9627bc598957e6ad0c60b38d1526afe20f1fd508caf4c38ae66dc2d4d819e04773c0e1195d9b93c7149e8d3
7
- data.tar.gz: 11ff076cf102a8bdd89dfa497039f43c1ff81fd676f62bab264521a5f7f7d687358ac080101375088666765c6f3eb73abae229aa54ebe3a263c5c295b3fb3663
6
+ metadata.gz: ab2de5edf15c43baa6b066f9a49f6f3ebd3f674906ab3b4738f118624af51a7ebb32610b118b375661a3b803d44b8dfa0eaf05661347d4d27807e657fd231fe3
7
+ data.tar.gz: cf9a1b20772e91b579ad56d21109bc77bf1a39f972b827f32bcff6a8115c9f5cf0b0feb2ca2aa1b98750dc5193a92404cb06a9303a695a63e3e3b89321f34d47
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2023-03-23
4
+
5
+ - Fix issue where keepgoing would not load the correct file for certain file names.
6
+ - Add support for ENV variable `CLEAR`, which defaults to true. Keepgoing will behave just as before and clear the screen on start-up and between reloads. If set to `false`, keepgoing will not clear the screen between runs. Example: `CLEAR=false ruby my_script.rb`
7
+ - Pass `wrap` true to `load` to wrap the script in an anonymous module. This doesn't actually solve a specific issue, but it felt like the right thing to do.
8
+
3
9
  ## [0.2.1] - 2022-06-14
4
10
 
5
11
  - Update CHANGELOG 🤦‍♂️
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keepgoing (0.2.1)
4
+ keepgoing (0.3.0)
5
5
  guard (~> 2.18)
6
6
 
7
7
  GEM
@@ -66,6 +66,7 @@ GEM
66
66
 
67
67
  PLATFORMS
68
68
  arm64-darwin-21
69
+ arm64-darwin-22
69
70
 
70
71
  DEPENDENCIES
71
72
  keepgoing!
@@ -73,4 +74,4 @@ DEPENDENCIES
73
74
  standard (~> 1.3)
74
75
 
75
76
  BUNDLED WITH
76
- 2.3.13
77
+ 2.4.8
@@ -7,7 +7,6 @@ module ::Guard
7
7
  attr_reader :runs
8
8
 
9
9
  def initialize(options = {})
10
- puts options
11
10
  opts = options.dup
12
11
  @runs = 0
13
12
  super(opts) # important to call + avoid passing options Guard doesn't understand
@@ -25,7 +24,7 @@ module ::Guard
25
24
  end
26
25
 
27
26
  def run_on_modifications(_paths)
28
- puts "Press Ctrl+C to quit keepgoing. Just edit and save away, you can do this 🎉\n\n"
27
+ puts "Press Ctrl+C to quit keepgoing. Just edit and save away, you can do this 🎉\n\n" if clear_screen_on_reload?
29
28
  do_run
30
29
  end
31
30
 
@@ -54,7 +53,7 @@ module ::Guard
54
53
  def fork_and_load
55
54
  @pid = fork do
56
55
  Signal.trap("HUP") { exit }
57
- load options[:file]
56
+ load "./#{options[:file]}", true
58
57
  end
59
58
  # detach script execution to give control back to guard
60
59
  Process.detach(@pid)
@@ -66,5 +65,9 @@ module ::Guard
66
65
  exit
67
66
  end
68
67
  end
68
+
69
+ def clear_screen_on_reload?
70
+ @options[:clear_screen_on_reload] || false
71
+ end
69
72
  end
70
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keepgoing
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/keepgoing.rb CHANGED
@@ -28,13 +28,17 @@ module Keepgoing
28
28
  # @private
29
29
  def self.guardfile
30
30
  <<~GUARDFILE
31
- clearing :on
31
+ clearing :#{clear_screen_on_reload? ? "on" : "off"}
32
32
  interactor :off
33
- guard "keepgoing", file: "#{script_file}" do
33
+ guard "keepgoing", file: "#{script_file}", clear_screen_on_reload: #{clear_screen_on_reload?} do
34
34
  watch("#{script_file}")
35
35
  end
36
36
  GUARDFILE
37
37
  end
38
+
39
+ def self.clear_screen_on_reload?
40
+ %w[1 on true].include?(ENV["CLEAR"])
41
+ end
38
42
  end
39
43
 
40
44
  # Automatically start keepgoing
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keepgoing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolfgang Rittner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-14 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard