filegen 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/{README.DEVELOPER.md → CONTRIBUTING.md} +0 -0
- data/Gemfile +29 -26
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/features/error_handling.feature +11 -0
- data/features/support/env.rb +6 -1
- data/lib/filegen.rb +2 -0
- data/lib/filegen/data_sources/yaml.rb +2 -2
- data/lib/filegen/exceptions.rb +3 -0
- data/lib/filegen/runner.rb +6 -3
- data/lib/filegen/version.rb +1 -1
- data/share/archlinux/PKGBUILD +38 -0
- data/spec/data_sources/yaml_spec.rb +6 -5
- data/spec/support/debugging.rb +6 -1
- data/spec/support/{config.rb → rspec.rb} +0 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e274f34d1c3bdb315d61f8a64256f639189a7013
|
4
|
+
data.tar.gz: b8933b8b512918fe7c0e7491ad0fa0c25e7770b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0de6d52b07d2cc21a39c4af931553fda06c69614921bdecff0da36a4bd69d2ba954919cea05bfdcd572768a918454f4baaf6b75ca17edf8fc66e3eea661dba09
|
7
|
+
data.tar.gz: e79a8ebd0721599d9806b0bda60bc7e22278f0907bd3a773d8c6cb4939f33420452b36018c31373b9e41a5e1ba206e1174f1fb902c64c1848601e94f650f2388
|
data/.rspec
CHANGED
File without changes
|
data/Gemfile
CHANGED
@@ -1,34 +1,37 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
#
|
3
|
+
# use gem spec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
group :test do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
6
|
+
group :development, :test do
|
7
|
+
if RUBY_VERSION < '2.0.0'
|
8
|
+
gem 'pry-debugger', require: false
|
9
|
+
gem 'debugger'
|
10
|
+
gem 'debugger-completion', require: false
|
11
|
+
else
|
12
|
+
gem 'pry-byebug', require: false
|
13
|
+
gem 'byebug'
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
gem '
|
18
|
-
gem 'awesome_print'
|
19
|
-
gem '
|
20
|
-
gem '
|
21
|
-
gem '
|
22
|
-
gem '
|
23
|
-
gem '
|
24
|
-
gem '
|
16
|
+
gem 'activesupport', require: false
|
17
|
+
gem 'aruba', require: false
|
18
|
+
gem 'awesome_print', require: 'ap'
|
19
|
+
gem 'bundler', '~> 1.3', require: false
|
20
|
+
gem 'coveralls', require: false
|
21
|
+
gem 'cucumber', require: false
|
22
|
+
gem 'erubis'
|
23
|
+
gem 'fedux_org-stdlib', require: false
|
24
|
+
gem 'fuubar'
|
25
25
|
gem 'github-markup'
|
26
|
+
gem 'pry', require: false
|
27
|
+
gem 'pry-doc', require: false
|
28
|
+
gem 'rake', require: false
|
26
29
|
gem 'redcarpet'
|
30
|
+
gem 'rspec', require: false
|
31
|
+
gem 'rspec-legacy_formatters', require: false
|
32
|
+
gem 'rubocop', require: false
|
33
|
+
gem 'simplecov'
|
34
|
+
gem 'tmrb', require: false
|
35
|
+
gem 'versionomy'
|
36
|
+
gem 'yard', require: false
|
27
37
|
end
|
28
|
-
|
29
|
-
gem 'rake', group: [:development, :test]
|
30
|
-
gem 'fedux_org-stdlib', group: [:development, :test]
|
31
|
-
gem 'bundler', '~> 1.3', group: [:development, :test]
|
32
|
-
gem 'erubis', group: [:development, :test]
|
33
|
-
gem 'versionomy', group: [:development, :test]
|
34
|
-
gem 'activesupport', group: [:development, :test]
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -26,3 +26,14 @@ Feature: Error handling
|
|
26
26
|
File "template1.abc" is not a valid erb template: file ending erb
|
27
27
|
"""
|
28
28
|
|
29
|
+
@wip
|
30
|
+
Scenario: Non existing YAML-file
|
31
|
+
Given a file named "template.erb" with:
|
32
|
+
"""
|
33
|
+
Hello <%= lookup('name') %>!
|
34
|
+
"""
|
35
|
+
When I run `filegen -y input.yaml template.erb`
|
36
|
+
Then the stderr should contain:
|
37
|
+
"""
|
38
|
+
Yaml-file "input.yaml" not found
|
39
|
+
"""
|
data/features/support/env.rb
CHANGED
data/lib/filegen.rb
CHANGED
@@ -13,8 +13,8 @@ module Filegen
|
|
13
13
|
# Create data source
|
14
14
|
def initialize(file)
|
15
15
|
@source = HashWithIndifferentAccess.new(Psych.load_file(file))
|
16
|
-
rescue
|
17
|
-
|
16
|
+
rescue Errno::ENOENT
|
17
|
+
raise Exceptions::YamlFileNotFound, JSON.dump(file: file)
|
18
18
|
end
|
19
19
|
|
20
20
|
def fetch(key, default_value = nil)
|
data/lib/filegen/exceptions.rb
CHANGED
data/lib/filegen/runner.rb
CHANGED
@@ -32,15 +32,18 @@ module Filegen
|
|
32
32
|
generator.compile(options.source, options.destination)
|
33
33
|
|
34
34
|
exitstatus = 0
|
35
|
-
rescue RuntimeError => e
|
36
|
-
Filegen::Ui.error e.message
|
37
|
-
exitstatus = 1
|
38
35
|
rescue Interrupt
|
39
36
|
Filegen::Ui.warning 'You told me to stop command execution.'
|
40
37
|
exitstatus = 2
|
41
38
|
rescue Exceptions::ErbTemplateHasSyntaxErrors => e
|
42
39
|
Filegen::Ui.error "Syntax error in ERB-Template: \n" + e.message
|
43
40
|
exitstatus = 3
|
41
|
+
rescue Exceptions::YamlFileNotFound => e
|
42
|
+
Filegen::Ui.error "Yaml-file \"#{JSON.parse(e.message)['file']}\" not found."
|
43
|
+
exitstatus = 4
|
44
|
+
rescue StandardError => e
|
45
|
+
Filegen::Ui.error "#{e.class} - #{e.message}"
|
46
|
+
exitstatus = 99
|
44
47
|
end
|
45
48
|
|
46
49
|
@kernel.exit(exitstatus)
|
data/lib/filegen/version.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Maintainer: Max Meyer <dev@fedux.org>
|
2
|
+
pkgname=filegen
|
3
|
+
pkgver=0.4.1
|
4
|
+
pkgrel=1
|
5
|
+
pkgdesc="generating files made easy"
|
6
|
+
arch=(i686 x86_64)
|
7
|
+
url="https://github.com/dg-vrnetze/${pkgname}"
|
8
|
+
license=('MIT')
|
9
|
+
depends=(ruby)
|
10
|
+
makedepends=(rubygems)
|
11
|
+
source=(http://gems.rubyforge.org/gems/$pkgname-$pkgver.gem)
|
12
|
+
noextract=($pkgname-$pkgver.gem)
|
13
|
+
sha256sums=('34b0c3082b41bf44c0d2b4f906871c135e651a84de9d3be124d2f45ff4b79881')
|
14
|
+
|
15
|
+
package() {
|
16
|
+
cd "$srcdir"
|
17
|
+
|
18
|
+
_library_dir=/usr/lib/${pkgname}
|
19
|
+
_share_dir="${_library_dir}/gems/${pkgname}-${pkgver}/share"
|
20
|
+
_systemd_dir=/usr/lib/systemd/system
|
21
|
+
_bin_dir=/usr/bin
|
22
|
+
|
23
|
+
install -d ${pkgdir}${_library_dir}
|
24
|
+
install -d ${pkgdir}${_bin_dir}
|
25
|
+
|
26
|
+
gem install --env-shebang --wrappers --no-ri --no-rdoc --install-dir ${pkgdir}/${_library_dir} $pkgname
|
27
|
+
|
28
|
+
echo '#!/usr/bin/env bash' >> ${pkgdir}${_bin_dir}/${pkgname}
|
29
|
+
echo "export GEM_HOME='${_library_dir}'" >> ${pkgdir}${_bin_dir}/${pkgname}
|
30
|
+
echo "export GEM_PATH='${_library_dir}'" >> ${pkgdir}${_bin_dir}/${pkgname}
|
31
|
+
echo "export GEM_ROOT='${_library_dir}'" >> ${pkgdir}${_bin_dir}/${pkgname}
|
32
|
+
echo "exec ${_library_dir}/gems/${pkgname}-${pkgver}/bin/${pkgname} \$*" >> ${pkgdir}${_bin_dir}/${pkgname}
|
33
|
+
|
34
|
+
chmod a+x ${pkgdir}${_bin_dir}/${pkgname}
|
35
|
+
rm -r ${pkgdir}${_library_dir}/cache
|
36
|
+
}
|
37
|
+
|
38
|
+
# vim:set ts=2 sw=2 et:
|
@@ -2,6 +2,12 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe DataSources::Yaml do
|
5
|
+
context '#initialize' do
|
6
|
+
it 'raises an exception if the yaml file cannot be found' do
|
7
|
+
expect { DataSources::Yaml.new('not valid file') }.to raise_error Exceptions::YamlFileNotFound
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
context '#fetch' do
|
6
12
|
it 'retrieves variables from yaml file' do
|
7
13
|
file = create_file('blub.yaml', <<-EOF.strip_heredoc
|
@@ -32,10 +38,5 @@ describe DataSources::Yaml do
|
|
32
38
|
source = DataSources::Yaml.new(file)
|
33
39
|
expect(source.fetch('NOT_MY_NAME')).to be_nil
|
34
40
|
end
|
35
|
-
|
36
|
-
it 'returns nil if file cannot be found' do
|
37
|
-
source = DataSources::Yaml.new('not valid file')
|
38
|
-
expect(source.fetch('NOT_MY_NAME')).to be_nil
|
39
|
-
end
|
40
41
|
end
|
41
42
|
end
|
data/spec/support/debugging.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filegen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Günnewig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -40,9 +40,9 @@ files:
|
|
40
40
|
- ".travis.yml"
|
41
41
|
- ".yardopts"
|
42
42
|
- CHANGELOG.md
|
43
|
+
- CONTRIBUTING.md
|
43
44
|
- Gemfile
|
44
45
|
- LICENSE.md
|
45
|
-
- README.DEVELOPER.md
|
46
46
|
- README.md
|
47
47
|
- Rakefile
|
48
48
|
- bin/filegen
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/filegen/version.rb
|
71
71
|
- rubocop-todo.yml
|
72
72
|
- scripts/terminal
|
73
|
+
- share/archlinux/PKGBUILD
|
73
74
|
- spec/data_source_builder_spec.rb
|
74
75
|
- spec/data_sources/environment_spec.rb
|
75
76
|
- spec/data_sources/yaml_spec.rb
|
@@ -79,11 +80,11 @@ files:
|
|
79
80
|
- spec/ruby_gen_spec.rb
|
80
81
|
- spec/rubygen_spec.rb
|
81
82
|
- spec/spec_helper.rb
|
82
|
-
- spec/support/config.rb
|
83
83
|
- spec/support/debugging.rb
|
84
84
|
- spec/support/environment.rb
|
85
85
|
- spec/support/filesystem.rb
|
86
86
|
- spec/support/here_doc.rb
|
87
|
+
- spec/support/rspec.rb
|
87
88
|
homepage: https://github.com/dg-vrnetze/filegen
|
88
89
|
licenses:
|
89
90
|
- MIT
|
@@ -124,9 +125,9 @@ test_files:
|
|
124
125
|
- spec/ruby_gen_spec.rb
|
125
126
|
- spec/rubygen_spec.rb
|
126
127
|
- spec/spec_helper.rb
|
127
|
-
- spec/support/config.rb
|
128
128
|
- spec/support/debugging.rb
|
129
129
|
- spec/support/environment.rb
|
130
130
|
- spec/support/filesystem.rb
|
131
131
|
- spec/support/here_doc.rb
|
132
|
+
- spec/support/rspec.rb
|
132
133
|
has_rdoc:
|