puppet-repl 0.2.2 → 0.2.3

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: 8322d7d0831649ede23894dc08e9135fadc252cd
4
- data.tar.gz: d910d7246982ffb04f5f0dda6a64a7408ab035c5
3
+ metadata.gz: 6a03bd43b71008994c676b5199c458efd3e729e0
4
+ data.tar.gz: 738b84539dbc265027dbd07ef2893c037395b6d9
5
5
  SHA512:
6
- metadata.gz: fa51e79914d8b315c07572c50ba52cd88c38edf6ab2e17bada681e8e42cc2537d557774dbeeaab8e58a7d3a62e8ffef2878eb34de431b5b59dd42d830688ab78
7
- data.tar.gz: 4da905e6ad4e7201a329bb661544bec8a44d98c5c6cee488ea9e488e3850f2eebddca1478f493e9cb0bdceed7a4eff8f7a753283ddd5e2a6f9e9bfa23e0b54de
6
+ metadata.gz: 7fd864b5231b000b3cafc243f39af29a97c82491acc767ad0a342360dc5b96c2ab56e505ef022c0fb06a497f05b82723be8b8f450c36c01877373ab10342e2e6
7
+ data.tar.gz: 8e1c79ae398c14eb95dc620b740c101a6a28bd894f651a8e3273047db37661bd51932c1bf556a5ead9bc332e4dd22f9760b480635b0a70ef711d0ba1b7a5cb29
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,118 @@
1
+ stages:
2
+ - test
3
+ - deploy
4
+ - web_deploy
5
+
6
+ variables:
7
+ HEROKU_STAGING_APP: murmuring-plateau-62715
8
+ HEROKU_PROD_APP: still-tor-57873
9
+
10
+ .puppet_def: &puppet_job_def
11
+ stage: test
12
+ script:
13
+ - bundle install --without development
14
+ - bundle exec puppet module install puppetlabs-stdlib
15
+ - bundle exec rake spec
16
+
17
+ .ruby_193: &ruby193
18
+ image: ruby:1.9.3
19
+
20
+ .ruby_20: &ruby20
21
+ image: ruby:2.0
22
+
23
+ .ruby_21: &ruby21
24
+ image: ruby:2.1
25
+
26
+ .ruby_22: &ruby22
27
+ image: ruby:2.2
28
+
29
+ .ruby_23: &ruby23
30
+ image: ruby:2.3
31
+
32
+ gem_production:
33
+ image: ruby:2.1
34
+ before_script:
35
+ - gem install dpl
36
+ stage: deploy
37
+ script:
38
+ - dpl --provider=rubygems --api-key=$RUBYGEMS_API_KEY
39
+ only:
40
+ - tags
41
+
42
+ # web_staging:
43
+ # stage: web_deploy
44
+ # before_script:
45
+ # - gem install dpl
46
+ # script:
47
+ # - dpl --provider=heroku --strategy=git --app=$HEROKU_STAGING_APP --api-key=$HEROKU_API_KEY
48
+ # only:
49
+ # - master
50
+ #
51
+ # web_production:
52
+ # stage: web_deploy
53
+ # before_script:
54
+ # - gem install dpl
55
+ # script:
56
+ # - dpl --provider=heroku --strategy=git --app=$HEROKU_PROD_APP --api-key=$HEROKU_API_KEY
57
+ # only:
58
+ # - tags
59
+
60
+ puppet_38_ruby193:
61
+ variables:
62
+ PUPPET_GEM_VERSION: '3.8'
63
+ <<: *puppet_job_def
64
+ <<: *ruby193
65
+
66
+ puppet_38_ruby20:
67
+ variables:
68
+ PUPPET_GEM_VERSION: '3.8'
69
+ <<: *puppet_job_def
70
+ <<: *ruby20
71
+
72
+ puppet_38_ruby21:
73
+ variables:
74
+ PUPPET_GEM_VERSION: '3.8'
75
+ <<: *puppet_job_def
76
+ <<: *ruby21
77
+
78
+ puppet_43_ruby20:
79
+ variables:
80
+ PUPPET_GEM_VERSION: '4.4'
81
+ <<: *puppet_job_def
82
+ <<: *ruby20
83
+
84
+ puppet_43_ruby21:
85
+ variables:
86
+ PUPPET_GEM_VERSION: '4.4'
87
+ <<: *puppet_job_def
88
+ <<: *ruby21
89
+
90
+ puppet_43_ruby22:
91
+ variables:
92
+ PUPPET_GEM_VERSION: '4.4'
93
+ <<: *puppet_job_def
94
+ <<: *ruby22
95
+
96
+ puppet_44_ruby21:
97
+ variables:
98
+ PUPPET_GEM_VERSION: '4.4'
99
+ <<: *puppet_job_def
100
+ <<: *ruby21
101
+
102
+ puppet_44_ruby22:
103
+ variables:
104
+ PUPPET_GEM_VERSION: '4.4'
105
+ <<: *puppet_job_def
106
+ <<: *ruby22
107
+
108
+ puppet_45_ruby21:
109
+ variables:
110
+ PUPPET_GEM_VERSION: '4.5'
111
+ <<: *puppet_job_def
112
+ <<: *ruby21
113
+
114
+ puppet_45_ruby22:
115
+ variables:
116
+ PUPPET_GEM_VERSION: '4.5'
117
+ <<: *puppet_job_def
118
+ <<: *ruby22
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 0.2.3
2
+ * fixes #21 - type display causes error
1
3
  ## 0.2.2
2
4
  * adds better support for playing back puppet code
3
5
  * this now allows playback of any manifest
data/README.md CHANGED
@@ -27,7 +27,8 @@
27
27
  - [Copyright](#copyright)
28
28
 
29
29
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
30
- [![BuildStatus](https://travis-ci.org/nwops/puppet-repl.svg?branch=master)](https://travis-ci.org/nwops/puppet-repl?branch=master)[![Gem Version](https://badge.fury.io/rb/puppet-repl.svg)](https://badge.fury.io/rb/puppet-repl)
30
+ ![Build Status](https://gitlab.com/nwops/puppet-repl/badges/master/build.svg)
31
+ [![Gem Version](https://badge.fury.io/rb/puppet-repl.svg)](https://badge.fury.io/rb/puppet-repl)
31
32
  # puppet-repl
32
33
 
33
34
  A interactive command line tool for evaluating the puppet language.
@@ -236,7 +237,7 @@ If using the [web based repl](https://www.puppet-repl.com) you can playback a sh
236
237
  which would start a repl session and then load the content from the url or parameter.
237
238
 
238
239
  Example:
239
- https://www.puppet-repl.com/play?url=https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0
240
+ https://www.puppet-repl.com/play?url=https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0.txt
240
241
 
241
242
  or for single commands
242
243
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -16,6 +16,8 @@ module AwesomePrint
16
16
  cast = :puppet_type
17
17
  elsif (defined?(::Puppet::Parser::Resource)) && (object.class < ::Puppet::Parser::Resource)
18
18
  cast = :puppet_resource
19
+ elsif /Puppet::Pops::Types/.match(object.class.to_s)
20
+ cast = :puppet_type
19
21
  end
20
22
  cast
21
23
  end
@@ -27,6 +29,7 @@ module AwesomePrint
27
29
 
28
30
  def awesome_puppet_type(object)
29
31
  return '' if object.nil?
32
+ return object.to_s unless object.respond_to?(:name) && object.respond_to?(:title)
30
33
  h = object.to_hash.merge(:name => object.name, :title => object.title)
31
34
  res_str = awesome_hash(h)
32
35
  "#{object.class} #{res_str.gsub(':', '')}"
@@ -51,12 +51,13 @@ module PuppetRepl
51
51
  if type.respond_to?(:type_name) and type.respond_to?(:title)
52
52
  title = type.title
53
53
  type_name = type.type_name
54
- else
54
+ elsif type_result = /(\w+)\['?(\w+)'?\]/.match(type.to_s)
55
55
  # not all types have a type_name and title so we
56
56
  # output to a string and parse the results
57
- type_result = /(\w+)\['?(\w+)'?\]/.match(type.to_s)
58
57
  title = type_result[2]
59
58
  type_name = type_result[1]
59
+ else
60
+ return type
60
61
  end
61
62
  res = scope.catalog.resource(type_name, title)
62
63
  if res
@@ -18,6 +18,11 @@ module PuppetRepl
18
18
  require 'uri'
19
19
  url_data = URI(url)
20
20
  case url_data.host
21
+ when /^gist\.github*/
22
+ unless url_data.path =~ /raw/
23
+ url = url += '.txt'
24
+ end
25
+ url
21
26
  when /^github.com/
22
27
  if url_data.path =~ /blob/
23
28
  url.gsub('blob', 'raw')
@@ -26,6 +31,7 @@ module PuppetRepl
26
31
  unless url_data.path =~ /raw/
27
32
  url = url += '.txt'
28
33
  end
34
+ url
29
35
  when /^gitlab.com/
30
36
  if url_data.path =~ /snippets/
31
37
  url += '/raw' unless url_data.path =~ /raw/
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PuppetRepl
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
data/puppet-repl.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: puppet-repl 0.2.2 ruby lib
5
+ # stub: puppet-repl 0.2.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "puppet-repl"
9
- s.version = "0.2.2"
9
+ s.version = "0.2.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Corey Osman"]
14
- s.date = "2016-05-21"
14
+ s.date = "2016-06-01"
15
15
  s.description = "A interactive command line tool for evaluating the puppet language"
16
16
  s.email = "corey@nwops.io"
17
17
  s.executables = ["prepl"]
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
  ]
23
23
  s.files = [
24
24
  ".document",
25
+ ".gitlab-ci.yml",
25
26
  ".rspec",
26
- ".travis.yml",
27
27
  "CHANGELOG.md",
28
28
  "Gemfile",
29
29
  "Gemfile.lock",
@@ -26,6 +26,29 @@ describe "PuppetRepl" do
26
26
  repl.parser.evaluate_string(repl.scope, input)
27
27
  end
28
28
 
29
+ describe 'types' do
30
+
31
+ describe 'string' do
32
+ let(:input) do
33
+ "String"
34
+ end
35
+ it 'shows type' do
36
+ repl.handle_input(input)
37
+ expect(output.string).to eq("\n => String\n")
38
+ end
39
+ end
40
+ describe 'Array' do
41
+ let(:input) do
42
+ "type_of([1,2,3,4])"
43
+ end
44
+ it 'shows type' do
45
+ repl.handle_input(input)
46
+ expect(output.string).to eq("\n => Tuple[Integer[1, 1], Integer[2, 2], Integer[3, 3], Integer[4, 4]]\n")
47
+ end
48
+ end
49
+
50
+ end
51
+
29
52
  describe 'multiple lines of input' do
30
53
  describe '3 lines' do
31
54
  let(:input) do
@@ -118,11 +141,11 @@ describe "PuppetRepl" do
118
141
  end
119
142
 
120
143
  before(:each) do
121
- allow(repl).to receive(:fetch_url_data).with(file_url).and_return(File.read(fixtures_file))
144
+ allow(repl).to receive(:fetch_url_data).with(file_url + '.txt').and_return(File.read(fixtures_file))
122
145
  end
123
146
 
124
147
  let(:file_url) do
125
- 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw'
148
+ 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0'
126
149
  end
127
150
  it 'file' do
128
151
  repl.handle_input("play #{fixtures_file}")
data/spec/support_spec.rb CHANGED
@@ -139,7 +139,6 @@ describe 'support' do
139
139
  end
140
140
  end
141
141
  end
142
-
143
142
  describe 'github' do
144
143
  describe 'raw' do
145
144
  let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw'}
@@ -148,7 +147,13 @@ describe 'support' do
148
147
  expect(repl.convert_to_text(url)).to eq(converted)
149
148
  end
150
149
  end
151
-
150
+ describe 'raw' do
151
+ let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0'}
152
+ let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0.txt' }
153
+ it do
154
+ expect(repl.convert_to_text(url)).to eq(converted)
155
+ end
156
+ end
152
157
  describe 'raw gist' do
153
158
  let(:url) {'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp'}
154
159
  let(:converted) {'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp'}
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.2.2
4
+ version: 0.2.3
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-05-21 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet
@@ -77,8 +77,8 @@ extra_rdoc_files:
77
77
  - README.md
78
78
  files:
79
79
  - ".document"
80
+ - ".gitlab-ci.yml"
80
81
  - ".rspec"
81
- - ".travis.yml"
82
82
  - CHANGELOG.md
83
83
  - Gemfile
84
84
  - Gemfile.lock
data/.travis.yml DELETED
@@ -1,29 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- install: "bundle install --without development"
4
- before_script: "bundle exec puppet module install puppetlabs-stdlib"
5
- script: "bundle exec rspec"
6
- rvm:
7
- - 1.9.3
8
- - 2.0.0
9
- - 2.2.1
10
- - 2.1.3
11
- env:
12
- matrix:
13
- - PUPPET_GEM_VERSION="~> 3.8"
14
- - PUPPET_GEM_VERSION="~> 4.2"
15
- - PUPPET_GEM_VERSION="~> 4.3"
16
- - PUPPET_GEM_VERSION="~> 4.4"
17
- notifications:
18
- email: corey@logicminds.biz
19
-
20
- matrix:
21
- exclude:
22
- - rvm: 2.2.1
23
- env: PUPPET_GEM_VERSION="~> 3.8"
24
- - rvm: 1.9.3
25
- env: PUPPET_GEM_VERSION="~> 4.4"
26
- - rvm: 1.9.3
27
- env: PUPPET_GEM_VERSION="~> 4.3"
28
- - rvm: 1.9.3
29
- env: PUPPET_GEM_VERSION="~> 4.2"