sapluuna 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +1 -1
- data/Rakefile +18 -23
- data/lib/sapluuna/context.rb +3 -2
- data/sapluuna.gemspec +5 -3
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff104d8db679a2a2a66a4f46b6f54e56b0dd5154
|
4
|
+
data.tar.gz: 59ee8ee4a7272fdcae0a32b2ccb51da257cebe1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1d6bb34f4a66b0c605cc1b685ea7cd06165c1a5518b5ff0485be1ce15414506c35a5e91be0cdd7b4e38c9af812dd49b9bb3063527740077dc147243841b9c2
|
7
|
+
data.tar.gz: fbae0ae675d4eef4fbf3b9edf543aeb1cc7402d4e2fb97d84ff74e0612684989de878ae2c016042cfddc1885c2a92173ce6399b3dc599b821e6bfb34bebcc482
|
data/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
pkg
|
2
2
|
cfg*
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Silly little template based configuration maker
|
|
4
4
|
|
5
5
|
* Anything outside {{{ ... }}} is comment and won't be in generated file
|
6
6
|
* Inside {{{ }}} you can have <% foo %> which is just ruby
|
7
|
-
* For method_missing in <% foo %> we try variable[name] hash, given to
|
7
|
+
* For method_missing in <% foo %> we try variable[name] hash, given to constructor, i.e. Sapluuna.new variables: {replace_this: 'with_this'} .... <% replace_this %> works
|
8
8
|
* {{{ can be followed by negative or positive labels, if labels match to those given to constructor {{{ }}} is evaluated, otherwise ignored
|
9
9
|
* rationale for labels is {{{ PE ..... }}} or {{{ Finland Sweden ..... }}} to conditionally evaluate blocks
|
10
10
|
* You can query the instance on what variables are needed when labels X are set, use-case is in say in webUI to automatically generate form with all variables template needs
|
data/Rakefile
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'bundler'
|
4
|
-
# Bundler.setup
|
5
|
-
rescue LoadError
|
6
|
-
warn 'bundler missing'
|
7
|
-
end
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
8
3
|
|
9
4
|
gemspec = eval(File.read(Dir['*.gemspec'].first))
|
10
5
|
file = [gemspec.name, gemspec.version].join('-') + '.gem'
|
@@ -17,31 +12,31 @@ end
|
|
17
12
|
desc 'Run minitest'
|
18
13
|
task :test do
|
19
14
|
Rake::TestTask.new do |t|
|
20
|
-
t.libs
|
21
|
-
t.test_files = FileList['spec
|
15
|
+
t.libs << 'spec'
|
16
|
+
t.test_files = FileList['spec/**/*_spec.rb']
|
17
|
+
t.warning = true
|
22
18
|
t.verbose = true
|
23
19
|
end
|
24
20
|
end
|
25
21
|
|
26
|
-
desc '
|
27
|
-
task :build do
|
28
|
-
|
29
|
-
FileUtils.mkdir_p 'gems'
|
30
|
-
FileUtils.mv file, 'gems'
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'Install gem'
|
34
|
-
task :install => :build do
|
35
|
-
system "sudo -Es sh -c \'umask 022; gem install gems/#{file}\'"
|
22
|
+
desc 'sudo install gem'
|
23
|
+
task :sudo_install => :build do
|
24
|
+
system "sudo -Es sh -c \'umask 022; gem install gems/#{file}\'"
|
36
25
|
end
|
37
26
|
|
38
27
|
desc 'Remove gems'
|
39
28
|
task :clean do
|
40
|
-
FileUtils.rm_rf '
|
29
|
+
FileUtils.rm_rf 'pkg'
|
41
30
|
end
|
42
31
|
|
43
|
-
desc '
|
44
|
-
task :
|
45
|
-
system "gem push gems/#{file}"
|
32
|
+
desc 'Tag the release'
|
33
|
+
task :tag do
|
46
34
|
system "git tag #{gemspec.version}"
|
47
35
|
end
|
36
|
+
|
37
|
+
desc 'Push to rubygems'
|
38
|
+
task :push => :tag do
|
39
|
+
system "gem push pkg/#{file}"
|
40
|
+
end
|
41
|
+
|
42
|
+
task default: :test
|
data/lib/sapluuna/context.rb
CHANGED
@@ -43,9 +43,10 @@ class Sapluuna
|
|
43
43
|
|
44
44
|
def import file
|
45
45
|
template = File.read resolve_file(file)
|
46
|
-
@opts[:variables]
|
47
|
-
@opts[:root_directory]
|
46
|
+
@opts[:variables] = @variables
|
47
|
+
@opts[:root_directory] = @root_directory.dup
|
48
48
|
@opts[:discover_variables] = @discover_variables
|
49
|
+
@opts[:context] = self.class
|
49
50
|
Log.debug "importing #{file}"
|
50
51
|
sapl = Sapluuna.new @opts
|
51
52
|
output = sapl.parse template
|
data/sapluuna.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'sapluuna'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.licenses = %w( Apache-2.0 )
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = [ 'Saku Ytti' ]
|
@@ -13,6 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.executables = %w( sapluuna )
|
14
14
|
s.require_path = 'lib/sapluuna'
|
15
15
|
|
16
|
-
s.required_ruby_version =
|
17
|
-
s.add_runtime_dependency
|
16
|
+
s.required_ruby_version = '>= 2.0.0'
|
17
|
+
s.add_runtime_dependency 'slop', '~> 4.0'
|
18
|
+
|
19
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
18
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapluuna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saku Ytti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
27
41
|
description: Template based network configuration generator
|
28
42
|
email:
|
29
43
|
- saku@ytti.fi
|
@@ -64,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
78
|
version: '0'
|
65
79
|
requirements: []
|
66
80
|
rubyforge_project: sapluuna
|
67
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.5.2
|
68
82
|
signing_key:
|
69
83
|
specification_version: 4
|
70
84
|
summary: Template parser
|