netatalk-config 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in netatalk-config.gemspec
4
+ gemspec
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jens Bissinger
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # NetatalkConfig
2
+
3
+ Ruby-based configuration for netatalk services.
4
+
5
+ * generate afp.conf
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'netatalk-config'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install netatalk-config
20
+
21
+ ## Usage
22
+
23
+ configure some shares
24
+
25
+ NetatalkConfig.shares['my_share'] = {
26
+ 'path' => '/path/to/my/share'
27
+ }
28
+
29
+ NetatalkConfig.shares['my_timemachine'] = {
30
+ 'path' => '/path/to/my/timemachine/backups',
31
+ 'time_machine' => true
32
+ }
33
+
34
+ NetatalkConfig.afp # => afp.conf content
35
+
36
+ and print out the afp.conf
37
+
38
+ [my_timemachine]
39
+ path = /path/to/my/timemachine/backups
40
+ time machine = yes
41
+ [my_share]
42
+ path = /path/to/my/share
43
+
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create new Pull Request
52
+
53
+ ## LICENSE
54
+
55
+ (c) 2013 Jens Bissinger. See [LICENSE](LICENSE.txt).
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ require "erb"
2
+ require "netatalk-config/version"
3
+
4
+ module NetatalkConfig
5
+ class << self
6
+ def afp
7
+ template.result binding
8
+ end
9
+
10
+ def shares
11
+ @shares ||= {}
12
+ end
13
+
14
+ private
15
+
16
+ def template
17
+ ERB.new File.read(__FILE__).split("__END__\n").last
18
+ end
19
+ end
20
+ end
21
+
22
+ __END__
23
+ <% shares.each do |name, share| %>
24
+ [<%= name %>]
25
+ path = <%= share['path'] %>
26
+ <% if share['time_machine'] == true %>time machine = yes<% end %>
27
+ <% end %>
@@ -0,0 +1,3 @@
1
+ module NetatalkConfig
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'netatalk-config/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "netatalk-config"
8
+ gem.version = NetatalkConfig::VERSION
9
+ gem.authors = ["Jens Bissinger"]
10
+ gem.email = ["mail@jens-bissinger.de"]
11
+ gem.description = %q{netatalk configuration using ruby}
12
+ gem.summary = %q{e.g. for generating afp.conf}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "rspec"
21
+ gem.add_development_dependency "guard-rspec"
22
+ end
@@ -0,0 +1,42 @@
1
+ require "spec_helper"
2
+ require "netatalk-config"
3
+
4
+ describe NetatalkConfig do
5
+ context 'no shares' do
6
+ its('afp') { should match(/\A\s*\z/) }
7
+ end
8
+
9
+ shared_context 'simple share' do
10
+ before do
11
+ subject.shares['simple'] = {
12
+ 'path' => '/simple/path'
13
+ }
14
+ end
15
+ end
16
+
17
+ shared_context 'advanced share' do
18
+ before do
19
+ subject.shares['advanced'] = {
20
+ 'path' => '/advanced/path',
21
+ 'time_machine' => true
22
+ }
23
+ end
24
+ end
25
+
26
+ context 'simple share' do
27
+ include_context 'simple share'
28
+ its('afp') { should include("[simple]\n path = /simple/path") }
29
+ end
30
+
31
+ context 'advanced shares' do
32
+ include_context 'advanced share'
33
+ its('afp') { should include("[advanced]\n path = /advanced/path\n time machine = yes") }
34
+ end
35
+
36
+ context 'simple + advanced shares' do
37
+ include_context 'simple share'
38
+ include_context 'advanced share'
39
+ its('afp') { should include("[simple]\n path = /simple/path") }
40
+ its('afp') { should include("[advanced]\n path = /advanced/path\n time machine = yes") }
41
+ end
42
+ end
@@ -0,0 +1,21 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
18
+
19
+ lib = File.expand_path('../../lib', __FILE__)
20
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
21
+
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: netatalk-config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jens Bissinger
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: guard-rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: netatalk configuration using ruby
47
+ email:
48
+ - mail@jens-bissinger.de
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - .rspec
55
+ - Gemfile
56
+ - Guardfile
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - lib/netatalk-config.rb
61
+ - lib/netatalk-config/version.rb
62
+ - netatalk-config.gemspec
63
+ - spec/lib/netatalk-config_spec.rb
64
+ - spec/spec_helper.rb
65
+ homepage: ''
66
+ licenses: []
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.23
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: e.g. for generating afp.conf
89
+ test_files:
90
+ - spec/lib/netatalk-config_spec.rb
91
+ - spec/spec_helper.rb
92
+ has_rdoc: