mkmatter 3.1.18 → 3.2.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/README.md +9 -3
- data/lib/mkmatter/answers.rb +19 -20
- data/lib/mkmatter/cli/app.rb +17 -18
- data/lib/mkmatter/questions.rb +31 -44
- data/lib/mkmatter/version.rb +1 -1
- data/mkmatter.gemspec +8 -8
- metadata +43 -59
- data/LICENSE.txt +0 -21
- data/lib/minitest/xs_and_os_plugin.rb +0 -206
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 985cf93b9ef0d39c5e217e52fa84bfd67eb7c147fb16e44bd42af61e6b6ba523
|
4
|
+
data.tar.gz: 648d7ae5a84fdbe29093f1b2f1645944720e6dc5f65e40b0ee2ecb58704e9327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d124c6644cee5b680dbb9ceb3638882544ef723df471112bb47cec198bd0b85b4bcf3ad7b5c90b80140c4076ce3e6a82f85de3bc7e9c66eded08fa41ad590539
|
7
|
+
data.tar.gz: 0c96a0be07c0fd565d4e9ea5fa390049aae54f1d7f4357b8808fbce1797cb917ecb71b45884023bdfdf836321780bb6fe0d8547911c001616096baec8136b13a
|
data/README.md
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
# mkmatter
|
2
2
|
|
3
|
+
<img src="https://uploads.iotaspencer.me/mkmatter_logo_3_face_2.png" width="200px" height="200px">
|
3
4
|
[](https://rubygems.org/gems/mkmatter)
|
4
5
|
[](https://github.com/IotaSpencer/mkmatter/tree/)
|
5
6
|
|
6
|
-
[](https://rubygems.org/gems/mkmatter)
|
8
|
+
[](https://rubygems.org/gems/mkmatter)
|
8
9
|
[](https://opensource.org/licenses/MIT)
|
9
10
|
|
10
11
|
[](https://forthebadge.com)
|
11
12
|
[](https://forthebadge.com)
|
12
13
|
[](https://forthebadge.com)
|
13
14
|
|
15
|
+
### Coding Activity
|
16
|
+
|
17
|
+
[](https://wakatime.com/badge/user/5ce38313-6fca-4c1e-b156-14447557e40f/project/339be810-d008-4a2a-8436-fe8675241c36)
|
18
|
+
|
19
|
+
|
14
20
|
## Contact
|
15
21
|
|
16
22
|
If you install `mkmatter` Please let me know, I'd love to know the people using this!
|
@@ -18,7 +24,7 @@ If you install `mkmatter` Please let me know, I'd love to know the people using
|
|
18
24
|
[](mailto:me@iotaspencer.me)
|
19
25
|
[](https://twitter.com/KenISpencer)
|
20
26
|
[](https://iotaspencer.me)
|
21
|
-
|
27
|
+
|
22
28
|
|
23
29
|
## About mkmatter
|
24
30
|
|
data/lib/mkmatter/answers.rb
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'time'
|
3
|
-
require 'highline'
|
4
3
|
require 'mkmatter/helpers'
|
5
4
|
module Mkmatter
|
6
|
-
class Answers
|
7
|
-
attr_accessor :title, :tags, :categories
|
8
|
-
|
9
|
-
attr_accessor :slug_date, :answer_hash
|
10
|
-
attr_accessor :published, :file_format
|
11
|
-
attr_accessor :matter
|
12
|
-
attr_accessor :extra_fields
|
13
|
-
attr_accessor :summary
|
5
|
+
class Answers < Object
|
6
|
+
attr_accessor :title, :tags, :categories, :date, :draft, :slug_date, \
|
7
|
+
:answer_hash, :published, :file_format, :matter, :extra_fields, :summary
|
14
8
|
|
15
9
|
def initialize(question_hash, publish, include_post_fields = true)
|
16
10
|
@title = question_hash[:title]
|
@@ -20,9 +14,11 @@ module Mkmatter
|
|
20
14
|
end
|
21
15
|
@tags = question_hash[:tags] if question_hash[:tags].nil? == false
|
22
16
|
@categories = question_hash[:categories] if question_hash[:categories].nil? == false
|
23
|
-
|
17
|
+
if include_post_fields == true || @layout == 'post'
|
18
|
+
Time.zone = get_time_zone_full(Time.now.getlocal) || 'Eastern Time (US & Canada)'
|
19
|
+
end
|
24
20
|
# Time.zone = question_hash[:time_zone] || Time.now.zone
|
25
|
-
@now
|
21
|
+
@now = Time.zone.now || Time.now.getlocal
|
26
22
|
@date = @now.to_s if include_post_fields == true
|
27
23
|
@slug_date = @now.strftime('%Y-%m-%d') if include_post_fields == true
|
28
24
|
@published = publish
|
@@ -32,15 +28,15 @@ module Mkmatter
|
|
32
28
|
@summary = question_hash[:summary] unless question_hash[:summary].empty?
|
33
29
|
end
|
34
30
|
|
35
|
-
@matter
|
36
|
-
|
37
|
-
|
31
|
+
@matter = {
|
32
|
+
layout: @layout,
|
33
|
+
title: @title
|
38
34
|
}
|
39
|
-
if @layout == 'post'
|
40
|
-
@matter[:tags] =
|
35
|
+
if @layout == 'post' || include_post_fields
|
36
|
+
@matter[:tags] = @tags if @tags
|
41
37
|
@matter[:categories] = @categories if @categories
|
42
|
-
@matter[:summary] =
|
43
|
-
@matter[:date] =
|
38
|
+
@matter[:summary] = @summary if @summary
|
39
|
+
@matter[:date] = @date
|
44
40
|
|
45
41
|
end
|
46
42
|
if @draft
|
@@ -52,19 +48,22 @@ module Mkmatter
|
|
52
48
|
@matter[:published] = @published if publish
|
53
49
|
end
|
54
50
|
|
55
|
-
|
51
|
+
# @return [Hash] returns attribute `.matter`
|
56
52
|
def to_h
|
57
53
|
@matter
|
58
54
|
end
|
59
55
|
|
56
|
+
def [](arg)
|
57
|
+
self.instance_variable_get("@#{arg}")
|
58
|
+
end
|
60
59
|
# @param [Hash] hash other hash
|
61
60
|
# @return [nil] merges hash into attribute `.matter`
|
62
61
|
def to_h=(hash)
|
63
62
|
@matter.merge!(hash)
|
64
63
|
end
|
64
|
+
|
65
65
|
def to_yaml(*args, **kwargs)
|
66
66
|
@matter.stringify_keys.to_yaml(*args, **kwargs)
|
67
67
|
end
|
68
|
-
|
69
68
|
end
|
70
69
|
end
|
data/lib/mkmatter/cli/app.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require "thor"
|
2
|
-
require "highline"
|
3
|
-
require "slugity/extend_string"
|
4
|
-
require "yaml"
|
5
1
|
require "active_support/all"
|
6
|
-
require "
|
7
|
-
require "os"
|
8
|
-
require "rbconfig"
|
2
|
+
require "highline"
|
9
3
|
require "mkmatter/version"
|
10
4
|
require "mkmatter/cli/subs"
|
11
5
|
require 'mkmatter/cli/descriptions'
|
6
|
+
require "os"
|
7
|
+
require "rbconfig"
|
8
|
+
require "slugity"
|
9
|
+
require "terminal-table"
|
10
|
+
require "thor"
|
11
|
+
require "yaml"
|
12
12
|
|
13
13
|
module Mkmatter
|
14
14
|
module App
|
@@ -84,10 +84,8 @@ module Mkmatter
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
option :publish, :type => :boolean
|
88
87
|
option :index, :type => :boolean, :default => nil
|
89
88
|
option :type, :type => :string, :default => "post"
|
90
|
-
option :draft, :type => :boolean, :default => nil
|
91
89
|
option :'include-post-qs', :type => :boolean, :default => false,
|
92
90
|
desc: "Include post questions in the prompt"
|
93
91
|
option :'dry-run', :type => :boolean, :default => false
|
@@ -98,15 +96,16 @@ module Mkmatter
|
|
98
96
|
@questions = Mkmatter::Questions.new.ask(options[:type], options[:include_post_qs])
|
99
97
|
answers = Mkmatter::Answers.new(@questions, options[:publish], options[:include_post_qs])
|
100
98
|
draft_folder = "_drafts"
|
101
|
-
filename = [].concat([answers
|
99
|
+
filename = [].concat([answers['slug_date'], '-', Slugity::Convert.slug(answers['title']), '.', answers['file_format'].downcase]).join
|
102
100
|
|
103
101
|
path = Pathname("./#{filename}").realdirpath
|
104
|
-
|
105
|
-
|
102
|
+
hl = HighLine.new
|
103
|
+
if hl.agree("Would you like to put this page into a subdirectory? ", true)
|
104
|
+
hl.say(<<~FOLDERDOC)
|
106
105
|
What path? (directories will be created if they don't exist, relative to Jekyll root)
|
107
|
-
|
106
|
+
|
108
107
|
FOLDERDOC
|
109
|
-
folder =
|
108
|
+
folder = hl.ask("? ") do |q|
|
110
109
|
q.confirm = true
|
111
110
|
q.default = "."
|
112
111
|
q.validate = /^[^\/].*$/
|
@@ -115,12 +114,12 @@ module Mkmatter
|
|
115
114
|
end
|
116
115
|
folder = Pathname(folder)
|
117
116
|
if options[:'dry-run']
|
118
|
-
|
117
|
+
hl.say("Would create #{File.join(Pathname("."), folder)}")
|
119
118
|
else
|
120
119
|
begin
|
121
120
|
FileUtils.mkdir_p(File.join(Mkmatter::Methods.get_jekyll_root, folder))
|
122
121
|
rescue Errno::EEXIST
|
123
|
-
|
122
|
+
hl.say("<%= color('Error', :red, :bold) %>:Insufficient Permissions")
|
124
123
|
exit 1
|
125
124
|
end
|
126
125
|
end
|
@@ -134,8 +133,8 @@ module Mkmatter
|
|
134
133
|
end
|
135
134
|
end
|
136
135
|
if options[:'dry-run']
|
137
|
-
|
138
|
-
|
136
|
+
hl.say("Would create '#{path}'")
|
137
|
+
hl.say("Would output \n#{answers.to_yaml(indentation: 2)}\n---\n\n")
|
139
138
|
else
|
140
139
|
File.open(path.to_path, "a") do |fd|
|
141
140
|
fd.puts answers.to_yaml(indentation: 2)
|
data/lib/mkmatter/questions.rb
CHANGED
@@ -1,18 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'highline'
|
3
4
|
|
4
5
|
module Mkmatter
|
5
6
|
class Questions
|
6
7
|
attr :answers
|
7
|
-
|
8
|
-
|
9
|
-
# known_questions = const_get(cls).methods.sort.delete_if { |m| m.to_s !~ /^get_.*$/ }
|
10
|
-
# known_questions.each do |m|
|
11
|
-
# @answers[:layout] = cls.to_s.lower
|
12
|
-
# @answers[m.to_s.gsub(/^get_[0-9]{3}_/, "")] = method(m).call
|
13
|
-
# end
|
14
|
-
# @answers
|
15
|
-
# end
|
8
|
+
|
9
|
+
@@hl = HighLine.new
|
16
10
|
|
17
11
|
def ask(type, include_post_qs)
|
18
12
|
known_questions = methods.sort.delete_if { |m| m.to_s !~ /^get_.*$/ }
|
@@ -36,47 +30,43 @@ module Mkmatter
|
|
36
30
|
end
|
37
31
|
known_questions.each do |m|
|
38
32
|
@answers[:layout] = type
|
39
|
-
@answers[m.to_s.gsub(/^get_[0-9]{3}_/,
|
33
|
+
@answers[m.to_s.gsub(/^get_[0-9]{3}_/, '').to_sym] = method(m).call
|
40
34
|
end
|
41
35
|
@answers
|
42
36
|
end
|
43
37
|
|
44
|
-
# @!visibility private
|
45
38
|
def initialize
|
46
|
-
@answers =
|
47
|
-
@hl = HighLine.new
|
39
|
+
@answers = {}
|
48
40
|
end
|
49
41
|
|
50
42
|
def get_001_title
|
51
|
-
|
52
|
-
|
53
|
-
if hl.agree("Would you like it 'titleized' (Title instead of title)? ", true)
|
43
|
+
title = @@hl.ask 'Title: '
|
44
|
+
if @@hl.agree("Would you like it 'titleized' (Title instead of title)? ", true)
|
54
45
|
title.titleize
|
55
46
|
else
|
56
47
|
title
|
57
48
|
end
|
49
|
+
title # =>
|
58
50
|
end
|
59
51
|
|
60
52
|
# @return [Array]
|
61
53
|
def get_002_tags
|
62
|
-
|
63
|
-
hl.ask("Tags? (write one on each line, then press '.' then press 'Enter')") do |q|
|
54
|
+
tags = @@hl.ask("Tags? (write one on each line, then press '.' then press 'Enter') ") do |q|
|
64
55
|
q.gather = '.'
|
65
56
|
end
|
57
|
+
tags
|
66
58
|
end
|
67
59
|
|
68
60
|
# @return [Array]
|
69
61
|
def get_003_categories
|
70
|
-
hl
|
71
|
-
hl.ask("Categories? (write one on each line, then press '.' then press 'Enter')") do |q|
|
62
|
+
@@hl.ask("Categories? (write one on each line, then press '.' then press 'Enter')") do |q|
|
72
63
|
q.gather = '.'
|
73
64
|
end
|
74
65
|
end
|
75
66
|
|
76
67
|
# @return [String]
|
77
68
|
def get_004_file_format
|
78
|
-
hl
|
79
|
-
hl.choose do |menu|
|
69
|
+
@@hl.choose do |menu|
|
80
70
|
menu.header = "Choose whether you want HTML or Markdown"
|
81
71
|
menu.choice "html" do
|
82
72
|
return "html"
|
@@ -90,54 +80,51 @@ module Mkmatter
|
|
90
80
|
|
91
81
|
# @return [String]
|
92
82
|
def get_005_extra_fields
|
93
|
-
hl = @hl
|
94
83
|
fields = {}
|
95
|
-
custom_fields =
|
84
|
+
custom_fields = []
|
96
85
|
cfh = nil
|
97
|
-
if hl.agree("Do you want to add custom fields? ", true)
|
98
|
-
hl.say(<<~EXTRA_FIELDS)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
86
|
+
if @@hl.agree("Do you want to add custom fields? ", true)
|
87
|
+
@@hl.say(<<~EXTRA_FIELDS)
|
88
|
+
These fields will be usable as {{LAYOUT_TYPE.FIELD}} in pages/posts etc.
|
89
|
+
Your fields should be inputted as FIELD=>TEXT HERE
|
90
|
+
Type 'EOL' on a new line then press Enter when you are done.
|
91
|
+
<%= color('NOTE', :bold, RED) %>: Input is <%= color('NOT', :bold, RED) %> evaluated!
|
103
92
|
EXTRA_FIELDS
|
104
|
-
custom_fields = hl.ask(
|
93
|
+
custom_fields = @@hl.ask('Fields?') do |q|
|
105
94
|
q.gather = '.'
|
106
95
|
end
|
107
96
|
end
|
108
|
-
|
97
|
+
unless custom_fields.empty?
|
109
98
|
custom_fields.each do |field|
|
110
99
|
fields.store(field.to_sym, 'nil')
|
111
100
|
end
|
112
|
-
end
|
101
|
+
end
|
113
102
|
if custom_fields.empty?
|
114
|
-
hl.say(
|
103
|
+
@@hl.say('No extra fields were added.')
|
115
104
|
return
|
116
105
|
else
|
117
|
-
hl.say("#{fields} #{fields.class}")
|
118
|
-
cfh = hl.ask("Value of field '<%= key %>'?") do |q|
|
106
|
+
# @@hl.say("#{fields} #{fields.class}")
|
107
|
+
cfh = @@hl.ask("Value of field '<%= key %>'?") do |q|
|
119
108
|
q.gather = fields
|
120
109
|
end
|
121
110
|
end
|
122
111
|
cfh
|
123
112
|
end
|
124
113
|
|
125
|
-
# @return [OpenStruct]
|
126
114
|
def get_006_summary
|
127
|
-
hl = @hl
|
128
115
|
summary = nil
|
129
|
-
summary_if = hl.agree(
|
116
|
+
summary_if = @@hl.agree('Summary? ', true)
|
130
117
|
if summary_if
|
131
|
-
summary = hl.ask(<<~SUMMARYDOC) do |q|
|
118
|
+
summary = @@hl.ask(<<~SUMMARYDOC) do |q|
|
132
119
|
Input a summary of the post.
|
133
120
|
This will be outputted as a summary in the front matter.
|
134
121
|
This is useful for a post that is long and you want to
|
135
122
|
show a summary of the post.
|
136
123
|
SUMMARYDOC
|
137
|
-
q.gather =
|
124
|
+
q.gather = '.'
|
138
125
|
end
|
139
126
|
end
|
140
|
-
summary.join("\n")
|
127
|
+
summary.join("\n") if summary
|
141
128
|
end
|
142
129
|
end
|
143
130
|
end
|
data/lib/mkmatter/version.rb
CHANGED
data/mkmatter.gemspec
CHANGED
@@ -35,21 +35,21 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.executables << 'mkmatter'
|
36
36
|
spec.require_paths = ['lib']
|
37
37
|
|
38
|
-
spec.add_runtime_dependency 'highline', '~> 3.1.2'
|
39
38
|
spec.add_runtime_dependency 'activesupport', '~> 8.0.2'
|
39
|
+
spec.add_runtime_dependency 'front_matter_parser', '~> 1.0.1'
|
40
40
|
spec.add_runtime_dependency 'git', '~> 3.1.0'
|
41
|
-
spec.add_runtime_dependency '
|
42
|
-
spec.add_runtime_dependency '
|
43
|
-
spec.add_runtime_dependency 'ostruct'
|
44
|
-
spec.add_runtime_dependency 'terminal-table', '~> 4.0.0'
|
41
|
+
spec.add_runtime_dependency 'highline', '~> 3.1.2'
|
42
|
+
spec.add_runtime_dependency 'micro_install', '~> 0.4.2'
|
45
43
|
spec.add_runtime_dependency 'os', '~> 1.1.4'
|
46
44
|
spec.add_runtime_dependency 'paint', '~> 2.3.0'
|
47
|
-
spec.add_runtime_dependency 'front_matter_parser', '~> 1.0.1'
|
48
45
|
spec.add_runtime_dependency 'rake', '13.2.1'
|
49
|
-
spec.add_runtime_dependency '
|
46
|
+
spec.add_runtime_dependency 'slugity', '~> 1.1'
|
47
|
+
spec.add_runtime_dependency 'terminal-table', '~> 4.0.0'
|
48
|
+
spec.add_runtime_dependency 'thor', '~> 1.4.0'
|
49
|
+
|
50
|
+
spec.add_development_dependency 'bump', '~> 0.10.0'
|
50
51
|
spec.add_development_dependency 'bundler', '~> 2.6.9'
|
51
52
|
spec.add_development_dependency 'cancun', '~> 0.2.2'
|
52
|
-
spec.add_development_dependency 'bump', '~> 0.10.0'
|
53
53
|
spec.add_development_dependency 'minitest', '~> 5'
|
54
54
|
spec.add_development_dependency 'minitest-reporters', '~> 1.6.1'
|
55
55
|
spec.add_development_dependency 'rspec', '~> 3.13.1'
|
metadata
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkmatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Spencer
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
|
-
name:
|
13
|
+
name: activesupport
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
18
|
+
version: 8.0.2
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
25
|
+
version: 8.0.2
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: front_matter_parser
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 1.0.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.0.1
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: git
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,131 +52,131 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 3.1.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: highline
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 3.1.2
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 3.1.2
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: micro_install
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 0.4.2
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 0.4.2
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: os
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - "
|
86
|
+
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.1.4
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 1.1.4
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
|
-
name:
|
97
|
+
name: paint
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 2.3.0
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 2.3.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: rake
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 13.2.1
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - '='
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
123
|
+
version: 13.2.1
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
|
-
name:
|
125
|
+
name: slugity
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
130
|
+
version: '1.1'
|
131
131
|
type: :runtime
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
137
|
+
version: '1.1'
|
138
138
|
- !ruby/object:Gem::Dependency
|
139
|
-
name:
|
139
|
+
name: terminal-table
|
140
140
|
requirement: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
144
|
+
version: 4.0.0
|
145
145
|
type: :runtime
|
146
146
|
prerelease: false
|
147
147
|
version_requirements: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
151
|
+
version: 4.0.0
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
|
-
name:
|
153
|
+
name: thor
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- -
|
156
|
+
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
158
|
+
version: 1.4.0
|
159
159
|
type: :runtime
|
160
160
|
prerelease: false
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 1.4.0
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
|
-
name:
|
167
|
+
name: bump
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 0.
|
173
|
-
type: :
|
172
|
+
version: 0.10.0
|
173
|
+
type: :development
|
174
174
|
prerelease: false
|
175
175
|
version_requirements: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
179
|
+
version: 0.10.0
|
180
180
|
- !ruby/object:Gem::Dependency
|
181
181
|
name: bundler
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,20 +205,6 @@ dependencies:
|
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: 0.2.2
|
208
|
-
- !ruby/object:Gem::Dependency
|
209
|
-
name: bump
|
210
|
-
requirement: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - "~>"
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: 0.10.0
|
215
|
-
type: :development
|
216
|
-
prerelease: false
|
217
|
-
version_requirements: !ruby/object:Gem::Requirement
|
218
|
-
requirements:
|
219
|
-
- - "~>"
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: 0.10.0
|
222
208
|
- !ruby/object:Gem::Dependency
|
223
209
|
name: minitest
|
224
210
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,14 +263,12 @@ files:
|
|
277
263
|
- ".travis.yml"
|
278
264
|
- Gemfile
|
279
265
|
- LICENSE
|
280
|
-
- LICENSE.txt
|
281
266
|
- README.md
|
282
267
|
- Rakefile
|
283
268
|
- bin/console
|
284
269
|
- bin/mkmatter
|
285
270
|
- bin/setup
|
286
271
|
- features/support/env.rb
|
287
|
-
- lib/minitest/xs_and_os_plugin.rb
|
288
272
|
- lib/mkmatter.rb
|
289
273
|
- lib/mkmatter/answers.rb
|
290
274
|
- lib/mkmatter/cli.rb
|
@@ -335,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
319
|
- !ruby/object:Gem::Version
|
336
320
|
version: '0'
|
337
321
|
requirements: []
|
338
|
-
rubygems_version: 3.
|
322
|
+
rubygems_version: 3.7.1
|
339
323
|
specification_version: 4
|
340
324
|
summary: Script facilitating easy content creation and generation for Jekyll Sites
|
341
325
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Ken Spencer
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
@@ -1,206 +0,0 @@
|
|
1
|
-
require 'minitest'
|
2
|
-
require 'minitest/reporters/base_reporter'
|
3
|
-
module Minitest
|
4
|
-
module Reporters
|
5
|
-
def plugin_xs_and_os_init
|
6
|
-
Minitest.reporter.reporters.clear
|
7
|
-
Minitest.reporter << TravisReporter.new(options[:io], options)
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
class TravisReporter < Minitest::Reporters::BaseReporter
|
12
|
-
@@color_for_result_code = {
|
13
|
-
'.' => :green,
|
14
|
-
'E' => :red,
|
15
|
-
'F' => :red,
|
16
|
-
'$' => :yellow
|
17
|
-
}
|
18
|
-
@@result_code_to_unicode = {
|
19
|
-
'.' => "\u{2714}",
|
20
|
-
'F' => "\u{2718}",
|
21
|
-
'E' => "\u{203C}",
|
22
|
-
'$' => "\u{26A1}"
|
23
|
-
}
|
24
|
-
@@color = {
|
25
|
-
red: 31,
|
26
|
-
green: 32,
|
27
|
-
yellow: 33,
|
28
|
-
blue: 34
|
29
|
-
}
|
30
|
-
|
31
|
-
def initialize(*)
|
32
|
-
super
|
33
|
-
@color_enabled = io.respond_to?(:tty?) && io.tty?
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def record(result)
|
38
|
-
super
|
39
|
-
puts
|
40
|
-
print result.class_name
|
41
|
-
print ' '
|
42
|
-
print self.result_name result.name
|
43
|
-
print ' ['
|
44
|
-
print_result_code(result.result_code)
|
45
|
-
print ']'
|
46
|
-
end
|
47
|
-
|
48
|
-
def start
|
49
|
-
super
|
50
|
-
io.print "Run options: #{options[:args]} / "
|
51
|
-
io.print 'Running:'
|
52
|
-
end
|
53
|
-
|
54
|
-
def report
|
55
|
-
super
|
56
|
-
io.sync = true
|
57
|
-
|
58
|
-
failing_results = results.reject(&:skipped?)
|
59
|
-
skipped_results = results.select(&:skipped?)
|
60
|
-
|
61
|
-
color = :green
|
62
|
-
color = :yellow if skipped_results.any?
|
63
|
-
color = :red if failing_results.any?
|
64
|
-
|
65
|
-
if failing_results.any? || skipped_results.any?
|
66
|
-
failing_results.each.with_index(1) { |result, index| display_failing(result, index) }
|
67
|
-
skipped_results.each.with_index(failing_results.size + 1) { |result, index| display_skipped(result, index) }
|
68
|
-
end
|
69
|
-
|
70
|
-
io.print "\n\n"
|
71
|
-
io.puts statistics
|
72
|
-
io.puts color(summary, color)
|
73
|
-
|
74
|
-
if failing_results.any?
|
75
|
-
io.puts "\nFailed Tests:\n"
|
76
|
-
failing_results.each { |result| display_replay_command(result) }
|
77
|
-
io.puts "\n\n"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
def statistics
|
83
|
-
'Finished in %.6fs, %.4f runs/s, %.4f assertions/s.' %
|
84
|
-
[total_time, count / total_time, assertions / total_time]
|
85
|
-
end
|
86
|
-
|
87
|
-
def summary # :nodoc:
|
88
|
-
[
|
89
|
-
pluralize('run', count),
|
90
|
-
pluralize('assertion', assertions),
|
91
|
-
pluralize('failure', failures),
|
92
|
-
pluralize('error', errors),
|
93
|
-
pluralize('skip', skips)
|
94
|
-
].join(', ')
|
95
|
-
end
|
96
|
-
|
97
|
-
def indent(text)
|
98
|
-
text.gsub(/^/, ' ')
|
99
|
-
end
|
100
|
-
|
101
|
-
def display_failing(result, index)
|
102
|
-
backtrace = backtrace(result.failure.backtrace)
|
103
|
-
message = result.failure.message
|
104
|
-
message = message.lines.tap(&:pop).join.chomp if result.error?
|
105
|
-
|
106
|
-
str = "\n\n"
|
107
|
-
str << color('%4d) %s' % [index, result_name(result.name)])
|
108
|
-
str << "\n" << color(indent(message), :red)
|
109
|
-
str << "\n" << color(backtrace, :blue)
|
110
|
-
io.print str
|
111
|
-
end
|
112
|
-
|
113
|
-
def display_skipped(result, index)
|
114
|
-
location = location(result.failure.location)
|
115
|
-
str = "\n\n"
|
116
|
-
str << color('%4d) %s [SKIPPED]' % [index, result_name(result.name)], :yellow)
|
117
|
-
str << "\n" << indent(color(location, :yellow))
|
118
|
-
io.print str
|
119
|
-
end
|
120
|
-
|
121
|
-
def display_replay_command(result)
|
122
|
-
location, line = find_test_file(result)
|
123
|
-
return if location.empty?
|
124
|
-
|
125
|
-
command = if defined?(Rails) && Rails.version >= '5.0.0'
|
126
|
-
%[bin/rails test #{location}:#{line}]
|
127
|
-
%[rake TEST=#{location} TESTOPTS="--name=#{result.name}"]
|
128
|
-
else
|
129
|
-
end
|
130
|
-
|
131
|
-
str = "\n"
|
132
|
-
str << color(command, :red)
|
133
|
-
|
134
|
-
io.print str
|
135
|
-
end
|
136
|
-
|
137
|
-
def find_test_file(result)
|
138
|
-
location, line = result.source_location
|
139
|
-
location = location.gsub(%r[^.*?/((?:test|spec)/.*?)$], "\\1")
|
140
|
-
|
141
|
-
[location, line]
|
142
|
-
end
|
143
|
-
|
144
|
-
def backtrace(backtrace)
|
145
|
-
backtrace = filter_backtrace(backtrace).map { |line| location(line, true) }
|
146
|
-
return if backtrace.empty?
|
147
|
-
indent(backtrace.join("\n")).gsub(/^(\s+)/, "\\1# ")
|
148
|
-
end
|
149
|
-
|
150
|
-
def location(location, include_line_number = false)
|
151
|
-
regex = include_line_number ? /^([^:]+:\d+)/ : /^([^:]+)/
|
152
|
-
location = File.expand_path(location[regex, 1])
|
153
|
-
|
154
|
-
return location unless location.start_with?(Dir.pwd)
|
155
|
-
|
156
|
-
location.gsub(%r[^#{Regexp.escape(Dir.pwd)}/], '')
|
157
|
-
end
|
158
|
-
|
159
|
-
def filter_backtrace(backtrace)
|
160
|
-
Minitest.backtrace_filter.filter(backtrace)
|
161
|
-
end
|
162
|
-
|
163
|
-
def result_name(name)
|
164
|
-
name
|
165
|
-
.gsub(/^test(_\d+)?_/, '')
|
166
|
-
.gsub(/_/, ' ')
|
167
|
-
end
|
168
|
-
|
169
|
-
def print_result_code(result_code)
|
170
|
-
result = @@result_code_to_unicode[result_code]
|
171
|
-
colors = {
|
172
|
-
"\u{2714}" => :green,
|
173
|
-
"\u{2718}" => :red,
|
174
|
-
"\u{203C}" => :red,
|
175
|
-
"\u{26A1}" => :yellow
|
176
|
-
}
|
177
|
-
io.print color(result, colors[result])
|
178
|
-
end
|
179
|
-
|
180
|
-
def color(string, color = :default)
|
181
|
-
if color_enabled?
|
182
|
-
color = @@color.fetch(color, 0)
|
183
|
-
"\e[#{color}m#{string}\e[0m"
|
184
|
-
else
|
185
|
-
string
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def color_enabled?
|
190
|
-
@color_enabled
|
191
|
-
end
|
192
|
-
|
193
|
-
def pluralize(word, count)
|
194
|
-
case count
|
195
|
-
when 0
|
196
|
-
"no #{word}s"
|
197
|
-
when 1
|
198
|
-
"1 #{word}"
|
199
|
-
else
|
200
|
-
"#{count} #{word}s"
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|