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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8f032bc3e5af19254d43227a9aaa57862c98738
4
- data.tar.gz: ddcd49a81e0e7f96d38e61bf662dcda7ea7cc4e9
3
+ metadata.gz: fb9a4aca2b7495bf0ce6236f6052bcc7c55c2624
4
+ data.tar.gz: 5e4c2c1cdc733a142955b1462546ef7ab0535e07
5
5
  SHA512:
6
- metadata.gz: ef418ad76c9fd9c7d7509ec1198076f19315d0bbb797979f938e2ee9d960a123ccbfdb1397f0eff49699489cecdcbb76bdbccf7e807820983d16529cbc0d79e0
7
- data.tar.gz: 2ea8945bc2b3c5cb282d6ff17df9c5ef2822d23bec986450e82b8e72341ee5e0b97afe84573b356c3abcd455d0be76e14447706dc913efa503e9da6214685161
6
+ metadata.gz: 6c96951fcb96d49f0e4b4e512788b8f45c860d28d1dba22be29023db869f44bebf87b188458e8f264fc23503f104e0bd53f50bbe9b3df6efeec880c4c944b836
7
+ data.tar.gz: 2f8f5c74c08f01e5a5ac020df7bd3011b21e2c0ebfc6282a7fc6e6a0d347ffd87acf4d59513dccba9a3fdf8c646229f9b455aceae55d4b14293bd88f0a0c9a90
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .byebug_history
2
+ .ruby-version
2
3
  coverage/
data/.travis.yml CHANGED
@@ -1,7 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1
5
3
  - 2.2
6
4
  - 2.3
7
- - 2.4
5
+ - 2.4
6
+ - 2.5
7
+ # Bundler+Rubygems issue; see https://github.com/travis-ci/travis-ci/issues/8978
8
+ before_install:
9
+ - gem update --system
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
- {one line to give the program's name and a brief idea of what it does.}
635
- Copyright (C) {year} {name of author}
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
- {project} Copyright (C) {year} {fullname}
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
 
@@ -1,5 +1,5 @@
1
1
  module SimpleScripting
2
2
 
3
- VERSION = "0.9.3"
3
+ VERSION = "0.9.4"
4
4
 
5
5
  end
@@ -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 = "2017-06-27"
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.3
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: 2017-06-27 00:00:00.000000000 Z
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.13
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.