puppet-repl 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: fca43c00cf702ad994bc3395a543372b20b7478e
4
- data.tar.gz: a12d76da5da680e202faff71c4e6dba21c760943
3
+ metadata.gz: 06bb20ac1f93b2749396953a81e9554f806dda84
4
+ data.tar.gz: e1a41ac4bc9abf74b8bf67d9f5fdac908a05b523
5
5
  SHA512:
6
- metadata.gz: e285235f53e3aa78b1617ba646b3967169858bc5d4046dddb8d0e94fe42d550ffd8cd2517362249ba6325d76236f47efb02bb302914da1c2b7d78a2b4148f879
7
- data.tar.gz: 17fd10ecc0a1b30d9f64e855d6e21455408377d7c4bc7b50d7bab79427e692e9daeee1933e02654e79027737fc275fb45a1c123b5457acea6f1505c5b9985da5
6
+ metadata.gz: f3440fd2f4450f167ceecfa94670cdd9247a9fe887c382d5e0f620470c1d1f0d090c5b8edc28e1824b7359a7fe8a1a9599e48708611d5a52877fbb9dfe8cecd0
7
+ data.tar.gz: 469e1f7d7235de7f6a1b965dc1680c94e6f01d20cd0b6d9d2e483899989302e44a85c05aff872ab9f02a8ecffe9f9da0aad76f7f3b43c42dd8db87a433eeec98
data/.travis.yml CHANGED
@@ -12,5 +12,6 @@ env:
12
12
  - PUPPET_GEM_VERSION="~> 3.8"
13
13
  - PUPPET_GEM_VERSION="~> 4.2"
14
14
  - PUPPET_GEM_VERSION="~> 4.3"
15
+ - PUPPET_GEM_VERSION="~> 4.4"
15
16
  notifications:
16
17
  email: corey@logicminds.biz
data/README.md CHANGED
@@ -1,3 +1,22 @@
1
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
+ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
+
5
+ - [puppet-repl](#puppet-repl)
6
+ - [Compatibility](#compatibility)
7
+ - [Installation](#installation)
8
+ - [Load path](#load-path)
9
+ - [Usage](#usage)
10
+ - [Using Variables](#using-variables)
11
+ - [Using functions](#using-functions)
12
+ - [Duplicate resource error](#duplicate-resource-error)
13
+ - [Setting the puppet log level](#setting-the-puppet-log-level)
14
+ - [Troubleshooting](#troubleshooting)
15
+ - [Forward](#forward)
16
+ - [Copyright](#copyright)
17
+
18
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
19
+
1
20
  [![Build Status](https://travis-ci.org/nwops/puppet-repl.png)](https://travis-ci.org/nwops/puppet-repl)
2
21
  # puppet-repl
3
22
 
@@ -66,6 +85,9 @@ a list of available functions will be displayed on the screen.
66
85
  => ["hello", "there", "one", "two", "three"]
67
86
 
68
87
  ```
88
+
89
+ So you can imagine how much fun this can be trying out different types of functions.
90
+
69
91
  ## Duplicate resource error
70
92
  Just like normal puppet code you cannot create duplicate resources.
71
93
 
@@ -76,10 +98,26 @@ Just like normal puppet code you cannot create duplicate resources.
76
98
  ```
77
99
  You can reset the parser by running `reset` within the repl without having to exit.
78
100
 
101
+ ## Setting the puppet log level
102
+ If you want to see what puppet is doing behind the scenes you can set the log level
103
+ via `:set loglevel debug`. Valid log levels are `debug`, `info`, `warn` and other
104
+ levels defined in puppet source code.
105
+
106
+ ```
107
+ >> hiera('value')
108
+ => foo
109
+ >> :set loglevel debug
110
+ loglevel debug is set
111
+ >> hiera('value')
112
+ Debug: hiera(): Looking up value in YAML backend
113
+ Debug: hiera(): Looking for data source nodes/foo.example.com
114
+ Debug: hiera(): Found value in nodes/foo.example.com
115
+ => foo
116
+ ```
79
117
  ## Troubleshooting
80
118
 
81
119
  ## Forward
82
- I was just playing around and created this simple tool. Its alpha quality,
120
+ I was just playing around and created this simple tool. Its beta quality,
83
121
  and a ton of features need to be added. Please create a issue if you see a bug or feature that should be added.
84
122
 
85
123
  Pull requests welcomed.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -27,12 +27,27 @@ module PuppetRepl
27
27
  result
28
28
  end
29
29
 
30
+ def handle_set(input)
31
+ args = input.split(' ')
32
+ args.shift # throw away the set
33
+ case args.shift
34
+ when /loglevel/
35
+ if level = args.shift
36
+ Puppet::Util::Log.level = level.to_sym
37
+ Puppet::Util::Log.newdestination(:console)
38
+ puts "loglevel #{Puppet::Util::Log.level} is set"
39
+ end
40
+ end
41
+ end
42
+
30
43
  def handle_input(input)
31
44
  case input
32
45
  when 'help'
33
46
  PuppetRepl::Cli.print_repl_desc
34
47
  when 'functions'
35
48
  puts function_map.keys.sort
49
+ when /^:set/
50
+ handle_set(input)
36
51
  when 'facts'
37
52
  puts JSON.pretty_generate(node.facts)
38
53
  when '_'
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PuppetRepl
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
data/puppet-repl.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "puppet-repl"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corey Osman"]
12
- s.date = "2016-02-26"
12
+ s.date = "2016-03-27"
13
13
  s.description = "A interactive command line tool for evaluating the puppet language"
14
14
  s.email = "corey@nwops.io"
15
15
  s.executables = ["prepl"]
@@ -93,6 +93,18 @@ describe "PuppetRepl" do
93
93
  end
94
94
  end
95
95
 
96
+ describe 'set' do
97
+ let(:input) do
98
+ ":set loglevel debug"
99
+ end
100
+ it 'should set the loglevel' do
101
+ output = "loglevel debug is set\n"
102
+ expect{repl.handle_input(input)}.to output(output).to_stdout
103
+ expect(Puppet::Util::Log.level).to eq(:debug)
104
+ expect(Puppet::Util::Log.destinations[:console].name).to eq(:console)
105
+ end
106
+ end
107
+
96
108
  describe 'execute functions' do
97
109
  let(:input) do
98
110
  "md5('hello')"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-repl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet