snapshot_ui 0.2.0 → 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 +4 -4
- data/lib/minitest/snapshot_ui_plugin.rb +3 -1
- data/lib/snapshot_ui/colorize.rb +15 -0
- data/lib/snapshot_ui/configuration.rb +21 -2
- data/lib/snapshot_ui/test/minitest_helpers.rb +2 -0
- data/lib/snapshot_ui/version.rb +1 -1
- data/lib/snapshot_ui.rb +12 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed5906abe86dd34b16173cdbff8239e7f649ab4ace8adceabf250c90165b1879
|
4
|
+
data.tar.gz: fce78cca8afc9baffd515257e1f5e7a564e27d803b6c2e3a84341441254d7ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c64f1972c0f1261fe57e09e8aad3e9e9ba174184dbc9ff82ed988012e27a8d2340818629189d90a41d3ea7f2d11725ff9ec546500b32a1c0adddf6d2ec083a7
|
7
|
+
data.tar.gz: 791edbd08ad2eaffed422b850063dc8b3c5914a2214f8914f2079607c03a6c0b3cfa8b6608618e4d54750953886b633a9a7d26f3c975c8e06f5ced609f533b1f
|
@@ -12,6 +12,8 @@ module Minitest
|
|
12
12
|
def plugin_snapshot_ui_init(_options)
|
13
13
|
return unless SnapshotUI.snapshot_taking_enabled?
|
14
14
|
|
15
|
+
SnapshotUI.exit_if_not_configured!
|
16
|
+
|
15
17
|
reporter << SnapshotUIReporter.new
|
16
18
|
|
17
19
|
SnapshotUI.clear_snapshots_in_progress
|
@@ -22,7 +24,7 @@ module Minitest
|
|
22
24
|
def report
|
23
25
|
SnapshotUI.publish_snapshots_in_progress
|
24
26
|
|
25
|
-
io.
|
27
|
+
io.puts "\n\nUI snapshots are ready for review at #{SnapshotUI.configuration.web_url}"
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "colorize"
|
4
|
+
|
3
5
|
module SnapshotUI
|
4
6
|
class Configuration
|
5
7
|
attr_writer :storage_directory, :project_root_directory
|
@@ -12,11 +14,28 @@ module SnapshotUI
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def storage_directory
|
15
|
-
Pathname.new(@storage_directory)
|
17
|
+
Pathname.new(@storage_directory) if @storage_directory
|
16
18
|
end
|
17
19
|
|
18
20
|
def project_root_directory
|
19
|
-
Pathname.new(@project_root_directory)
|
21
|
+
Pathname.new(@project_root_directory) if @project_root_directory
|
22
|
+
end
|
23
|
+
|
24
|
+
def exit_if_not_configured!
|
25
|
+
return unless project_root_directory.nil? || storage_directory.nil? || web_url.nil?
|
26
|
+
|
27
|
+
puts Colorize.red("Looks like SnapshotUI is not configured yet. Example configuration:\n")
|
28
|
+
|
29
|
+
puts <<~CONFIG
|
30
|
+
#{Colorize.green("SnapshotUI.configure do |config|")}
|
31
|
+
#{Colorize.green('config.storage_directory = "/path/to/tmp/snapshot_ui"')} #{Colorize.red("# Current value is `#{storage_directory.inspect}`")}
|
32
|
+
#{Colorize.green('config.project_root_directory = "/path/to/project/root"')} #{Colorize.red("# Current value is `#{project_root_directory.inspect}`")}
|
33
|
+
#{Colorize.green("config.web_url = \"#{web_url}\"")} #{Colorize.red("# Current value is `#{web_url.inspect}`")}
|
34
|
+
#{Colorize.green("end")}
|
35
|
+
|
36
|
+
CONFIG
|
37
|
+
|
38
|
+
raise SystemExit.new(1)
|
20
39
|
end
|
21
40
|
end
|
22
41
|
end
|
data/lib/snapshot_ui/version.rb
CHANGED
data/lib/snapshot_ui.rb
CHANGED
@@ -5,8 +5,8 @@ require_relative "snapshot_ui/configuration"
|
|
5
5
|
|
6
6
|
module SnapshotUI
|
7
7
|
DEFAULT_CONFIGURATION = {
|
8
|
-
project_root_directory:
|
9
|
-
storage_directory:
|
8
|
+
project_root_directory: nil,
|
9
|
+
storage_directory: nil,
|
10
10
|
web_url: "http://localhost:3000/ui/snapshots"
|
11
11
|
}.freeze
|
12
12
|
|
@@ -23,14 +23,24 @@ module SnapshotUI
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.publish_snapshots_in_progress
|
26
|
+
exit_if_not_configured!
|
27
|
+
|
26
28
|
Snapshot.publish_snapshots_in_progress
|
27
29
|
end
|
28
30
|
|
29
31
|
def self.clear_snapshots_in_progress
|
32
|
+
exit_if_not_configured!
|
33
|
+
|
30
34
|
Snapshot.clear_snapshots_in_progress
|
31
35
|
end
|
32
36
|
|
33
37
|
def self.clear_snapshots
|
38
|
+
exit_if_not_configured!
|
39
|
+
|
34
40
|
Snapshot.clear_snapshots
|
35
41
|
end
|
42
|
+
|
43
|
+
def self.exit_if_not_configured!
|
44
|
+
configuration.exit_if_not_configured!
|
45
|
+
end
|
36
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapshot_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomaz Zlender
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/snapshot_ui.rb
|
97
97
|
- lib/snapshot_ui/cli.rb
|
98
98
|
- lib/snapshot_ui/cli/watcher.ru
|
99
|
+
- lib/snapshot_ui/colorize.rb
|
99
100
|
- lib/snapshot_ui/configuration.rb
|
100
101
|
- lib/snapshot_ui/snapshot.rb
|
101
102
|
- lib/snapshot_ui/snapshot/context.rb
|