psychgus 1.2.0 → 1.2.1

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: 8b9e7e5d21e498f39d61b2b83765879dd6c564cc2742b121dfdeb9f5b8051578
4
- data.tar.gz: 13ef8c78dc13bcce6596534e2b94557033438289a86e459834b4d7acf0afb9c1
3
+ metadata.gz: 45e44e424ed93bfb0d7bfc839e749576112b893f11d7e92a013fad608a95fc00
4
+ data.tar.gz: 0fea838c43246424d747dd778d834c8e879cffcf265bdbcd136c9b8d170c8537
5
5
  SHA512:
6
- metadata.gz: abfc0427ed29d4e3d811476a2c957f7961a85fbb0445b558d3b1356f018b12b52026a6b268b9f23384aa0a9fd20e3c720a30091448ea1659c8ddb8298e5c3b74
7
- data.tar.gz: ef2db56b9b41bc3aa3f81f3a033e5aaf9508578d9aa63e5de10e978950fa9c860f77ca39ffa8c0077409149f87059faa515b51080290bf59f8e9a53dc74d366a
6
+ metadata.gz: b434a4da0294268f31a7452f267901f93deb686eeb92ae16b9049cf2a143902aa2e09c3c73464dc077109edfd1b2afda5fc045c9e25344d54d9bfa86b73926ec
7
+ data.tar.gz: 49df65fe217e187e00564e8df18730e7cb8afbdf432a58173787a93ff775218300677b7fbe5b0133d34ddc6ab3a254cd0d034d075efb09c152de26a1254aa813
data/CHANGELOG.md CHANGED
@@ -2,7 +2,21 @@
2
2
 
3
3
  Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
- ## [[Unreleased]](https://github.com/esotericpig/psychgus/compare/v1.2.0...master)
5
+ ## [[Unreleased]](https://github.com/esotericpig/psychgus/compare/v1.2.1...master)
6
+
7
+ ## [v1.2.1] - 2019-12-18
8
+
9
+ ### Added
10
+ - Use of YardGhurt gem for Rakefile tasks
11
+
12
+ ### Changed
13
+ - Some comments/doc in SuperSniffer, README
14
+ - yard_fix task in Rakefile to be cleaner
15
+ - Test constants in PsychgusTest
16
+ - Summary & files in Gemspec
17
+
18
+ ### Fixed
19
+ - Updated gems
6
20
 
7
21
  ## [v1.2.0] - 2019-07-11
8
22
 
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/psychgus.svg)](https://badge.fury.io/rb/psychgus)
4
4
 
5
5
  [![Documentation](https://img.shields.io/badge/doc-yard-%23A0522D.svg?style=for-the-badge)](https://esotericpig.github.io/docs/psychgus/yardoc/index.html)
6
+ [![Source Code](https://img.shields.io/badge/source-github-%23A0522D.svg?style=for-the-badge)](https://github.com/esotericpig/psychgus)
6
7
  [![Changelog](https://img.shields.io/badge/changelog-md-%23A0522D.svg?style=for-the-badge)](CHANGELOG.md)
7
8
  [![License](https://img.shields.io/github/license/esotericpig/psychgus.svg?color=%23A0522D&style=for-the-badge)](LICENSE.txt)
8
9
 
@@ -92,7 +93,7 @@ $ bundle exec rake install:local
92
93
 
93
94
  ## [Using](#contents)
94
95
 
95
- Documentation (YARDoc) is available on my [GitHub Page](https://esotericpig.github.io/docs/psychgus/yardoc/index.html) and RubyDoc.info ([[/gems]](https://www.rubydoc.info/gems/psychgus) or [[/github]](https://www.rubydoc.info/github/esotericpig/psychgus/master)).
96
+ Documentation (YARDoc) is available on my [GitHub Page](https://esotericpig.github.io/docs/psychgus/yardoc/index.html) and on [RubyDoc.info](https://www.rubydoc.info/gems/psychgus).
96
97
 
97
98
  To begin styling, create a class and mix in (include) `Psychgus::Styler`. Then pass it in as a keyword arg (`stylers: MyStyler.new` or `stylers: [MyStyler1.new,MyStyler2.new]`) into one of the Psychgus methods.
98
99
 
data/Rakefile CHANGED
@@ -15,13 +15,14 @@
15
15
  # GNU Lesser General Public License for more details.
16
16
  #
17
17
  # You should have received a copy of the GNU Lesser General Public License
18
- # along with Psychgus. If not, see <http://www.gnu.org/licenses/>.
18
+ # along with Psychgus. If not, see <https://www.gnu.org/licenses/>.
19
19
  #++
20
20
 
21
21
 
22
22
  require 'bundler/gem_tasks'
23
23
 
24
24
  require 'yard'
25
+ require 'yard_ghurt'
25
26
 
26
27
  require 'psychgus/version'
27
28
 
@@ -33,34 +34,18 @@ task default: [:test]
33
34
  CLEAN.exclude('.git/','stock/')
34
35
  CLOBBER.include('doc/')
35
36
 
36
- module PsychgusRake
37
- # Remove if exists
38
- def self.rm_exist(filename,output=true)
39
- if File.exist?(filename)
40
- puts "Delete [#{filename}]" if output
41
- File.delete(filename)
42
- end
43
- end
44
- end
45
-
46
37
  # Execute "rake ghp_doc" for a dry run
47
38
  # Execute "rake ghp_doc[true]" for actually deploying
48
- desc %q(Rsync "doc/" to my GitHub Page's repo; not useful for others)
49
- task :ghp_doc,[:deploy] do |task,args|
50
- dry_run = args.deploy ? '' : '--dry-run'
51
- rsync_cmd = "rsync -ahv --delete-after --progress #{dry_run} 'doc/' '../esotericpig.github.io/docs/psychgus/yardoc/'"
52
-
53
- sh rsync_cmd
39
+ YardGhurt::GHPSyncTask.new(:ghp_doc) do |task|
40
+ task.description = %q(Rsync "doc/" to my GitHub Page's repo; not useful for others)
54
41
 
55
- if !args.deploy
56
- puts
57
- puts 'Execute "rake ghp_doc[true]" for actually deploying (non-dry-run)'
58
- end
42
+ task.ghp_dir = '../esotericpig.github.io/docs/psychgus/yardoc'
43
+ task.sync_args << '--delete-after'
59
44
  end
60
45
 
61
46
  Rake::TestTask.new() do |task|
62
47
  task.libs = ['lib','test']
63
- task.pattern = 'test/**/*_test.rb'
48
+ task.pattern = File.join('test','**','*_test.rb')
64
49
  task.description += " ('#{task.pattern}')"
65
50
  #task.options = '--verbose' # Execute "rake test TESTOPT=-v" instead
66
51
  task.verbose = true
@@ -78,83 +63,33 @@ end
78
63
 
79
64
  # Execute "rake clobber yard" for pristine docs
80
65
  YARD::Rake::YardocTask.new() do |task|
81
- task.files = ['lib/**/*.rb']
66
+ task.files = [File.join('lib','**','*.rb')]
82
67
 
83
68
  task.options += ['--files','CHANGELOG.md,LICENSE.txt']
84
69
  task.options += ['--readme','README.md']
85
70
 
86
71
  task.options << '--protected' # Show protected methods
87
- task.options += ['--template-path','yard/templates/']
72
+ task.options += ['--template-path',File.join('yard','templates')]
88
73
  task.options += ['--title',"Psychgus v#{Psychgus::VERSION} Doc"]
89
74
  end
90
75
 
91
- desc 'Fix (find & replace) text in the YARD files for GitHub differences'
92
- task :yard_fix,[:dev] do |task,args|
93
- # Delete this file as it's never used (index.html is an exact copy)
94
- PsychgusRake.rm_exist('doc/file.README.html')
76
+ YardGhurt::GFMFixTask.new(:yard_fix) do |task|
77
+ task.description = 'Fix (find & replace) text in the YARD files for GitHub differences'
95
78
 
96
- ['doc/index.html'].each do |filename|
97
- puts "File [#{filename}]:"
98
-
99
- lines = []
100
- write = false
79
+ task.arg_names = [:dev]
80
+ task.dry_run = false
81
+ task.fix_code_langs = true
82
+ task.md_files = ['index.html']
83
+
84
+ task.before = Proc.new() do |task,args|
85
+ # Delete this file as it's never used (index.html is an exact copy)
86
+ YardGhurt.rm_exist(File.join(task.doc_dir,'file.README.html'))
101
87
 
102
- File.open(filename,'r') do |file|
103
- file.each_line do |line|
104
- out = false
105
-
106
- # CSS
107
- if line =~ /^\s*\<\/head\>\s*$/i
108
- line = '<link href="'
109
- line << (args.dev ? '../../esotericpig.github.io/' : '../../../')
110
- line << 'css/prism.css" rel="stylesheet" /> </head>'
111
-
112
- out = true
113
- end
114
-
115
- # JS
116
- if line =~ /^\s*\<\/body\>\s*$/i
117
- line = '<script src="'
118
- line << (args.dev ? '../../esotericpig.github.io/' : '../../../')
119
- line << 'js/prism.js"></script> </body>'
120
-
121
- out = true
122
- end
123
-
124
- # Anchor links
125
- tag = 'href="#'
126
- quoted_tag = Regexp.quote(tag)
127
-
128
- if !(i = line.index(Regexp.new(quoted_tag + '[a-z]'))).nil?()
129
- line = line.gsub(Regexp.new(quoted_tag + '[a-z][^"]*"')) do |href|
130
- link = href[tag.length..-2]
131
- link = link.split('-').map(&:capitalize).join('_')
132
-
133
- %Q(#{tag}#{link}")
134
- end
135
-
136
- out = true
137
- end
138
-
139
- out = !line.gsub!('href="CHANGELOG.md"','href="file.CHANGELOG.html"').nil?() || out
140
- out = !line.gsub!('href="LICENSE.txt"','href="file.LICENSE.html"').nil?() || out
141
- out = !line.gsub!('code class="Ruby"','code class="language-ruby"').nil?() || out
142
- out = !line.gsub!('code class="YAML"','code class="language-yaml"').nil?() || out
143
-
144
- if out
145
- puts " #{line}"
146
- write = true
147
- end
148
-
149
- lines << line
150
- end
151
- end
88
+ # Root dir of my GitHub Page for CSS/JS
89
+ GHP_ROOT = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
152
90
 
153
- if write
154
- File.open(filename,'w') do |file|
155
- file.puts lines
156
- end
157
- end
91
+ task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT}/css/prism.css" />)
92
+ task.js_scripts << %Q(<script src="#{GHP_ROOT}/js/prism.js"></script>)
158
93
  end
159
94
  end
160
95
 
data/lib/psychgus.rb CHANGED
@@ -311,10 +311,8 @@ require 'psychgus/super_sniffer/parent'
311
311
  ###
312
312
  module Psychgus
313
313
  # Include these in the top namespace for convenience (i.e., less typing).
314
- #
315
- # @since 1.2.0
316
- include Stylables
317
- include Stylers
314
+ include Stylables # @since 1.2.0
315
+ include Stylers # @since 1.2.0
318
316
 
319
317
  NODE_CLASS_ALIASES = {:Doc => :Document,:Map => :Mapping,:Seq => :Sequence}
320
318
  OPTIONS_ALIASES = {:canon => :canonical,:indent => :indentation}
@@ -52,16 +52,18 @@ module Psychgus
52
52
  #
53
53
  # Most information is straightforward:
54
54
  # - {#aliases} # Array of Psych::Nodes::Alias processed so far
55
+ # - {#documents} # Array of Psych::Nodes::Document processed so far
55
56
  # - {#mappings} # Array of Psych::Nodes::Mapping processed so far
56
- # - {#nodes} # Array of all Psych::Nodes::Node processed so far
57
+ # - {#nodes} # Array of Psych::Nodes::Node processed so far
57
58
  # - {#scalars} # Array of Psych::Nodes::Scalar processed so far
58
59
  # - {#sequences} # Array of Psych::Nodes::Sequence processed so far
60
+ # - {#streams} # Array of Psych::Nodes::Stream processed so far
59
61
  #
60
62
  # {#parent} is the current {SuperSniffer::Parent} of the node being processed,
61
- # which is nil for the first node.
63
+ # which is an empty Parent for the first node (not nil).
62
64
  #
63
65
  # {#parents} are all of the (grand){SuperSniffer::Parent}(s) for the current node,
64
- # which is empty for the first node.
66
+ # which is an Array that just contains an empty Parent for the first node.
65
67
  #
66
68
  # A parent is a Mapping or Sequence, or a Key (Scalar) in a Mapping.
67
69
  #
@@ -136,7 +138,7 @@ module Psychgus
136
138
  # (6:1):Salt - <seq:(5:2)>
137
139
  # (6:2):Pepper - <seq:(5:2)>
138
140
  #
139
- # The "Super Sniffer" is the nickname for Gus's nose from the TV show Psych
141
+ # "The Super Sniffer" is the nickname for Gus's nose from the TV show Psych
140
142
  # because he has a very refined sense of smell.
141
143
  #
142
144
  # @note You should never call the methods that are not readers, like {#add_alias}, {#start_mapping}, etc.
@@ -152,17 +154,17 @@ module Psychgus
152
154
  class SuperSniffer
153
155
  EMPTY = Empty.new().freeze()
154
156
 
155
- attr_reader :aliases
156
- attr_reader :documents
157
- attr_reader :level
158
- attr_reader :mappings
159
- attr_reader :nodes
160
- attr_reader :parent
161
- attr_reader :parents
162
- attr_reader :position
163
- attr_reader :scalars
164
- attr_reader :sequences
165
- attr_reader :streams
157
+ attr_reader :aliases # @return [Array<Psych::Nodes::Alias>] the aliases processed so far
158
+ attr_reader :documents # @return [Array<Psych::Nodes::Document>] the documents processed so far
159
+ attr_reader :level # @return [Integer] the current level
160
+ attr_reader :mappings # @return [Array<Psych::Nodes::Mapping>] the mappings processed so far
161
+ attr_reader :nodes # @return [Array<Psych::Nodes::Node>] the nodes processed so far
162
+ attr_reader :parent # @return [Parent] the current parent
163
+ attr_reader :parents # @return [Array<Parent>] the current (grand)parents
164
+ attr_reader :position # @return [Integer] the current position
165
+ attr_reader :scalars # @return [Array<Psych::Nodes::Scalar>] the scalars processed so far
166
+ attr_reader :sequences # @return [Array<Psych::Nodes::Sequence>] the sequences processed so far
167
+ attr_reader :streams # @return [Array<Psych::Nodes::Stream>] the streams processed so far
166
168
 
167
169
  # Initialize this class for sniffing.
168
170
  def initialize()
@@ -23,5 +23,5 @@
23
23
 
24
24
  module Psychgus
25
25
  # Version of this gem in "#.#.#" format
26
- VERSION = '1.2.0'
26
+ VERSION = '1.2.1'
27
27
  end
data/psychgus.gemspec CHANGED
@@ -16,7 +16,7 @@
16
16
  # GNU Lesser General Public License for more details.
17
17
  #
18
18
  # You should have received a copy of the GNU Lesser General Public License
19
- # along with Psychgus. If not, see <http://www.gnu.org/licenses/>.
19
+ # along with Psychgus. If not, see <https://www.gnu.org/licenses/>.
20
20
  #++
21
21
 
22
22
 
@@ -25,14 +25,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
25
25
 
26
26
  require 'psychgus/version'
27
27
 
28
- Gem::Specification.new do |spec|
28
+ Gem::Specification.new() do |spec|
29
29
  spec.name = 'psychgus'
30
30
  spec.version = Psychgus::VERSION
31
31
  spec.authors = ['Jonathan Bradley Whited (@esotericpig)']
32
32
  spec.email = ['bradley@esotericpig.com']
33
33
  spec.licenses = ['LGPL-3.0-or-later']
34
34
  spec.homepage = 'https://github.com/esotericpig/psychgus'
35
- spec.summary = %q(Easily style YAML files using Psych, like Sequence/Mapping Flow style.)
35
+ spec.summary = %q(Easily style YAML files using Psych.)
36
36
  spec.description = %q(Easily style YAML files using Psych, like Sequence/Mapping Flow style.)
37
37
 
38
38
  spec.metadata = {
@@ -43,25 +43,22 @@ Gem::Specification.new do |spec|
43
43
  'source_code_uri' => 'https://github.com/esotericpig/psychgus'
44
44
  }
45
45
 
46
- spec.files = Dir.glob(File.join('{lib,test,yard}','**','*.{erb,rb}')) +
47
- %w(
48
- CHANGELOG.md
49
- Gemfile
50
- LICENSE.txt
51
- psychgus.gemspec
52
- Rakefile
53
- README.md
54
- )
55
46
  spec.require_paths = ['lib']
56
47
 
48
+ spec.files = Dir.glob(File.join("{#{spec.require_paths.join(',')}}",'**','*.{erb,rb}')) +
49
+ Dir.glob(File.join('{test,yard}','**','*.{erb,rb}')) +
50
+ %W( Gemfile #{spec.name}.gemspec Rakefile ) +
51
+ %w( CHANGELOG.md LICENSE.txt README.md )
52
+
57
53
  spec.required_ruby_version = '>= 2.1.10'
58
54
 
59
55
  spec.add_runtime_dependency 'psych','>= 2.0.5'
60
56
 
61
- spec.add_development_dependency 'bundler' ,'~> 1.16'
62
- spec.add_development_dependency 'minitest' ,'~> 5.11' # For testing
63
- spec.add_development_dependency 'rake' ,'~> 12.3'
64
- spec.add_development_dependency 'rdoc' ,'~> 6.1' # For RDoc for YARD (*.rb)
65
- spec.add_development_dependency 'redcarpet','~> 3.4' # For Markdown for YARD (*.md)
66
- spec.add_development_dependency 'yard' ,'~> 0.9' # For documentation
57
+ spec.add_development_dependency 'bundler' ,'~> 1.16'
58
+ spec.add_development_dependency 'minitest' ,'~> 5.11' # For testing
59
+ spec.add_development_dependency 'rake' ,'~> 12.3'
60
+ spec.add_development_dependency 'rdoc' ,'~> 6.1' # For RDoc for YARD (*.rb)
61
+ spec.add_development_dependency 'redcarpet' ,'~> 3.5' # For Markdown for YARD (*.md)
62
+ spec.add_development_dependency 'yard' ,'~> 0.9' # For documentation
63
+ spec.add_development_dependency 'yard_ghurt','~> 1.1' # For YARD GitHub rake tasks
67
64
  end
@@ -120,10 +120,25 @@ Toppings:
120
120
  end
121
121
 
122
122
  def test_node_consts()
123
+ assert_equal Psych::Nodes::Mapping::ANY,Psychgus::MAPPING_ANY
124
+ assert_equal Psych::Nodes::Mapping::BLOCK,Psychgus::MAPPING_BLOCK
123
125
  assert_equal Psych::Nodes::Mapping::FLOW,Psychgus::MAPPING_FLOW
126
+
127
+ assert_equal Psych::Nodes::Scalar::ANY,Psychgus::SCALAR_ANY
128
+ assert_equal Psych::Nodes::Scalar::PLAIN,Psychgus::SCALAR_PLAIN
129
+ assert_equal Psych::Nodes::Scalar::SINGLE_QUOTED,Psychgus::SCALAR_SINGLE_QUOTED
130
+ assert_equal Psych::Nodes::Scalar::DOUBLE_QUOTED,Psychgus::SCALAR_DOUBLE_QUOTED
131
+ assert_equal Psych::Nodes::Scalar::LITERAL,Psychgus::SCALAR_LITERAL
124
132
  assert_equal Psych::Nodes::Scalar::FOLDED,Psychgus::SCALAR_FOLDED
133
+
134
+ assert_equal Psych::Nodes::Sequence::ANY,Psychgus::SEQUENCE_ANY
135
+ assert_equal Psych::Nodes::Sequence::BLOCK,Psychgus::SEQUENCE_BLOCK
125
136
  assert_equal Psych::Nodes::Sequence::FLOW,Psychgus::SEQUENCE_FLOW
137
+
138
+ assert_equal Psych::Nodes::Stream::ANY,Psychgus::STREAM_ANY
126
139
  assert_equal Psych::Nodes::Stream::UTF8,Psychgus::STREAM_UTF8
140
+ assert_equal Psych::Nodes::Stream::UTF16LE,Psychgus::STREAM_UTF16LE
141
+ assert_equal Psych::Nodes::Stream::UTF16BE,Psychgus::STREAM_UTF16BE
127
142
  end
128
143
 
129
144
  def test_parse()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psychgus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Bradley Whited (@esotericpig)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-11 00:00:00.000000000 Z
11
+ date: 2019-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.4'
89
+ version: '3.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.4'
96
+ version: '3.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.9'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard_ghurt
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.1'
111
125
  description: Easily style YAML files using Psych, like Sequence/Mapping Flow style.
112
126
  email:
113
127
  - bradley@esotericpig.com
@@ -166,8 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
180
  - !ruby/object:Gem::Version
167
181
  version: '0'
168
182
  requirements: []
169
- rubygems_version: 3.0.4
183
+ rubygems_version: 3.1.1
170
184
  signing_key:
171
185
  specification_version: 4
172
- summary: Easily style YAML files using Psych, like Sequence/Mapping Flow style.
186
+ summary: Easily style YAML files using Psych.
173
187
  test_files: []