ceritium-gitosis-config 0.0.1

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.
@@ -0,0 +1,38 @@
1
+ = GitosisConfig
2
+
3
+ == Description
4
+
5
+ Ruby Gitosis Config
6
+
7
+ == Installation
8
+
9
+ sudo gem install ceritium-gitosis-config
10
+
11
+ == Usage
12
+
13
+ require 'gitosis-config-generator'
14
+
15
+ == License
16
+
17
+ Copyright (c) 2009 José Galisteo Ruiz
18
+
19
+ Permission is hereby granted, free of charge, to any person
20
+ obtaining a copy of this software and associated documentation
21
+ files (the "Software"), to deal in the Software without
22
+ restriction, including without limitation the rights to use,
23
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ copies of the Software, and to permit persons to whom the
25
+ Software is furnished to do so, subject to the following
26
+ conditions:
27
+
28
+ The above copyright notice and this permission notice shall be
29
+ included in all copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
33
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
36
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
38
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/testtask'
4
+
5
+ require 'lib/gitosis_config/version'
6
+
7
+ task :default => :test
8
+
9
+ spec = Gem::Specification.new do |s|
10
+ s.name = 'gitosis-config'
11
+ s.version = GitosisConfig::Version.to_s
12
+ s.has_rdoc = true
13
+ s.extra_rdoc_files = %w(README.rdoc)
14
+ s.rdoc_options = %w(--main README.rdoc)
15
+ s.summary = "Ruby Gitosis Config"
16
+ s.author = 'José Galisteo'
17
+ s.email = 'ceritium@gmail.com'
18
+ s.homepage = 'http://github.com/ceritium/gitosis-config/tree/master'
19
+ s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
20
+ # s.executables = ['gitosis-config']
21
+
22
+ # s.add_dependency('gem_name', '~> 0.0.1')
23
+ end
24
+
25
+ Rake::GemPackageTask.new(spec) do |pkg|
26
+ pkg.gem_spec = spec
27
+ end
28
+
29
+ Rake::TestTask.new do |t|
30
+ t.libs << 'test'
31
+ t.test_files = FileList["test/**/*_test.rb"]
32
+ t.verbose = true
33
+ end
34
+
35
+ desc 'Generate the gemspec to serve this Gem from Github'
36
+ task :github do
37
+ file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
38
+ File.open(file, 'w') {|f| f << spec.to_ruby }
39
+ puts "Created gemspec: #{file}"
40
+ end
@@ -0,0 +1,3 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'gitosis_config/gitosis_config_generator.rb'
@@ -0,0 +1,36 @@
1
+ class GitosisConfigGenerator
2
+
3
+ def initialize
4
+ @config = {}
5
+ end
6
+
7
+ def add_group(name, options = {})
8
+ @config.store(name, {:writable => options[:writable], :readonly => options[:readonly], :members => options[:members]})
9
+ end
10
+
11
+ def to_file(path)
12
+ File.open(path, "w") do |file|
13
+ file.puts "[gitosis]"
14
+ file.puts "\n"
15
+ @config.each_key do |key|
16
+ file.puts "[group #{key}]"
17
+ @config[key].each_pair do |key, value|
18
+ unless value.nil?
19
+ values = value.to_a.join(' ')
20
+ file.puts "#{key} = #{values}"
21
+ end
22
+ end
23
+ file.puts "\n"
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+
31
+ # Example
32
+ #
33
+ # config = GitosisCofigGenerator.new
34
+ # config.add_group('babelhub', :members => ['deploy@flowersinspace', 'deploy@babelhub'], :writable => 'google')
35
+ # config.add_group('work-deploy', :members => ['deploy@mola_mazo'], :readonly => ['billgate', 'stallman'])
36
+ # config.to_file('exit.txt')
@@ -0,0 +1,13 @@
1
+ module GitosisConfig
2
+ module Version
3
+
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ TINY = 1
7
+
8
+ def self.to_s # :nodoc:
9
+ [MAJOR, MINOR, TINY].join('.')
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ # http://sneaq.net/textmate-wtf
2
+ $:.reject! { |e| e.include? 'TextMate' }
3
+
4
+ require 'rubygems'
5
+ require 'test/unit'
6
+ require 'matchy'
7
+ require 'context'
8
+ require 'mocha'
9
+
10
+ require File.dirname(__FILE__) + '/../lib/gitosis_config'
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GitosisConfigTest < Test::Unit::TestCase
4
+
5
+ describe "An instance of the GitosisConfig class" do
6
+
7
+ it "should flunk" do
8
+ flunk "Please provide some tests"
9
+ end
10
+
11
+ end
12
+
13
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ceritium-gitosis-config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - "Jos\xC3\xA9 Galisteo"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-26 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: ceritium@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - README.rdoc
26
+ - Rakefile
27
+ - lib/gitosis_config
28
+ - lib/gitosis_config/gitosis_config_generator.rb
29
+ - lib/gitosis_config/version.rb
30
+ - lib/gitosis_config.rb
31
+ - test/test_helper.rb
32
+ - test/unit
33
+ - test/unit/gitosis_config_test.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/ceritium/gitosis-config/tree/master
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --main
39
+ - README.rdoc
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: Ruby Gitosis Config
61
+ test_files: []
62
+