howzit 1.2.19 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8b16b06b6f594b321d2226b4985c51330b437cda97528e120b09e1bfa9d777c
4
- data.tar.gz: fda79561390a39336c2bfe2aa94de7c6d81ce97b71e8721cf91066ec495d4080
3
+ metadata.gz: 5758dea871a182fc419de237ba35828396000307710b1680841bb774ea6994a2
4
+ data.tar.gz: bdf200a5a60c0acd268e37adcfae6b187807a14766e8199970fbd1d3ac1e4e3d
5
5
  SHA512:
6
- metadata.gz: e20d289047b1824e0f882895b580703003514c09424dbd848a461d7ed1680b2368d5ac0f11143a0fdd21eaab80a23545c0e4ceb131964003b442c8f112654a1b
7
- data.tar.gz: 4b5af891c82a9e1dcaec9177a025336d023873114e87ce906f1a0cdaa49845e02d113e60d90395fbbde2568a99b0766af3c889d4f8786e4f24e36d52a408c2a7
6
+ metadata.gz: c6ec5058df211c32bdf02a33f99626822221317ee95eb16161d17e4ede96ae31b744a16aee328cead7c4e3bab5ca393f0911227234709622fea27f4026a6504f
7
+ data.tar.gz: 7ce5c34e121fa6a3fa6fea662d21b3ccc60beba0e0fee8f0b87b0f8653e3d0e64c66f61cfdc978e0a4b1d425cb757fcf191ba4026262c1ce26225dad8b87897d
data/.travis.yml CHANGED
@@ -4,4 +4,10 @@ sudo: required
4
4
  dist: trusty
5
5
  cache: bundler
6
6
  rvm:
7
- - 2
7
+ - ruby-2.7.0
8
+ - ruby-3.0.1
9
+ install:
10
+ - gem uninstall bundler
11
+ - gem install bundler --version '2.2.29'
12
+ - bundle install
13
+ script: "rake"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ### 2.0.2
2
+
3
+ 2022-08-03 18:26
4
+
5
+ #### IMPROVED
6
+
7
+ - If a title is provided after an @command, display it instead of the contents when viewing
8
+
9
+ ### 2.0.1
10
+
11
+ 2022-08-03 12:46
12
+
13
+ #### FIXED
14
+
15
+ - Failure to create new notes file when one isn't found
16
+
17
+ ### 2.0.0
18
+
19
+ 2022-08-03 12:37
20
+
21
+ #### FIXED
22
+
23
+ - Positional arguments not rendering in tasks
24
+ - Fix degradation where arguments are empty
25
+
1
26
  ### 1.2.19
2
27
 
3
28
  2022-08-03 12:18
data/bin/howzit CHANGED
@@ -95,7 +95,7 @@ OptionParser.new do |opts|
95
95
 
96
96
  opts.on('--config-get [KEY]', 'Display the configuration settings or setting for a specific key') do |k|
97
97
  if k.nil?
98
- Howzit::Config::DEFAULTS.sort_by { |key, _| key }.each do |key, val|
98
+ Howzit::Config::DEFAULTS.sort_by { |key, _| key }.each do |key, _|
99
99
  print "#{key}: "
100
100
  p Howzit.options[key]
101
101
  end
data/howzit.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(features|spec|test)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.required_ruby_version = '>= 2.0.1'
20
+ spec.required_ruby_version = '>= 2.6.0'
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 2.2'
23
23
  spec.add_development_dependency 'rake', '~> 11.2'
@@ -9,6 +9,7 @@ module Howzit
9
9
 
10
10
  def initialize(file: nil, args: [])
11
11
  @topics = []
12
+ create_note if note_file.nil?
12
13
  @metadata = IO.read(note_file).split(/^#/)[0].strip.get_metadata
13
14
 
14
15
  read_help(file)
@@ -422,14 +423,7 @@ module Howzit
422
423
  new_topic = topic.dup
423
424
 
424
425
  # Handle variable replacement
425
-
426
- unless Howzit.arguments.empty?
427
- new_topic.content = new_topic.content.gsub(/\$(\d+)/) do |m|
428
- idx = m[1].to_i - 1
429
- Howzit.arguments.length > idx ? Howzit.arguments[idx] : m
430
- end
431
- new_topic.content = new_topic.content.gsub(/\$[@*]/, Shellwords.join(Howzit.arguments))
432
- end
426
+ new_topic.content = new_topic.content.render_arguments
433
427
 
434
428
  output = if run
435
429
  new_topic.run
@@ -131,6 +131,16 @@ module Howzit
131
131
  replace render_template(vars)
132
132
  end
133
133
 
134
+ def render_arguments
135
+ return self if Howzit.arguments.nil? || Howzit.arguments.empty?
136
+
137
+ gsub!(/\$(\d+)/) do |m|
138
+ idx = m[1].to_i - 1
139
+ Howzit.arguments.length > idx ? Howzit.arguments[idx] : m
140
+ end
141
+ gsub(/\$[@*]/, Shellwords.join(Howzit.arguments))
142
+ end
143
+
134
144
  def extract_metadata
135
145
  if File.exist?(self)
136
146
  leader = IO.read(self).split(/^#/)[0].strip
data/lib/howzit/task.rb CHANGED
@@ -7,7 +7,7 @@ module Howzit
7
7
  def initialize(type, title, action, parent = nil)
8
8
  @type = type
9
9
  @title = title
10
- @action = action
10
+ @action = action.render_arguments
11
11
  @parent = parent
12
12
  end
13
13
 
data/lib/howzit/topic.rb CHANGED
@@ -153,10 +153,11 @@ module Howzit
153
153
  Howzit.inclusions.push(matches[0])
154
154
  end
155
155
 
156
- when /@(run|copy|open|url|include)\((.*?)\)/
156
+ when /@(run|copy|open|url|include)\((.*?)\)(.*?)$/
157
157
  m = Regexp.last_match
158
158
  cmd = m[1]
159
159
  obj = m[2]
160
+ title = m[3].nil? ? obj : m[3]
160
161
  icon = case cmd
161
162
  when 'run'
162
163
  "\u{25B6}"
@@ -166,7 +167,7 @@ module Howzit
166
167
  "\u{279A}"
167
168
  end
168
169
 
169
- output.push(Color.template("{bmK}#{icon} {bwK}#{obj.gsub(/\\n/, '\​n')}{x}"))
170
+ output.push(Color.template("{bmK}#{icon} {bwK}#{title.gsub(/\\n/, '\​n')}{x}"))
170
171
  when /(`{3,})run *(.*?)$/i
171
172
  m = Regexp.last_match
172
173
  desc = m[2].length.positive? ? "Block: #{m[2]}" : 'Code Block'
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Howzit
4
4
  # Current Howzit version.
5
- VERSION = '1.2.19'.freeze
5
+ VERSION = '2.0.2'.freeze
6
6
  end
@@ -43,8 +43,8 @@ describe Howzit::BuildNote do
43
43
  Howzit.options[:include_upstream] = false
44
44
  Howzit.options[:default] = true
45
45
  hz = Howzit.buildnote
46
-
47
46
  hz.create_note
47
+
48
48
  subject(:how) { hz }
49
49
 
50
50
  describe ".note_file" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.19
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -295,7 +295,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
295
295
  requirements:
296
296
  - - ">="
297
297
  - !ruby/object:Gem::Version
298
- version: 2.0.1
298
+ version: 2.6.0
299
299
  required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  requirements:
301
301
  - - ">="