ppy 0.0.2 → 0.0.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. data/bin/ppy +11 -0
  2. data/lib/ppy.rb +3 -2
  3. metadata +1 -1
data/bin/ppy CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'yaml'
4
4
  require 'ppy'
5
5
 
6
+ # This first argument should always be the file to parse.
6
7
  file = ARGV.first
7
8
 
8
9
  abort 'No file argument provided.' if file.nil?
@@ -10,4 +11,14 @@ abort 'File does not exist.' unless File.exists?(file)
10
11
  abort 'Directory provided, provide a file path instead.' if File.directory?(file)
11
12
 
12
13
  yaml = YAML.load_file(file)
14
+
15
+ # If the vine gem is installed, only output a nested value if one has been
16
+ # provided as the second argument.
17
+ if Gem::Specification.find_by_name('vine')
18
+ unless ARGV[1].nil?
19
+ require 'vine'
20
+ yaml = yaml.vine(ARGV[1])
21
+ end
22
+ end
23
+
13
24
  PrettyYaml.print(yaml)
data/lib/ppy.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rainbow'
2
2
 
3
3
  module PrettyYaml
4
-
5
4
  extend self
6
5
 
7
6
  # Prints the actual data.
@@ -36,6 +35,8 @@ module PrettyYaml
36
35
  puts "#{indent_string(level)}#{format_key('-')} #{format_value(value)}"
37
36
  end
38
37
  end
38
+ else
39
+ puts "#{indent_string(level)}#{format_value(data)}"
39
40
  end
40
41
  end
41
42
 
@@ -61,7 +62,7 @@ module PrettyYaml
61
62
  when FalseClass
62
63
  value.to_s.color(:red)
63
64
  when NilClass
64
- value.to_s.color(:blue)
65
+ 'nil'.color(:blue)
65
66
  else
66
67
  value
67
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: