lit-cli 0.6.2 → 0.6.3

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lit_pry.rb +17 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 865eec42e3e343a9432bc24ee852290159545a83c0d80c835555d3a7de965355
4
- data.tar.gz: ca99ccd747ac4091e93d1e703183ea63f122ed46b6883bd24588ad0c6ccdf809
3
+ metadata.gz: c0bb5bf94135acf7647df72b3431dc89663ee6bca855cfb3c75f298d8a79099d
4
+ data.tar.gz: a1c226eec222a72c0be6f38ee4940f5a3f70809557805bcc0992ebff50e11e89
5
5
  SHA512:
6
- metadata.gz: 64c4afe108dfadbdf6690963a1fb891ecf9dcf4bfd28402087cbeeafc37796e00d9564ce9d436139a1832af211330a61f428d15d5bb07add496347584245191e
7
- data.tar.gz: dee1223cefa077ce2b38cf060169ad1bb882b9fec8aac7a42e76834a77fc2a8b6c53d30a62b6695750388742bca48633b59d4656fac1c3dbe563e1e1e2e46d41
6
+ metadata.gz: 335100d58b9ee3c5f6fa599725c91c0911237b1e6ba64fadd4d62b59569478e897eee752f4f9abf70365ae102fa99f9a4d849099c8b99521e6207ec9ad00ae2a
7
+ data.tar.gz: 97b8638b199affa210e563aa529f8178a45fe0f5023c844460a78e6f742a3b20dbcb502cf64922001b40fa974a009118bce2d7040fba7d3cf88cc0190dc7281d
data/lib/lit_pry.rb CHANGED
@@ -60,7 +60,6 @@ if ENV['LIT_FLAGS'] && ENV['LIT_FLAGS'].include?('step')
60
60
  unless @@lit_processed_paths.include? file_path
61
61
  @@lit_processed_paths.add file_path
62
62
 
63
- binding = "{ binding.pry if LitCLI.is_prying?; @@is_prying = false }"
64
63
  new_lines = ''
65
64
  line_count = 0
66
65
  new_lines_count = 0
@@ -72,14 +71,11 @@ if ENV['LIT_FLAGS'] && ENV['LIT_FLAGS'].include?('step')
72
71
  if line.strip.start_with? 'require_relative '
73
72
  line = line.strip + ", '#{absolute_path.join('/')}'\n"
74
73
  new_lines << line
74
+ # Add pry binding on each lit method.
75
+ elsif lit_line = Kernel.add_lit_binding(line)
76
+ new_lines << lit_line
75
77
  else
76
- # Add pry binding beneath each lit message.
77
- if line.strip.start_with? 'lit '
78
- lit_args = line.strip.delete_prefix('lit ').delete_suffix("\n")
79
- new_lines << "lit(#{lit_args}) #{binding} \n"
80
- else
81
- new_lines << line
82
- end
78
+ new_lines << line
83
79
  end
84
80
  end
85
81
 
@@ -98,5 +94,18 @@ if ENV['LIT_FLAGS'] && ENV['LIT_FLAGS'].include?('step')
98
94
  # Setting file_path in eval() negates this fix but will keep just in case.
99
95
  return binding unless LitCLI.is_prying?
100
96
  end
97
+
98
+ def self.add_lit_binding(line)
99
+ block = "{ binding.pry if LitCLI.is_prying?; @@is_prying = false }"
100
+
101
+ ['lit ', 'lit(', '🔥 ', '🔥(', '🔥'].each do |needle|
102
+ if line.strip.start_with? needle
103
+ args = line.strip.delete_prefix(needle).delete_suffix(")").chomp
104
+ return "lit(#{args}) #{block} \n"
105
+ end
106
+ end
107
+
108
+ false
109
+ end
101
110
  end
102
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lit-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maedi Prichard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pastel