simple_scripting 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +5 -3
- data/LICENSE +3 -3
- data/lib/simple_scripting/configuration.rb +7 -0
- data/lib/simple_scripting/version.rb +1 -1
- data/simple_scripting.gemspec +1 -1
- data/spec/simple_scripting/configuration_spec.rb +13 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb9a4aca2b7495bf0ce6236f6052bcc7c55c2624
|
4
|
+
data.tar.gz: 5e4c2c1cdc733a142955b1462546ef7ab0535e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c96951fcb96d49f0e4b4e512788b8f45c860d28d1dba22be29023db869f44bebf87b188458e8f264fc23503f104e0bd53f50bbe9b3df6efeec880c4c944b836
|
7
|
+
data.tar.gz: 2f8f5c74c08f01e5a5ac020df7bd3011b21e2c0ebfc6282a7fc6e6a0d347ffd87acf4d59513dccba9a3fdf8c646229f9b455aceae55d4b14293bd88f0a0c9a90
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/LICENSE
CHANGED
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
|
|
631
631
|
state the exclusion of warranty; and each file should have at least
|
632
632
|
the "copyright" line and a pointer to where the full notice is found.
|
633
633
|
|
634
|
-
|
635
|
-
Copyright (C)
|
634
|
+
SimpleScripting - library for simplifying typical scripting functionalities
|
635
|
+
Copyright (C) 2017 Saverio Miroddi
|
636
636
|
|
637
637
|
This program is free software: you can redistribute it and/or modify
|
638
638
|
it under the terms of the GNU General Public License as published by
|
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|
652
652
|
If the program does terminal interaction, make it output a short
|
653
653
|
notice like this when it starts in an interactive mode:
|
654
654
|
|
655
|
-
|
655
|
+
SimpleScripting Copyright (C) 2017 Saverio Miroddi
|
656
656
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657
657
|
This is free software, and you are welcome to redistribute it
|
658
658
|
under certain conditions; type `show c' for details.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'configuration/value'
|
2
2
|
|
3
|
+
require 'fileutils'
|
3
4
|
require 'ostruct'
|
4
5
|
require 'parseconfig'
|
5
6
|
|
@@ -10,6 +11,8 @@ module SimpleScripting
|
|
10
11
|
extend self
|
11
12
|
|
12
13
|
def load(config_file: default_config_file, passwords_key: nil)
|
14
|
+
create_empty_file(config_file) if !File.exists?(config_file)
|
15
|
+
|
13
16
|
configuration = ParseConfig.new(config_file)
|
14
17
|
|
15
18
|
convert_to_cool_format(OpenStruct.new, configuration.params, passwords_key)
|
@@ -17,6 +20,10 @@ module SimpleScripting
|
|
17
20
|
|
18
21
|
private
|
19
22
|
|
23
|
+
def create_empty_file(file)
|
24
|
+
FileUtils.touch(file)
|
25
|
+
end
|
26
|
+
|
20
27
|
def default_config_file
|
21
28
|
base_config_filename = '.' + File.basename($PROGRAM_NAME).chomp('.rb')
|
22
29
|
|
data/simple_scripting.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = SimpleScripting::VERSION
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.authors = ["Saverio Miroddi"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2018-01-26"
|
13
13
|
s.email = ["saverio.pub2@gmail.com"]
|
14
14
|
s.homepage = "https://github.com/saveriomiroddi/simple_scripting"
|
15
15
|
s.summary = "Library for simplifying some typical scripting functionalities."
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative '../../lib/simple_scripting/configuration.rb'
|
2
2
|
|
3
3
|
require 'tempfile'
|
4
|
+
require 'tmpdir'
|
4
5
|
|
5
6
|
module SimpleScripting::ConfigurationSpecHelper
|
6
7
|
|
@@ -53,4 +54,16 @@ g2_key=bang
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
57
|
+
it "should create the configuration file if it doesn't exist" do
|
58
|
+
temp_config_file = File.join(Dir.tmpdir, '.test_simple_scripting_config')
|
59
|
+
|
60
|
+
File.delete(temp_config_file) if File.exists?(temp_config_file)
|
61
|
+
|
62
|
+
begin
|
63
|
+
described_class.load(config_file: temp_config_file)
|
64
|
+
ensure
|
65
|
+
File.delete(temp_config_file)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
56
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_scripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saverio Miroddi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parseconfig
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.6.
|
113
|
+
rubygems_version: 2.6.14
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Library for simplifying some typical scripting functionalities.
|