insta 0.2.9 → 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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/Rakefile +30 -3
  4. data/exe/insta +6 -0
  5. data/lib/insta/ansi.rb +30 -0
  6. data/lib/insta/ci.rb +21 -0
  7. data/lib/insta/cli.rb +714 -0
  8. data/lib/insta/config_manifest.rb +56 -0
  9. data/lib/insta/configuration.rb +86 -2
  10. data/lib/insta/diff.rb +134 -0
  11. data/lib/insta/inline/call_finder.rb +37 -0
  12. data/lib/insta/inline/edit.rb +21 -0
  13. data/lib/insta/inline/file_patcher.rb +269 -0
  14. data/lib/insta/inline/pending_registry.rb +57 -0
  15. data/lib/insta/inline/pending_store.rb +145 -0
  16. data/lib/insta/minitest/assertions.rb +254 -0
  17. data/lib/insta/minitest/lifecycle.rb +12 -0
  18. data/lib/insta/minitest.rb +8 -0
  19. data/lib/insta/pending_locations.rb +64 -0
  20. data/lib/insta/pending_reporter.rb +47 -0
  21. data/lib/insta/redaction/applicator.rb +89 -0
  22. data/lib/insta/redaction/selector.rb +193 -0
  23. data/lib/insta/rspec/hooks.rb +18 -0
  24. data/lib/insta/rspec/matchers.rb +248 -0
  25. data/lib/insta/rspec.rb +7 -0
  26. data/lib/insta/serializers/base.rb +31 -0
  27. data/lib/insta/serializers/inspect.rb +14 -0
  28. data/lib/insta/serializers/json.rb +16 -0
  29. data/lib/insta/serializers/string.rb +14 -0
  30. data/lib/insta/serializers/yaml.rb +16 -0
  31. data/lib/insta/snapshot.rb +74 -0
  32. data/lib/insta/snapshot_content.rb +44 -0
  33. data/lib/insta/snapshot_file.rb +64 -0
  34. data/lib/insta/snapshot_mismatch_handler.rb +34 -0
  35. data/lib/insta/snapshot_name.rb +51 -0
  36. data/lib/insta/syntax_highlight.rb +20 -0
  37. data/lib/insta/update_coordinator.rb +22 -0
  38. data/lib/insta/version.rb +3 -1
  39. data/lib/insta.rb +42 -8
  40. data/lib/minitest/insta_plugin.rb +17 -0
  41. data/sig/insta/ansi.rbs +28 -0
  42. data/sig/insta/ci.rbs +10 -0
  43. data/sig/insta/cli.rbs +150 -0
  44. data/sig/insta/config_manifest.rbs +27 -0
  45. data/sig/insta/configuration.rbs +48 -0
  46. data/sig/insta/diff.rbs +38 -0
  47. data/sig/insta/inline/call_finder.rbs +22 -0
  48. data/sig/insta/inline/edit.rbs +18 -0
  49. data/sig/insta/inline/file_patcher.rbs +55 -0
  50. data/sig/insta/inline/pending_registry.rbs +22 -0
  51. data/sig/insta/inline/pending_store.rbs +41 -0
  52. data/sig/insta/minitest/assertions.rbs +52 -0
  53. data/sig/insta/minitest/lifecycle.rbs +10 -0
  54. data/sig/insta/minitest.rbs +2 -0
  55. data/sig/insta/pending_locations.rbs +22 -0
  56. data/sig/insta/pending_reporter.rbs +14 -0
  57. data/sig/insta/redaction/applicator.rbs +22 -0
  58. data/sig/insta/redaction/selector.rbs +58 -0
  59. data/sig/insta/rspec/hooks.rbs +10 -0
  60. data/sig/insta/rspec/matchers.rbs +71 -0
  61. data/sig/insta/rspec.rbs +2 -0
  62. data/sig/insta/serializers/base.rbs +21 -0
  63. data/sig/insta/serializers/inspect.rbs +10 -0
  64. data/sig/insta/serializers/json.rbs +10 -0
  65. data/sig/insta/serializers/string.rbs +10 -0
  66. data/sig/insta/serializers/yaml.rbs +10 -0
  67. data/sig/insta/snapshot.rbs +37 -0
  68. data/sig/insta/snapshot_content.rbs +14 -0
  69. data/sig/insta/snapshot_file.rbs +27 -0
  70. data/sig/insta/snapshot_mismatch_handler.rbs +12 -0
  71. data/sig/insta/snapshot_name.rbs +17 -0
  72. data/sig/insta/syntax_highlight.rbs +8 -0
  73. data/sig/insta/update_coordinator.rbs +11 -0
  74. data/sig/insta/version.rbs +5 -0
  75. data/sig/insta.rbs +12 -0
  76. data/sig/minitest/insta_plugin.rbs +6 -0
  77. data/sig/vendor/difftastic.rbs +19 -0
  78. data/sig/vendor/irb.rbs +5 -0
  79. data/sig/vendor/psych.rbs +7 -0
  80. data/sig/vendor/rspec.rbs +9 -0
  81. data/sig/vendor/rubygems.rbs +3 -0
  82. metadata +109 -54
  83. data/.DS_Store +0 -0
  84. data/.gitignore +0 -11
  85. data/.rspec +0 -3
  86. data/.travis.yml +0 -5
  87. data/CODE_OF_CONDUCT.md +0 -74
  88. data/Gemfile +0 -6
  89. data/Gemfile.lock +0 -35
  90. data/README.md +0 -41
  91. data/bin/console +0 -14
  92. data/bin/setup +0 -8
  93. data/insta.gemspec +0 -36
  94. data/lib/.DS_Store +0 -0
  95. data/lib/insta/account.rb +0 -127
  96. data/lib/insta/api.rb +0 -88
  97. data/lib/insta/constants.rb +0 -21
  98. data/lib/insta/device.rb +0 -11852
  99. data/lib/insta/feed.rb +0 -89
  100. data/lib/insta/location.rb +0 -18
  101. data/lib/insta/proxy_manager.rb +0 -23
  102. data/lib/insta/tag.rb +0 -18
  103. data/lib/insta/user.rb +0 -103
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "fileutils"
5
+
6
+ module Insta
7
+ class SnapshotFile
8
+ attr_reader :base_path #: Pathname
9
+ attr_reader :extension #: String
10
+
11
+ #: (String, String, String, ?String?) -> void
12
+ def initialize(base_path, test_class, test_name, extension = nil)
13
+ directory_resolver = Insta.configuration.snapshot_directory
14
+ directory = if directory_resolver
15
+ directory_resolver.call(test_class: test_class)
16
+ else
17
+ SnapshotName.underscore(test_class)
18
+ end
19
+ @base_path = Pathname.new(base_path) / directory
20
+ @test_name = test_name
21
+ @extension = extension || Insta.configuration.snapshot_extension
22
+ @counter = 0
23
+ end
24
+
25
+ #: (?Hash[Symbol, untyped]) -> Pathname
26
+ def path_for(options = {})
27
+ @counter += 1
28
+ filename_resolver = Insta.configuration.snapshot_filename
29
+
30
+ derived = if filename_resolver
31
+ filename_resolver.call(test_name: @test_name, counter: @counter, options: options)
32
+ else
33
+ SnapshotName.derive(@test_name, counter: @counter, options: options)
34
+ end
35
+
36
+ @base_path / "#{derived}#{@extension}"
37
+ end
38
+
39
+ #: (String) -> Pathname
40
+ def named_path(name)
41
+ @base_path / "#{SnapshotName.sanitize(name)}#{@extension}"
42
+ end
43
+
44
+ #: (Pathname) -> Pathname
45
+ def pending_path(path)
46
+ Pathname.new("#{path}.new")
47
+ end
48
+
49
+ #: (Pathname, String, Snapshot::snapshot_metadata) -> void
50
+ def write(path, content, metadata = {})
51
+ FileUtils.mkdir_p(path.dirname)
52
+ snapshot = Snapshot.new(content, metadata)
53
+
54
+ path.write(snapshot.serialize)
55
+ end
56
+
57
+ #: (Pathname) -> Snapshot?
58
+ def read(path)
59
+ return nil unless path.exist?
60
+
61
+ Snapshot.parse(path.read)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Insta
4
+ module SnapshotMismatchHandler
5
+ # Returns :updated, :force_passed, or :failed
6
+ #: (SnapshotFile, Pathname, String, Snapshot::snapshot_metadata, String, ?caller_line: String?) -> Symbol
7
+ def self.handle(snapshot_file, path, content, metadata, expected, caller_line: nil)
8
+ coordinator = UpdateCoordinator.new(Insta.configuration.resolved_update_mode)
9
+ decision = coordinator.resolve(expected, content)
10
+
11
+ case decision
12
+ when :update
13
+ snapshot_file.write(path, content, metadata)
14
+ :updated
15
+ when :pending
16
+ pending_path = snapshot_file.pending_path(path)
17
+ snapshot_file.write(pending_path, content, metadata)
18
+ PendingLocations.add(pending_path.to_s, caller_line) if caller_line
19
+
20
+ ENV["INSTA_FORCE_PASS"] ? :force_passed : :failed
21
+ else
22
+ :failed
23
+ end
24
+ end
25
+
26
+ #: (String, String, String, Pathname, ?caller_line: String?) -> String
27
+ def self.failure_message(expected, content, label, path, caller_line: nil)
28
+ Diff.failure_message(
29
+ expected, content, label, path.to_s, caller_line,
30
+ file_extension: File.extname(path.to_s).delete_prefix(".")
31
+ )
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "digest"
4
+
5
+ module Insta
6
+ module SnapshotName
7
+ #: (String) -> String
8
+ def self.sanitize(name)
9
+ sanitizer = Insta.configuration.snapshot_sanitizer
10
+
11
+ if sanitizer
12
+ sanitizer.call(name)
13
+ else
14
+ name
15
+ .gsub(/[^a-zA-Z0-9_\-.]/, "_")
16
+ .gsub(/_+/, "_")
17
+ .gsub(/\A_|_\z/, "")
18
+ end
19
+ end
20
+
21
+ #: (String) -> String
22
+ def self.underscore(string)
23
+ string
24
+ .gsub("::", "/")
25
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
26
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
27
+ .tr("-", "_")
28
+ .tr(" ", "_")
29
+ .downcase
30
+ end
31
+
32
+ #: (String) -> String
33
+ def self.strip_test_prefix(name)
34
+ name.sub(/\Atest_(\d+_)?/, "")
35
+ end
36
+
37
+ #: (String, ?counter: Integer, ?options: Hash[Symbol, untyped]) -> String
38
+ def self.derive(test_name, counter: 1, options: {})
39
+ stripped = strip_test_prefix(test_name)
40
+ clean_name = sanitize(stripped)
41
+ suffix = counter > 1 ? "-#{counter}" : ""
42
+
43
+ if options && !options.empty?
44
+ options_hash = Digest::MD5.hexdigest(options.inspect)
45
+ "#{clean_name}#{suffix}-#{options_hash}"
46
+ else
47
+ "#{clean_name}#{suffix}"
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "irb/color"
5
+ rescue LoadError
6
+ # irb not available, syntax highlighting will be skipped
7
+ end
8
+
9
+ module Insta
10
+ class SyntaxHighlight
11
+ #: (String, ?colorable: bool) -> String
12
+ def self.highlight(code, colorable: true)
13
+ return code unless colorable && defined?(IRB::Color)
14
+
15
+ IRB::Color.colorize_code(code, complete: false, colorable: true)
16
+ rescue StandardError
17
+ code
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Insta
4
+ class UpdateCoordinator
5
+ #: (Symbol) -> void
6
+ def initialize(mode)
7
+ @mode = mode
8
+ end
9
+
10
+ #: (String, String) -> Symbol
11
+ def resolve(expected, actual)
12
+ return :keep if expected == actual
13
+
14
+ case @mode
15
+ when :force then :update
16
+ when :new then expected.empty? ? :update : :fail
17
+ when :no then :fail
18
+ else :pending # :auto, :pending => default to creating .snap.new
19
+ end
20
+ end
21
+ end
22
+ end
data/lib/insta/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Insta
2
- VERSION = '0.2.9'.freeze
4
+ VERSION = "0.3.0" #: String
3
5
  end
data/lib/insta.rb CHANGED
@@ -1,10 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "insta/version"
4
+ require_relative "insta/ci"
5
+ require_relative "insta/configuration"
6
+ require_relative "insta/snapshot"
7
+ require_relative "insta/snapshot_content"
8
+ require_relative "insta/snapshot_name"
9
+ require_relative "insta/snapshot_file"
10
+ require_relative "insta/diff"
11
+ require_relative "insta/update_coordinator"
12
+ require_relative "insta/snapshot_mismatch_handler"
13
+ require_relative "insta/serializers/base"
14
+ require_relative "insta/serializers/string"
15
+ require_relative "insta/serializers/inspect"
16
+ require_relative "insta/serializers/json"
17
+ require_relative "insta/serializers/yaml"
18
+ require_relative "insta/redaction/selector"
19
+ require_relative "insta/redaction/applicator"
20
+ require_relative "insta/inline/call_finder"
21
+ require_relative "insta/inline/edit"
22
+ require_relative "insta/inline/file_patcher"
23
+ require_relative "insta/inline/pending_registry"
24
+ require_relative "insta/inline/pending_store"
25
+ require_relative "insta/pending_locations"
26
+ require_relative "insta/pending_reporter"
27
+ require_relative "insta/config_manifest"
28
+
1
29
  module Insta
2
- # Your code goes here...
3
- end
30
+ #: () -> Configuration
31
+ def self.configuration
32
+ @configuration ||= Configuration.new
33
+ end
4
34
 
5
- require 'insta/version'
6
- require 'insta/api'
7
- require 'insta/constants'
8
- require 'insta/device'
9
- require 'insta/user'
10
- require 'insta/proxy_manager'
35
+ #: () { (Configuration) -> void } -> void
36
+ def self.configure(&block)
37
+ block.call(configuration)
38
+ end
39
+
40
+ #: () -> void
41
+ def self.reset_configuration!
42
+ @configuration = Configuration.new
43
+ end
44
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "insta"
4
+ require "insta/minitest/assertions"
5
+ require "insta/minitest/lifecycle"
6
+
7
+ module Minitest
8
+ #: (Hash[Symbol, untyped]) -> void
9
+ def self.plugin_insta_init(_options)
10
+ Minitest::Test.include(Insta::Minitest::Assertions)
11
+ Minitest::Test.include(Insta::Minitest::Lifecycle)
12
+ end
13
+ end
14
+
15
+ Minitest.after_run do
16
+ Insta::PendingReporter.flush_and_report!
17
+ end
@@ -0,0 +1,28 @@
1
+ # Generated from lib/insta/ansi.rb with RBS::Inline
2
+
3
+ module Insta
4
+ module ANSI
5
+ private
6
+
7
+ # : () -> bool
8
+ def color?: () -> bool
9
+
10
+ # : (String) -> String
11
+ def bold: (String) -> String
12
+
13
+ # : (String) -> String
14
+ def dim: (String) -> String
15
+
16
+ # : (String) -> String
17
+ def red: (String) -> String
18
+
19
+ # : (String) -> String
20
+ def green: (String) -> String
21
+
22
+ # : (String) -> String
23
+ def yellow: (String) -> String
24
+
25
+ # : (String) -> String
26
+ def cyan: (String) -> String
27
+ end
28
+ end
data/sig/insta/ci.rbs ADDED
@@ -0,0 +1,10 @@
1
+ # Generated from lib/insta/ci.rb with RBS::Inline
2
+
3
+ module Insta
4
+ module CI
5
+ CI_ENV_VARS: Array[String]
6
+
7
+ # : () -> bool
8
+ def self.ci?: () -> bool
9
+ end
10
+ end
data/sig/insta/cli.rbs ADDED
@@ -0,0 +1,150 @@
1
+ # Generated from lib/insta/cli.rb with RBS::Inline
2
+
3
+ module Insta
4
+ class CLI
5
+ include ANSI
6
+
7
+ COMMANDS: untyped
8
+
9
+ MIN_GAP: Integer
10
+
11
+ # : (Array[String]) -> void
12
+ def initialize: (Array[String]) -> void
13
+
14
+ # : () -> void
15
+ def run: () -> void
16
+
17
+ private
18
+
19
+ def pluralize: (untyped count, untyped singular, ?untyped plural) -> untyped
20
+
21
+ # : () -> void
22
+ def review: () -> void
23
+
24
+ # : (Array[String]) -> void
25
+ def review_files: (Array[String]) -> void
26
+
27
+ # : (String) -> Symbol
28
+ def review_single_file: (String) -> Symbol
29
+
30
+ # : () -> String
31
+ def prompt_review_action: () -> String
32
+
33
+ # : () -> String
34
+ def review_prompt_line: () -> String
35
+
36
+ # : (String) -> void
37
+ def display_source_context: (String) -> void
38
+
39
+ # : (String) -> String?
40
+ def find_test_file: (String) -> String?
41
+
42
+ # : (String, String) -> Integer?
43
+ def find_test_line: (String, String) -> Integer?
44
+
45
+ # : (String) -> void
46
+ def display_caller_context: (String) -> void
47
+
48
+ # : (String, String) -> void
49
+ def display_snapshot_paths: (String, String) -> void
50
+
51
+ # : () -> void
52
+ def print_review_help: () -> void
53
+
54
+ # : (String, Integer) -> void
55
+ def print_source_lines: (String, Integer) -> void
56
+
57
+ # : (Array[String], Integer, Integer) -> Array[String]
58
+ def highlight_lines: (Array[String], Integer, Integer) -> Array[String]
59
+
60
+ # : (String, String) -> void
61
+ def display_diff: (String, String) -> void
62
+
63
+ # : (String, String) -> Symbol
64
+ def process_review_response: (String, String) -> Symbol
65
+
66
+ # : (Array[Inline::pending_store_entry]) -> void
67
+ def review_inline_entries: (Array[Inline::pending_store_entry]) -> void
68
+
69
+ # : (Inline::pending_store_entry) -> Symbol
70
+ def review_single_inline_entry: (Inline::pending_store_entry) -> Symbol
71
+
72
+ # : (String, Inline::pending_store_entry) -> Symbol
73
+ def process_inline_review_response: (String, Inline::pending_store_entry) -> Symbol
74
+
75
+ # : (Inline::pending_store_entry) -> void
76
+ def accept_inline_entry: (Inline::pending_store_entry) -> void
77
+
78
+ # : (Inline::pending_store_entry) -> void
79
+ def reject_inline_entry: (Inline::pending_store_entry) -> void
80
+
81
+ # : () -> void
82
+ def accept: () -> void
83
+
84
+ # : () -> void
85
+ def reject: () -> void
86
+
87
+ # : () -> void
88
+ def pending_list: () -> void
89
+
90
+ # : (Array[String]) -> void
91
+ def print_pending_files: (Array[String]) -> void
92
+
93
+ # : (Array[Inline::pending_store_entry]) -> void
94
+ def print_pending_inline: (Array[Inline::pending_store_entry]) -> void
95
+
96
+ # : () -> void
97
+ def status: () -> void
98
+
99
+ # : (String, String) -> void
100
+ def print_status_config: (String, String) -> void
101
+
102
+ # : (Array[String], Array[String], Array[Inline::pending_store_entry], Array[String]) -> void
103
+ def print_status_counts: (Array[String], Array[String], Array[Inline::pending_store_entry], Array[String]) -> void
104
+
105
+ # : (Array[String], Array[Inline::pending_store_entry]) -> void
106
+ def print_status_pending: (Array[String], Array[Inline::pending_store_entry]) -> void
107
+
108
+ # : (Array[[String, String]]) -> void
109
+ def print_status_entries: (Array[[ String, String ]]) -> void
110
+
111
+ # : () -> void
112
+ def clean: () -> void
113
+
114
+ # : () -> void
115
+ def help: () -> void
116
+
117
+ # : () -> void
118
+ def print_usage: () -> void
119
+
120
+ # : (String, Array[[String, String]]) -> void
121
+ def print_section: (String, Array[[ String, String ]]) -> void
122
+
123
+ # : () -> String
124
+ def header: () -> String
125
+
126
+ # : () -> void
127
+ def version: () -> void
128
+
129
+ # : () -> Array[[String, String]]
130
+ def help_commands: () -> Array[[ String, String ]]
131
+
132
+ # : () -> Array[[String, String]]
133
+ def help_options: () -> Array[[ String, String ]]
134
+
135
+ # : () -> Array[[String, String]]
136
+ def help_environment: () -> Array[[ String, String ]]
137
+
138
+ # : () -> Array[String]
139
+ def find_pending_files: () -> Array[String]
140
+
141
+ # : (String) -> void
142
+ def accept_file: (String) -> void
143
+
144
+ # : (String) -> void
145
+ def reject_file: (String) -> void
146
+
147
+ # : () -> void
148
+ def print_review_summary: () -> void
149
+ end
150
+ end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/insta/config_manifest.rb with RBS::Inline
2
+
3
+ module Insta
4
+ # Bridges configuration from the test process to the standalone CLI.
5
+ #
6
+ # `Insta.configure` runs inside the test process (usually from the test
7
+ # helper), which the CLI never loads. Instead of asking users to maintain
8
+ # a separate config file, the test run serializes the CLI-relevant
9
+ # settings next to the snapshots at flush time, and the CLI applies them
10
+ # on startup. Machine-written state, like the pending manifests.
11
+ module ConfigManifest
12
+ FILENAME: ::String
13
+
14
+ SYMBOL_KEYS: Array[Symbol]
15
+
16
+ RAW_KEYS: Array[Symbol]
17
+
18
+ # : () -> void
19
+ def self.write!: () -> void
20
+
21
+ # : () -> void
22
+ def self.apply!: () -> void
23
+
24
+ # : () -> String
25
+ def self.path: () -> String
26
+ end
27
+ end
@@ -0,0 +1,48 @@
1
+ # Generated from lib/insta/configuration.rb with RBS::Inline
2
+
3
+ module Insta
4
+ class Configuration
5
+ type snapshot_filename_resolver = ^(test_name: String, counter: Integer, options: Hash[Symbol, untyped]) -> String
6
+
7
+ attr_accessor snapshot_path: String
8
+
9
+ attr_accessor diff_display: Symbol
10
+
11
+ attr_accessor diff_width: Integer?
12
+
13
+ attr_accessor diff_color: Symbol
14
+
15
+ attr_accessor update_mode: Symbol
16
+
17
+ attr_accessor default_serializer: Symbol
18
+
19
+ attr_accessor heredoc_identifier: String
20
+
21
+ attr_accessor ci_mode: Symbol
22
+
23
+ attr_accessor snapshot_extension: String
24
+
25
+ attr_accessor snapshot_sanitizer: (^(String) -> String)?
26
+
27
+ attr_accessor snapshot_filename: snapshot_filename_resolver?
28
+
29
+ attr_accessor snapshot_directory: (^(test_class: String) -> String)?
30
+
31
+ attr_accessor new_snapshot: Symbol
32
+
33
+ # : () -> void
34
+ def initialize: () -> void
35
+
36
+ # : () -> Symbol
37
+ def resolved_update_mode: () -> Symbol
38
+
39
+ # : () -> bool
40
+ def resolved_ci_mode?: () -> bool
41
+
42
+ # : () -> String
43
+ def resolved_diff_color: () -> String
44
+
45
+ # : () -> String
46
+ def resolved_diff_display: () -> String
47
+ end
48
+ end
@@ -0,0 +1,38 @@
1
+ # Generated from lib/insta/diff.rb with RBS::Inline
2
+
3
+ module Insta
4
+ class Diff
5
+ # : () -> Difftastic::Differ
6
+ def self.differ: () -> Difftastic::Differ
7
+
8
+ # : (String, String) -> String
9
+ def self.diff: (String, String) -> String
10
+
11
+ # : (String, String, ?file_extension: String?) -> String
12
+ def self.diff_with_language: (String, String, ?file_extension: String?) -> String
13
+
14
+ # : (String, String, String, ?String?, ?String?, ?file_extension: String?) -> String
15
+ def self.failure_message: (String, String, String, ?String?, ?String?, ?file_extension: String?) -> String
16
+
17
+ # : (String) -> String
18
+ def self.caller_file_location: (String) -> String
19
+
20
+ # : (String) -> String
21
+ def self.run_test_command: (String) -> String
22
+
23
+ # : () -> bool
24
+ def self.rspec?: () -> bool
25
+
26
+ # : () -> bool
27
+ def self.rails?: () -> bool
28
+
29
+ # : () -> bool
30
+ def self.minitest_cli?: () -> bool
31
+
32
+ # : () -> bool
33
+ def self.mtest?: () -> bool
34
+
35
+ # : () -> Integer
36
+ def self.terminal_width: () -> Integer
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ # Generated from lib/insta/inline/call_finder.rb with RBS::Inline
2
+
3
+ module Insta
4
+ module Inline
5
+ class CallFinder < Prism::Visitor
6
+ METHODS: Array[Symbol]
7
+
8
+ attr_reader found_call: Prism::CallNode?
9
+
10
+ # : (Integer) -> void
11
+ def initialize: (Integer) -> void
12
+
13
+ # : (Prism::CallNode) -> void
14
+ def visit_call_node: (Prism::CallNode) -> void
15
+
16
+ private
17
+
18
+ # : (Prism::Node) -> bool
19
+ def covers_line?: (Prism::Node) -> bool
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ # Generated from lib/insta/inline/edit.rb with RBS::Inline
2
+
3
+ module Insta
4
+ module Inline
5
+ type pending_entry = { line: Integer, content: String, type: Symbol }
6
+
7
+ class Edit
8
+ attr_reader start_offset: Integer
9
+
10
+ attr_reader end_offset: Integer
11
+
12
+ attr_reader replacement: String
13
+
14
+ # : (Integer, Integer, String) -> void
15
+ def initialize: (Integer, Integer, String) -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,55 @@
1
+ # Generated from lib/insta/inline/file_patcher.rb with RBS::Inline
2
+
3
+ module Insta
4
+ module Inline
5
+ class FilePatcher
6
+ # : (String, Array[Inline::pending_entry]) -> String
7
+ def self.patch: (String, Array[Inline::pending_entry]) -> String
8
+
9
+ # : (String, Array[Edit]) -> String
10
+ def self.apply_edits: (String, Array[Edit]) -> String
11
+
12
+ # : (String, Prism::CallNode, String, Symbol) -> Edit?
13
+ def self.build_edit: (String, Prism::CallNode, String, Symbol) -> Edit?
14
+
15
+ # : (Prism::Node) -> bool
16
+ def self.heredoc_node?: (Prism::Node) -> bool
17
+
18
+ # : (Prism::ArgumentsNode) -> Prism::Node?
19
+ def self.find_snapshot_argument: (Prism::ArgumentsNode) -> Prism::Node?
20
+
21
+ # : (Prism::StringNode, String) -> Edit?
22
+ def self.build_string_edit: (Prism::StringNode, String) -> Edit?
23
+
24
+ # : (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
25
+ def self.build_heredoc_edit: (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
26
+
27
+ # : (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
28
+ def self.build_heredoc_to_string_edit: (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
29
+
30
+ # : (String, Prism::CallNode, Prism::StringNode, String) -> Edit?
31
+ def self.build_string_to_heredoc_edit: (String, Prism::CallNode, Prism::StringNode, String) -> Edit?
32
+
33
+ # : (String, Prism::CallNode, String) -> Edit?
34
+ def self.build_insert_edit: (String, Prism::CallNode, String) -> Edit?
35
+
36
+ # : (String, Prism::CallNode, Prism::Location, String) -> Edit
37
+ def self.build_bare_call_insert_edit: (String, Prism::CallNode, Prism::Location, String) -> Edit
38
+
39
+ # : (String) -> bool
40
+ def self.single_line?: (String) -> bool
41
+
42
+ # : (Prism::CallNode, Prism::Location, String) -> Edit
43
+ def self.build_insert_string_edit: (Prism::CallNode, Prism::Location, String) -> Edit
44
+
45
+ # : (String, Prism::CallNode, Prism::Location, String) -> Edit
46
+ def self.build_insert_heredoc_edit: (String, Prism::CallNode, Prism::Location, String) -> Edit
47
+
48
+ # : (String, Integer) -> Integer
49
+ def self.detect_indent: (String, Integer) -> Integer
50
+
51
+ # : (String, String) -> void
52
+ def self.atomic_write: (String, String) -> void
53
+ end
54
+ end
55
+ end