standup_md 0.3.14 → 0.3.15

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: e9e2449a7136b2b9b9633db530b2304ddc986050bb404c951cb0da1cb299330b
4
- data.tar.gz: 52106b7870dee25cf07070fd6e6ff689c84e3142bdb1249077f8ea757d56eac1
3
+ metadata.gz: b95cee87e34194f847a9830ccf56694e1c450c0bdbae04b8b0af0df7716daaaa
4
+ data.tar.gz: 2d8466163ca2687ca156e62c12399b01a65454e57eb3d7376931908e0e39a61c
5
5
  SHA512:
6
- metadata.gz: 27248294c5f4d85bb5b1c4ae5df44d4133bfbe968acc30aba3917df29424f00b56c56bb12ea1219fe0b0c2ce311699f912957f616526db5ee43939c11abf7def
7
- data.tar.gz: dfc856d09518702f57bc7fdb2a1610ce5143c165340709e067a4509ca7fc7789bd247422f6ac3952a678006789dc939a8f8e12b7f318b3e63cec140dab5c82b3
6
+ metadata.gz: 522d4e0c57d9887456210fb79ac5fd4920350ffd7265f8dd2bc40369405ed4ef624cd29425dae92e480b1e694ad9ff5e5733e36c0800527f8c692f3335128ee8
7
+ data.tar.gz: 1229afe074eacb10dcf0b84dabd80d3a41695c604ade83e175739548bdebdf4d84fd5161f6f50bb9931239816fa885c78ff217b7950fdf31f4498919fccaee0a
@@ -1,4 +1,5 @@
1
- name: Ruby
1
+ # .github/workflows/ruby.yml
2
+ name: Ruby CI
2
3
 
3
4
  on:
4
5
  push:
@@ -8,17 +9,31 @@ on:
8
9
 
9
10
  jobs:
10
11
  test:
12
+ runs-on: ubuntu-22.04
11
13
 
12
- runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby-version: ['3.2', '3.3', '4.0']
13
18
 
14
19
  steps:
15
- - uses: actions/checkout@v2
16
- - name: Set up Ruby 2.6
17
- uses: actions/setup-ruby@v1
18
- with:
19
- ruby-version: 2.6.x
20
- - name: Build and test with Rake
21
- run: |
22
- gem install bundler
23
- bundle install
24
- bundle exec rake test
20
+ - uses: actions/checkout@v3
21
+
22
+ # Set up Ruby and Bundler
23
+ - name: Set up Ruby ${{ matrix.ruby-version }}
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby-version }}
27
+ bundler: ${{ matrix.ruby-version == '4.0' && '4.0.9' || '2.4.13' }}
28
+ bundler-cache: true
29
+
30
+ - name: Print Ruby and Bundler versions
31
+ run: |
32
+ ruby -v
33
+ bundle -v
34
+
35
+ - name: Install dependencies
36
+ run: bundle install --jobs 4 --retry 3
37
+
38
+ - name: Run tests
39
+ run: bundle exec rake
data/Gemfile.lock CHANGED
@@ -1,31 +1,126 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standup_md (0.3.13)
4
+ standup_md (0.3.15)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- docile (1.3.5)
10
- power_assert (2.0.0)
11
- rake (13.0.3)
12
- simplecov (0.21.2)
9
+ ast (2.4.3)
10
+ date (3.5.1)
11
+ docile (1.4.1)
12
+ erb (6.0.4)
13
+ json (2.19.9)
14
+ language_server-protocol (3.17.0.5)
15
+ lint_roller (1.1.0)
16
+ parallel (1.28.0)
17
+ parser (3.3.11.1)
18
+ ast (~> 2.4.1)
19
+ racc
20
+ power_assert (3.0.1)
21
+ prism (1.9.0)
22
+ psych (5.4.0)
23
+ date
24
+ stringio
25
+ racc (1.8.1)
26
+ rainbow (3.1.1)
27
+ rake (13.4.2)
28
+ rdoc (7.2.0)
29
+ erb
30
+ psych (>= 4.0.0)
31
+ tsort
32
+ regexp_parser (2.12.0)
33
+ rubocop (1.84.2)
34
+ json (~> 2.3)
35
+ language_server-protocol (~> 3.17.0.2)
36
+ lint_roller (~> 1.1.0)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.3.0.2)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 2.9.3, < 3.0)
41
+ rubocop-ast (>= 1.49.0, < 2.0)
42
+ ruby-progressbar (~> 1.7)
43
+ unicode-display_width (>= 2.4.0, < 4.0)
44
+ rubocop-ast (1.49.1)
45
+ parser (>= 3.3.7.2)
46
+ prism (~> 1.7)
47
+ rubocop-performance (1.26.1)
48
+ lint_roller (~> 1.1)
49
+ rubocop (>= 1.75.0, < 2.0)
50
+ rubocop-ast (>= 1.47.1, < 2.0)
51
+ ruby-progressbar (1.13.0)
52
+ simplecov (0.22.0)
13
53
  docile (~> 1.1)
14
54
  simplecov-html (~> 0.11)
15
55
  simplecov_json_formatter (~> 0.1)
16
- simplecov-html (0.12.3)
17
- simplecov_json_formatter (0.1.2)
18
- test-unit (3.4.1)
56
+ simplecov-html (0.13.2)
57
+ simplecov_json_formatter (0.1.4)
58
+ standard (1.54.0)
59
+ language_server-protocol (~> 3.17.0.2)
60
+ lint_roller (~> 1.0)
61
+ rubocop (~> 1.84.0)
62
+ standard-custom (~> 1.0.0)
63
+ standard-performance (~> 1.8)
64
+ standard-custom (1.0.2)
65
+ lint_roller (~> 1.0)
66
+ rubocop (~> 1.50)
67
+ standard-performance (1.9.0)
68
+ lint_roller (~> 1.1)
69
+ rubocop-performance (~> 1.26.0)
70
+ stringio (3.2.0)
71
+ test-unit (3.7.8)
19
72
  power_assert
73
+ tsort (0.2.0)
74
+ unicode-display_width (3.2.0)
75
+ unicode-emoji (~> 4.1)
76
+ unicode-emoji (4.2.0)
20
77
 
21
78
  PLATFORMS
22
- x86_64-darwin-20
79
+ arm64-darwin-25
80
+ ruby
23
81
 
24
82
  DEPENDENCIES
25
83
  rake (~> 13.0, >= 13.0.1)
84
+ rdoc
26
85
  simplecov
86
+ standard (~> 1.54.0)
27
87
  standup_md!
28
88
  test-unit (~> 3.3, >= 3.3.5)
29
89
 
90
+ CHECKSUMS
91
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
92
+ date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
93
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
94
+ erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9
95
+ json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
96
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
97
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
98
+ parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970
99
+ parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
100
+ power_assert (3.0.1) sha256=8ce9876716cc74e863fcd4cdcdc52d792bd983598d1af3447083a3a9a4d34103
101
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
102
+ psych (5.4.0) sha256=14f72d69a611af663d7d70e4a7b67d9eb1f3ae9f8d916b478961d5a0075ba5b7
103
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
104
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
105
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
106
+ rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
107
+ regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
108
+ rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
109
+ rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
110
+ rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
111
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
112
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
113
+ simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
114
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
115
+ standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100
116
+ standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
117
+ standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
118
+ standup_md (0.3.15)
119
+ stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
120
+ test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
121
+ tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
122
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
123
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
124
+
30
125
  BUNDLED WITH
31
- 2.2.16
126
+ 4.0.10
data/Rakefile CHANGED
@@ -1,21 +1,41 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'lib/standup_md'
4
- require 'bundler/gem_tasks'
5
- require 'rdoc/task'
6
- require 'rake/testtask'
3
+ $LOAD_PATH.unshift(File.expand_path("lib", __dir__))
4
+
5
+ require "standup_md"
6
+ require "bundler/gem_tasks"
7
+ require "rdoc/task"
8
+ require "rake/testtask"
9
+
10
+ STANDARD_FILES = ["lib", "test"].freeze
7
11
 
8
12
  Rake::TestTask.new do |t|
9
- t.libs = ['lib']
13
+ t.libs = ["lib"]
10
14
  t.warning = true
11
15
  t.verbose = true
12
- t.test_files = FileList['test/**/*_test.rb']
16
+ t.test_files = FileList["test/**/*_test.rb"]
13
17
  end
14
18
 
15
19
  RDoc::Task.new do |rdoc|
16
- rdoc.main = 'README.md'
17
- rdoc.rdoc_dir = 'docs'
18
- rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
20
+ rdoc.main = "README.md"
21
+ rdoc.rdoc_dir = "docs"
22
+ rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
23
+ end
24
+
25
+ desc "Lint with the Standard Ruby style guide"
26
+ task :standard do
27
+ require "standard"
28
+
29
+ exit_code = Standard::Cli.new(STANDARD_FILES).run
30
+ fail unless exit_code.zero?
31
+ end
32
+
33
+ desc "Lint and automatically make safe fixes with the Standard Ruby style guide"
34
+ task :"standard:fix" do
35
+ require "standard"
36
+
37
+ exit_code = Standard::Cli.new(STANDARD_FILES + ["--fix"]).run
38
+ fail unless exit_code.zero?
19
39
  end
20
40
 
21
41
  task default: :test
data/bin/standup CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/standup_md'
3
+ $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
4
+
5
+ require "standup_md"
4
6
 
5
7
  StandupMD::Cli.execute(ARGV)
@@ -20,7 +20,7 @@ module StandupMD
20
20
  next if !tasks || tasks.empty?
21
21
 
22
22
  puts sub_header(header_type)
23
- tasks.each { |task| puts config.file.bullet_character + ' ' + task }
23
+ tasks.each { |task| puts "#{config.file.bullet_character} #{task}" }
24
24
  end
25
25
  puts
26
26
  end
@@ -42,73 +42,73 @@ module StandupMD
42
42
  # @return [Hash]
43
43
  def load_runtime_preferences(options)
44
44
  OptionParser.new do |opts|
45
- opts.banner = 'The Standup Doctor'
45
+ opts.banner = "The Standup Doctor"
46
46
  opts.version = "[StandupMD] #{::StandupMD::Version}"
47
47
  opts.on(
48
- '--current ARRAY', Array,
48
+ "--current ARRAY", Array,
49
49
  "List of current entry's tasks"
50
50
  ) { |v| config.entry.current = v }
51
51
 
52
52
  opts.on(
53
- '--previous ARRAY', Array,
53
+ "--previous ARRAY", Array,
54
54
  "List of precious entry's tasks"
55
55
  ) { |v| config.entry.previous = v }
56
56
 
57
57
  opts.on(
58
- '--impediments ARRAY', Array,
59
- 'List of impediments for current entry'
58
+ "--impediments ARRAY", Array,
59
+ "List of impediments for current entry"
60
60
  ) { |v| config.entry.impediments = v }
61
61
 
62
62
  opts.on(
63
- '--notes ARRAY', Array,
64
- 'List of notes for current entry'
63
+ "--notes ARRAY", Array,
64
+ "List of notes for current entry"
65
65
  ) { |v| config.entry.notes = v }
66
66
 
67
67
  opts.on(
68
- '--sub-header-order ARRAY', Array,
69
- 'The order of the sub-headers when writing the file'
68
+ "--sub-header-order ARRAY", Array,
69
+ "The order of the sub-headers when writing the file"
70
70
  ) { |v| config.file.sub_header_order = v }
71
71
 
72
72
  opts.on(
73
- '-f', '--file-name-format STRING',
74
- 'Date-formattable string to use for standup file name'
73
+ "-f", "--file-name-format STRING",
74
+ "Date-formattable string to use for standup file name"
75
75
  ) { |v| config.file.name_format = v }
76
76
 
77
77
  opts.on(
78
- '-E', '--editor EDITOR',
79
- 'Editor to use for opening standup files'
78
+ "-E", "--editor EDITOR",
79
+ "Editor to use for opening standup files"
80
80
  ) { |v| config.cli.editor = v }
81
81
 
82
82
  opts.on(
83
- '-d', '--directory DIRECTORY',
84
- 'The directories where standup files are located'
83
+ "-d", "--directory DIRECTORY",
84
+ "The directories where standup files are located"
85
85
  ) { |v| config.file.directory = v }
86
86
 
87
87
  opts.on(
88
- '-w', '--[no-]write',
88
+ "-w", "--[no-]write",
89
89
  "Write current entry if it doesn't exist. Default is true"
90
90
  ) { |v| config.cli.write = v }
91
91
 
92
92
  opts.on(
93
- '-a', '--[no-]auto-fill-previous',
93
+ "-a", "--[no-]auto-fill-previous",
94
94
  "Auto-generate 'previous' tasks for new entries. Default is true"
95
95
  ) { |v| config.cli.auto_fill_previous = v }
96
96
 
97
97
  opts.on(
98
- '-e', '--[no-]edit',
99
- 'Open the file in the editor. Default is true'
98
+ "-e", "--[no-]edit",
99
+ "Open the file in the editor. Default is true"
100
100
  ) { |v| config.cli.edit = v }
101
101
 
102
102
  opts.on(
103
- '-v', '--[no-]verbose',
104
- 'Verbose output. Default is false.'
103
+ "-v", "--[no-]verbose",
104
+ "Verbose output. Default is false."
105
105
  ) { |v| config.cli.verbose = v }
106
106
 
107
107
  opts.on(
108
- '-p', '--print [DATE]',
109
- 'Print current entry.',
110
- 'If DATE is passed, will print entry for DATE, if it exists.',
111
- 'DATE must be in the same format as file-name-format'
108
+ "-p", "--print [DATE]",
109
+ "Print current entry.",
110
+ "If DATE is passed, will print entry for DATE, if it exists.",
111
+ "DATE must be in the same format as file-name-format"
112
112
  ) do |v|
113
113
  config.cli.print = true
114
114
  config.cli.date =
@@ -131,7 +131,7 @@ module StandupMD
131
131
  previous_entry(file),
132
132
  config.entry.impediments,
133
133
  config.entry.notes
134
- ).tap { |entry| file.entries << entry }
134
+ ).tap { |e| file.entries << e }
135
135
  end
136
136
 
137
137
  ##
@@ -170,7 +170,7 @@ module StandupMD
170
170
  #
171
171
  # @return [String]
172
172
  def header(entry)
173
- '#' * config.file.header_depth + ' ' +
173
+ "#" * config.file.header_depth + " " +
174
174
  entry.date.strftime(config.file.header_date_format)
175
175
  end
176
176
 
@@ -181,7 +181,7 @@ module StandupMD
181
181
  #
182
182
  # @return [String]
183
183
  def sub_header(header_type)
184
- '#' * config.file.sub_header_depth + ' ' +
184
+ "#" * config.file.sub_header_depth + " " +
185
185
  config.file.public_send("#{header_type}_header").capitalize
186
186
  end
187
187
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'optparse'
4
- require_relative 'cli/helpers'
3
+ require "optparse"
4
+ require "standup_md/cli/helpers"
5
5
 
6
6
  module StandupMD
7
7
  ##
@@ -60,7 +60,7 @@ module StandupMD
60
60
  # Constructor. Sets defaults.
61
61
  #
62
62
  # @param [Array] options
63
- def initialize(options = [], load_config = true)
63
+ def initialize(options = [], load_config: true)
64
64
  @config = self.class.config
65
65
  @preference_file_loaded = false
66
66
  @options = options
@@ -87,7 +87,7 @@ module StandupMD
87
87
  ##
88
88
  # Has the preference file been loaded?
89
89
  #
90
- # @return boolean
90
+ # @return [boolean]
91
91
  def preference_file_loaded?
92
92
  @preference_file_loaded
93
93
  end
@@ -111,7 +111,7 @@ module StandupMD
111
111
  end
112
112
 
113
113
  ##
114
- # Quick access to Cli.echo.
114
+ # Quick access to +Cli.echo+.
115
115
  #
116
116
  # @return [nil]
117
117
  def echo(msg)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
3
+ require "date"
4
4
 
5
5
  module StandupMD
6
6
  class Config
@@ -13,14 +13,14 @@ module StandupMD
13
13
  # @return [Hash]
14
14
  DEFAULTS = {
15
15
  date: Date.today,
16
- editor: ENV['VISUAL'] || ENV['EDITOR'] || 'vim',
16
+ editor: ENV["VISUAL"] || ENV["EDITOR"] || "vim",
17
17
  verbose: false,
18
18
  edit: true,
19
19
  write: true,
20
20
  print: false,
21
21
  auto_fill_previous: true,
22
22
  preference_file: ::File.expand_path(
23
- ::File.join(ENV['HOME'], '.standuprc')
23
+ ::File.join(ENV["HOME"], ".standuprc")
24
24
  )
25
25
  }.freeze
26
26
 
@@ -12,7 +12,7 @@ module StandupMD
12
12
  DEFAULTS = {
13
13
  current: ["<!-- ADD TODAY'S WORK HERE -->"],
14
14
  previous: [],
15
- impediments: ['None'],
15
+ impediments: ["None"],
16
16
  notes: []
17
17
  }.freeze
18
18
 
@@ -9,7 +9,7 @@ module StandupMD
9
9
  # The default options.
10
10
  #
11
11
  # @return [Hash]
12
- DEFAULTS = {}
12
+ DEFAULTS = {}.freeze
13
13
 
14
14
  ##
15
15
  # Initializes the config with default values.
@@ -10,19 +10,19 @@ module StandupMD
10
10
  #
11
11
  # @return [Hash]
12
12
  DEFAULTS = {
13
- header_date_format: '%Y-%m-%d',
13
+ header_date_format: "%Y-%m-%d",
14
14
  header_depth: 1,
15
15
  sub_header_depth: 2,
16
- current_header: 'Current',
17
- previous_header: 'Previous',
18
- impediments_header: 'Impediments',
19
- notes_header: 'Notes',
16
+ current_header: "Current",
17
+ previous_header: "Previous",
18
+ impediments_header: "Impediments",
19
+ notes_header: "Notes",
20
20
  sub_header_order: %w[previous current impediments notes],
21
- directory: ::File.join(ENV['HOME'], '.cache', 'standup_md'),
22
- bullet_character: '-',
23
- name_format: '%Y_%m.md',
24
- create: true,
25
- }
21
+ directory: ::File.join(ENV["HOME"], ".cache", "standup_md"),
22
+ bullet_character: "-",
23
+ name_format: "%Y_%m.md",
24
+ create: true
25
+ }.freeze
26
26
 
27
27
  ##
28
28
  # Number of octothorps that should preface entry headers.
@@ -154,7 +154,7 @@ module StandupMD
154
154
  #
155
155
  # @return [Integer]
156
156
  def header_depth=(depth)
157
- raise 'Header depth out of bounds (1..5)' if !depth.between?(1, 5)
157
+ raise "Header depth out of bounds (1..5)" if !depth.between?(1, 5)
158
158
 
159
159
  @sub_header_depth = depth + 1 if depth >= sub_header_depth
160
160
  @header_depth = depth
@@ -168,7 +168,7 @@ module StandupMD
168
168
  #
169
169
  # @return [Integer]
170
170
  def sub_header_depth=(depth)
171
- raise 'Sub-header depth out of bounds (2..6)' if !depth.between?(2, 6)
171
+ raise "Sub-header depth out of bounds (2..6)" if !depth.between?(2, 6)
172
172
 
173
173
  @header_depth = depth - 1 if depth <= header_depth
174
174
  @sub_header_depth = depth
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'config/cli'
4
- require_relative 'config/file'
5
- require_relative 'config/entry'
6
- require_relative 'config/entry_list'
3
+ require "standup_md/config/cli"
4
+ require "standup_md/config/file"
5
+ require "standup_md/config/entry"
6
+ require "standup_md/config/entry_list"
7
7
 
8
8
  module StandupMD
9
9
  ##
@@ -36,9 +36,9 @@ module StandupMD
36
36
  ##
37
37
  # Builds the links to the configuration classes.
38
38
  def initialize
39
- @cli = StandupMD::Config::Cli.new
40
- @file = StandupMD::Config::File.new
41
- @entry = StandupMD::Config::Entry.new
39
+ @cli = StandupMD::Config::Cli.new
40
+ @file = StandupMD::Config::File.new
41
+ @entry = StandupMD::Config::Entry.new
42
42
  @entry_list = StandupMD::Config::EntryList.new
43
43
  end
44
44
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
3
+ require "json"
4
4
 
5
5
  module StandupMD
6
6
  ##
@@ -100,10 +100,10 @@ module StandupMD
100
100
  def to_h
101
101
  {
102
102
  date => {
103
- 'current' => current,
104
- 'previous' => previous,
105
- 'impediments' => impediments,
106
- 'notes' => notes
103
+ "current" => current,
104
+ "previous" => previous,
105
+ "impediments" => impediments,
106
+ "notes" => notes
107
107
  }
108
108
  }
109
109
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
3
+ require "forwardable"
4
4
 
5
5
  module StandupMD
6
6
  ##
@@ -50,7 +50,7 @@ module StandupMD
50
50
  #
51
51
  # @return [StandupMD::Entry]
52
52
  def find(date)
53
- entries.bsearch { |e| e.date == date }
53
+ entries.bsearch { |entry| date <=> entry.date }
54
54
  end
55
55
 
56
56
  ##
@@ -71,7 +71,7 @@ module StandupMD
71
71
  end
72
72
 
73
73
  ##
74
- # Returns a copy of self sorted by date.
74
+ # Returns a copy of self sorted by date, reversed.
75
75
  #
76
76
  # @return [StandupMD::EntryList]
77
77
  def sort_reverse
@@ -111,12 +111,17 @@ module StandupMD
111
111
  #
112
112
  # @return [Hash]
113
113
  def to_h
114
- Hash[@entries.map { |e| [e.date, {
115
- 'current' => e.current,
116
- 'previous' => e.previous,
117
- 'impediments' => e.impediments,
118
- 'notes' => e.notes
119
- }]}]
114
+ @entries.map do |e|
115
+ [
116
+ e.date,
117
+ {
118
+ "current" => e.current,
119
+ "previous" => e.previous,
120
+ "impediments" => e.impediments,
121
+ "notes" => e.notes
122
+ }
123
+ ]
124
+ end.to_h
120
125
  end
121
126
 
122
127
  ##
@@ -149,7 +154,7 @@ module StandupMD
149
154
  def validate_entry(entry)
150
155
  return if entry.is_a?(StandupMD::Entry)
151
156
 
152
- raise ArgumentError, 'Entry must be an instance of StandupMD::Entry'
157
+ raise ArgumentError, "Entry must be an instance of StandupMD::Entry"
153
158
  end
154
159
  end
155
160
  end
@@ -16,11 +16,11 @@ module StandupMD
16
16
  end
17
17
 
18
18
  def header_regex # :nodoc:
19
- /^#{'#' * StandupMD.config.file.header_depth}\s+/
19
+ /^#{"#" * StandupMD.config.file.header_depth}\s+/
20
20
  end
21
21
 
22
22
  def sub_header_regex # :nodoc:
23
- /^#{'#' * StandupMD.config.file.sub_header_depth}\s+/
23
+ /^#{"#" * StandupMD.config.file.sub_header_depth}\s+/
24
24
  end
25
25
 
26
26
  def bullet_character_regex # :nodoc:
@@ -28,7 +28,7 @@ module StandupMD
28
28
  end
29
29
 
30
30
  def determine_section_type(line) # :nodoc:
31
- line = line.sub(/^\#{#{StandupMD.config.file.sub_header_depth}}\s*/, '')
31
+ line = line.sub(/^\#{#{StandupMD.config.file.sub_header_depth}}\s*/, "")
32
32
  [
33
33
  StandupMD.config.file.current_header,
34
34
  StandupMD.config.file.previous_header,
@@ -41,7 +41,7 @@ module StandupMD
41
41
  def new_entry(record) # :nodoc:
42
42
  Entry.new(
43
43
  Date.strptime(
44
- record['header'],
44
+ record["header"],
45
45
  StandupMD.config.file.header_date_format
46
46
  ),
47
47
  record[StandupMD.config.file.current_header],
@@ -52,13 +52,13 @@ module StandupMD
52
52
  end
53
53
 
54
54
  def header(date)
55
- '#' * StandupMD.config.file.header_depth +
56
- ' ' +
55
+ "#" * StandupMD.config.file.header_depth +
56
+ " " +
57
57
  date.strftime(StandupMD.config.file.header_date_format)
58
58
  end
59
59
 
60
60
  def sub_header(subhead)
61
- '#' * StandupMD.config.file.sub_header_depth + ' ' + subhead
61
+ "#" * StandupMD.config.file.sub_header_depth + " " + subhead
62
62
  end
63
63
  end
64
64
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
4
- require 'fileutils'
5
- require_relative 'file/helpers'
3
+ require "date"
4
+ require "fileutils"
5
+ require "standup_md/file/helpers"
6
6
 
7
7
  module StandupMD
8
8
  ##
@@ -10,58 +10,62 @@ module StandupMD
10
10
  class File
11
11
  include StandupMD::File::Helpers
12
12
 
13
- ##
14
- # Access to the class's configuration.
15
- #
16
- # @return [StandupMD::Config::EntryList]
17
- def self.config
18
- @config ||= StandupMD.config.file
19
- end
20
-
21
- ##
22
- # Convenience method for calling File.find(file_name).load
23
- #
24
- # @param [String] file_name
25
- #
26
- # @return [StandupMD::File]
27
- def self.load(file_name)
28
- unless ::File.directory?(config.directory)
29
- raise "Dir #{config.directory} not found." unless config.create
13
+ class << self
14
+ ##
15
+ # Access to the class's configuration.
16
+ #
17
+ # @return [StandupMD::Config::EntryList]
18
+ def config
19
+ @config ||= StandupMD.config.file
20
+ end
30
21
 
31
- FileUtils.mkdir_p(config.directory)
22
+ ##
23
+ # Convenience method for calling File.find(file_name).load
24
+ #
25
+ # @param [String] file_name
26
+ #
27
+ # @return [StandupMD::File]
28
+ def load(file_name)
29
+ unless ::File.directory?(config.directory)
30
+ raise "Dir #{config.directory} not found." unless config.create
31
+
32
+ FileUtils.mkdir_p(config.directory)
33
+ end
34
+ new(file_name).load
32
35
  end
33
- new(file_name).load
34
- end
35
36
 
36
- ##
37
- # Find standup file in directory by file name.
38
- #
39
- # @param [String] File_naem
40
- def self.find(file_name)
41
- unless ::File.directory?(config.directory)
42
- raise "Dir #{config.directory} not found." unless config.create
37
+ ##
38
+ # Find standup file in directory by file name.
39
+ #
40
+ # @param [String] File_naem
41
+ def find(file_name)
42
+ unless ::File.directory?(config.directory)
43
+ raise "Dir #{config.directory} not found." unless config.create
43
44
 
44
- FileUtils.mkdir_p(config.directory)
45
- end
46
- file = Dir.entries(config.directory).bsearch { |f| f == file_name }
47
- raise "File #{file_name} not found." if file.nil? && !config.create
45
+ FileUtils.mkdir_p(config.directory)
46
+ end
47
+ file_path = ::File.join(config.directory, file_name)
48
+ unless ::File.file?(file_path) || config.create
49
+ raise "File #{file_name} not found."
50
+ end
48
51
 
49
- new(file_name)
50
- end
52
+ new(file_name)
53
+ end
51
54
 
52
- ##
53
- # Find standup file in directory by Date object.
54
- #
55
- # @param [Date] date
56
- def self.find_by_date(date)
57
- raise ArgumentError, 'Must be a Date object' unless date.is_a?(Date)
55
+ ##
56
+ # Find standup file in directory by Date object.
57
+ #
58
+ # @param [Date] date
59
+ def find_by_date(date)
60
+ raise ArgumentError, "Must be a Date object" unless date.is_a?(Date)
58
61
 
59
- unless ::File.directory?(config.directory)
60
- raise "Dir #{config.directory} not found." unless config.create
62
+ unless ::File.directory?(config.directory)
63
+ raise "Dir #{config.directory} not found." unless config.create
61
64
 
62
- FileUtils.mkdir_p(config.directory)
65
+ FileUtils.mkdir_p(config.directory)
66
+ end
67
+ find(date.strftime(config.name_format))
63
68
  end
64
- find(date.strftime(config.name_format))
65
69
  end
66
70
 
67
71
  ##
@@ -141,7 +145,7 @@ module StandupMD
141
145
 
142
146
  entry_list = EntryList.new
143
147
  record = {}
144
- section_type = ''
148
+ section_type = ""
145
149
  ::File.foreach(name) do |line|
146
150
  line.chomp!
147
151
  next if line.strip.empty?
@@ -151,14 +155,14 @@ module StandupMD
151
155
  entry_list << new_entry(record)
152
156
  record = {}
153
157
  end
154
- record['header'] = line.sub(/^\#{#{@config.header_depth}}\s*/, '')
158
+ record["header"] = line.sub(/^\#{#{@config.header_depth}}\s*/, "")
155
159
  section_type = @config.notes_header
156
160
  record[section_type] = []
157
161
  elsif sub_header?(line)
158
162
  section_type = determine_section_type(line)
159
163
  record[section_type] = []
160
164
  else
161
- record[section_type] << line.sub(bullet_character_regex, '')
165
+ record[section_type] << line.sub(bullet_character_regex, "")
162
166
  end
163
167
  end
164
168
  entry_list << new_entry(record) unless record.empty?
@@ -181,7 +185,7 @@ module StandupMD
181
185
  sorted_entries = entries.sort
182
186
  start_date = dates.fetch(:start_date, sorted_entries.first.date)
183
187
  end_date = dates.fetch(:end_date, sorted_entries.last.date)
184
- ::File.open(name, 'w') do |f|
188
+ ::File.open(name, "w") do |f|
185
189
  sorted_entries.filter(start_date, end_date).sort_reverse.each do |entry|
186
190
  f.puts header(entry.date)
187
191
  @config.sub_header_order.each do |attr|
@@ -189,7 +193,7 @@ module StandupMD
189
193
  next if !tasks || tasks.empty?
190
194
 
191
195
  f.puts sub_header(@config.public_send("#{attr}_header").capitalize)
192
- tasks.each { |task| f.puts @config.bullet_character + ' ' + task }
196
+ tasks.each { |task| f.puts "#{@config.bullet_character} #{task}" }
193
197
  end
194
198
  f.puts
195
199
  end
@@ -21,7 +21,7 @@ module StandupMD
21
21
  # Patch version.
22
22
  #
23
23
  # @return [Integer]
24
- PATCH = 14
24
+ PATCH = 15
25
25
 
26
26
  ##
27
27
  # Version as +[MAJOR, MINOR, PATCH]+
@@ -36,7 +36,7 @@ module StandupMD
36
36
  #
37
37
  # @return [String]
38
38
  def self.to_s
39
- to_a.join('.')
39
+ to_a.join(".")
40
40
  end
41
41
 
42
42
  ##
@@ -44,7 +44,7 @@ module StandupMD
44
44
  #
45
45
  # @return [Hash]
46
46
  def self.to_h
47
- Hash[%i[major minor patch].zip(to_a)]
47
+ %i[major minor patch].zip(to_a).to_h
48
48
  end
49
49
  end
50
50
 
data/lib/standup_md.rb CHANGED
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'standup_md/version'
4
- require_relative 'standup_md/file'
5
- require_relative 'standup_md/entry'
6
- require_relative 'standup_md/entry_list'
7
- require_relative 'standup_md/cli'
8
- require_relative 'standup_md/config'
3
+ require "standup_md/version"
4
+ require "standup_md/file"
5
+ require "standup_md/entry"
6
+ require "standup_md/entry_list"
7
+ require "standup_md/cli"
8
+ require "standup_md/config"
9
9
 
10
10
  ##
11
11
  # The main module for the gem. Provides access to configuration classes.
12
12
  module StandupMD
13
13
  @config_file_loaded = false
14
14
 
15
+ module_function
16
+
15
17
  ##
16
18
  # Method for accessing the configuration.
17
19
  #
18
- # @return [StanupMD::Cli]
19
- def self.config
20
+ # @return [StanupMD::Config]
21
+ def config
20
22
  @config || reset_config
21
23
  end
22
24
 
@@ -24,7 +26,7 @@ module StandupMD
24
26
  # Reset all configuration values to their defaults.
25
27
  #
26
28
  # @return [StandupMD::Config]
27
- def self.reset_config
29
+ def reset_config
28
30
  @config = StandupMD::Config.new
29
31
  end
30
32
 
@@ -33,7 +35,7 @@ module StandupMD
33
35
  #
34
36
  # @example
35
37
  # StandupMD.configure { |s| s.cli.editor = 'mate' }
36
- def self.configure
38
+ def configure
37
39
  yield config
38
40
  end
39
41
 
@@ -41,7 +43,7 @@ module StandupMD
41
43
  # Has a config file been loaded?
42
44
  #
43
45
  # @return [Boolean]
44
- def self.config_file_loaded?
46
+ def config_file_loaded?
45
47
  @config_file_loaded
46
48
  end
47
49
 
@@ -51,8 +53,8 @@ module StandupMD
51
53
  # @param [String] file
52
54
  #
53
55
  # @return [String] file
54
- def self.load_config_file(file)
55
- ::File.expand_path(file).tap do |file|
56
+ def load_config_file(config_file)
57
+ ::File.expand_path(config_file).tap do |file|
56
58
  raise "File #{file} does not exist." unless ::File.file?(file)
57
59
 
58
60
  @config_file_loaded = true
data/standup_md.gemspec CHANGED
@@ -1,36 +1,37 @@
1
- require_relative 'lib/standup_md/version'
1
+ require_relative "lib/standup_md/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = 'standup_md'
5
- spec.version = StandupMD::VERSION
6
- spec.authors = ['Evan Gray']
7
- spec.email = 'evanthegrayt@vivaldi.net'
8
- spec.license = 'MIT'
9
- spec.date = Time.now.strftime('%Y-%m-%d')
4
+ spec.name = "standup_md"
5
+ spec.version = StandupMD::VERSION
6
+ spec.authors = ["Evan Gray"]
7
+ spec.email = "evanthegrayt@vivaldi.net"
8
+ spec.license = "MIT"
10
9
 
11
- spec.summary = %q{The cure for all your standup woes}
12
- spec.description = %q{Generate and edit standups in markdown format}
13
- spec.homepage = 'https://evanthegrayt.github.io/standup_md/'
10
+ spec.summary = %(The cure for all your standup woes)
11
+ spec.description = %(Generate and edit standups in markdown format)
12
+ spec.homepage = "https://evanthegrayt.github.io/standup_md/"
14
13
 
15
14
  unless spec.respond_to?(:metadata)
16
- raise 'RubyGems 2.0 or newer is required to protect against ' \
17
- 'public gem pushes.'
15
+ raise "RubyGems 2.0 or newer is required to protect against " \
16
+ "public gem pushes."
18
17
  end
19
18
 
20
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] =
23
- 'https://github.com/evanthegrayt/standup_md'
24
- spec.metadata['documentation_uri'] =
25
- 'https://evanthegrayt.github.io/standup_md/'
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] =
22
+ "https://github.com/evanthegrayt/standup_md"
23
+ spec.metadata["documentation_uri"] =
24
+ "https://evanthegrayt.github.io/standup_md/"
26
25
 
27
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
27
  f.match(%r{^(test|spec|features)/})
29
28
  end
30
- spec.bindir = 'bin'
31
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
32
- spec.require_paths = ['lib']
33
- spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
34
- spec.add_development_dependency 'test-unit', '~> 3.3', '>= 3.3.5'
35
- spec.add_development_dependency 'simplecov'
29
+ spec.bindir = "bin"
30
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+ spec.add_development_dependency "rake", "~> 13.0", ">= 13.0.1"
33
+ spec.add_development_dependency "rdoc"
34
+ spec.add_development_dependency "simplecov"
35
+ spec.add_development_dependency "standard", "~> 1.54.0"
36
+ spec.add_development_dependency "test-unit", "~> 3.3", ">= 3.3.5"
36
37
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Gray
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -31,25 +30,19 @@ dependencies:
31
30
  - !ruby/object:Gem::Version
32
31
  version: 13.0.1
33
32
  - !ruby/object:Gem::Dependency
34
- name: test-unit
33
+ name: rdoc
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.3'
40
36
  - - ">="
41
37
  - !ruby/object:Gem::Version
42
- version: 3.3.5
38
+ version: '0'
43
39
  type: :development
44
40
  prerelease: false
45
41
  version_requirements: !ruby/object:Gem::Requirement
46
42
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '3.3'
50
43
  - - ">="
51
44
  - !ruby/object:Gem::Version
52
- version: 3.3.5
45
+ version: '0'
53
46
  - !ruby/object:Gem::Dependency
54
47
  name: simplecov
55
48
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +57,40 @@ dependencies:
64
57
  - - ">="
65
58
  - !ruby/object:Gem::Version
66
59
  version: '0'
60
+ - !ruby/object:Gem::Dependency
61
+ name: standard
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 1.54.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 1.54.0
74
+ - !ruby/object:Gem::Dependency
75
+ name: test-unit
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.3'
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 3.3.5
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '3.3'
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 3.3.5
67
94
  description: Generate and edit standups in markdown format
68
95
  email: evanthegrayt@vivaldi.net
69
96
  executables:
@@ -102,7 +129,6 @@ metadata:
102
129
  homepage_uri: https://evanthegrayt.github.io/standup_md/
103
130
  source_code_uri: https://github.com/evanthegrayt/standup_md
104
131
  documentation_uri: https://evanthegrayt.github.io/standup_md/
105
- post_install_message:
106
132
  rdoc_options: []
107
133
  require_paths:
108
134
  - lib
@@ -117,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
143
  - !ruby/object:Gem::Version
118
144
  version: '0'
119
145
  requirements: []
120
- rubygems_version: 3.2.3
121
- signing_key:
146
+ rubygems_version: 4.0.10
122
147
  specification_version: 4
123
148
  summary: The cure for all your standup woes
124
149
  test_files: []