footman 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.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in footman.gemspec
4
+ gemspec
@@ -0,0 +1,23 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ footman (0.0.1)
5
+ ffi
6
+ listen
7
+ methadone
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ffi (1.1.5)
13
+ listen (0.5.3)
14
+ methadone (1.2.2)
15
+ bundler
16
+ rake (10.0.1)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ footman!
23
+ rake
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 pagodabox
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,81 @@
1
+ # Footman
2
+
3
+ This gem is still growing.
4
+
5
+ ## Installation
6
+ Depends upon having reprepro tool installed (if debian based) or createrepo installed (if red hat based).
7
+ Ruby 1.9.+ is required to use this gem.
8
+
9
+ 'createrepo' (rpm) tool does not require any pre-setup to the repository or watched directory.
10
+ - - -
11
+ 'reprepro' (deb) tool requires pre-setup.
12
+ The repository directory for deb files must contain:
13
+ <pre><code>
14
+ conf/
15
+ conf/distributions
16
+ conf/options
17
+ conf/override.precise
18
+ </pre></code>
19
+
20
+ options file is empty, but needed to make reprepro happy
21
+
22
+ distributions file will contain:
23
+ <pre><code>Origin: Tyler
24
+ Label: Tyler's Personal Debs
25
+ Codename: precise
26
+ Architectures: i386 amd64 source lpia
27
+ Components: main
28
+ Description: Tylers Personal Debian Repository
29
+ DebOverride: override.precise
30
+ DscOverride: override.precise
31
+
32
+ Origin: Tyler
33
+ Label: Tyler's Personal Debs
34
+ Codename: lenny
35
+ Architectures: i386 amd64 source lpia
36
+ Components: main
37
+ Description: Tylers Personal Debian Repository
38
+ DebOverride: override.lenny
39
+ DscOverride: override.lenny
40
+ </code></pre>
41
+ Note that the code name is for each distribution repository you support.
42
+ for each distribtuion repository you support there must be an override file.
43
+
44
+ override file can be left empty, footman will fill it out when a new package is added.
45
+
46
+ The watched directory must have sub directorys named after each of the distribution repositories
47
+ you support. For example my watched directory at /path/ will have two subdirectories:
48
+ <pre><code>/path/lenny/
49
+ /path/precise/</code></pre>
50
+ Packages must be dropped into the subdirectory that corrosponds with the distribution they were
51
+ built on.
52
+ - - -
53
+
54
+ Add this line to your application's Gemfile:
55
+
56
+ gem 'footman'
57
+
58
+ And then execute:
59
+
60
+ $ bundle
61
+
62
+ Or install it yourself as:
63
+
64
+ $ gem install footman
65
+
66
+ Or locally:
67
+
68
+ $ gem build footman.gemspec
69
+ $ gem install footman --local
70
+
71
+ ## Usage
72
+
73
+ footman path/to/watch path/to/repo
74
+
75
+ ## Contributing
76
+
77
+ 1. Fork it
78
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
79
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
80
+ 4. Push to the branch (`git push origin my-new-feature`)
81
+ 5. Create new Pull Request
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'methadone'
5
+ require 'footman'
6
+
7
+ include Methadone::Main
8
+ include Methadone::CLILogging
9
+
10
+ main do |directory, repository|
11
+
12
+ Footman.configure do |config|
13
+ config.directory = directory
14
+ config.repository = repository
15
+ end
16
+
17
+ Footman::Watcher.start
18
+ end
19
+
20
+ description 'A tool for accepting binary packages and updating their corresponding repos (i.e. rpm, deb)'
21
+
22
+ arg :directory, :required
23
+ arg :repository, :required
24
+
25
+ go!
@@ -0,0 +1,20 @@
1
+ require "footman/version"
2
+ require "footman/config"
3
+ require "footman/watcher"
4
+ require "footman/package"
5
+ require "footman/package/base"
6
+ require "footman/package/deb"
7
+ require "footman/package/rpm"
8
+
9
+ module Footman
10
+ extend self
11
+
12
+ def config
13
+ @config ||= Config.new
14
+ end
15
+
16
+ def configure
17
+ yield config if block_given?
18
+ end
19
+
20
+ end
@@ -0,0 +1,11 @@
1
+ module Footman
2
+ class Config
3
+
4
+ attr_accessor :directory, :repository
5
+
6
+ def initialize
7
+ # set defaults
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module Footman
2
+ module Package
3
+ extend self
4
+
5
+ def factory(file)
6
+ case File.extname(file)
7
+ when ".deb"
8
+ Deb.new file
9
+ when ".rpm"
10
+ Rpm.new file
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Footman
2
+ module Package
3
+ class Base
4
+
5
+ def initialize(file)
6
+ @file = file
7
+ end
8
+
9
+ def process; end
10
+
11
+ protected
12
+
13
+ def config
14
+ Footman.config
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ module Footman
2
+ module Package
3
+ class Deb < Footman::Package::Base
4
+
5
+ def initialize(file)
6
+ super file
7
+
8
+ file.match(/.*\/(?<built_on>[a-z]+)\/(?<name>[^_]+)[_|-](?<version>[^_]+)[_|-](?<arch>[^\.]+)\.(?<extname>\S+)\z/i) do |match|
9
+ @built_on = match[:built_on]
10
+ @name = match[:name]
11
+ end
12
+ end
13
+
14
+ def process
15
+ add_package
16
+ cleanup
17
+ end
18
+
19
+ protected
20
+
21
+ def add_package
22
+ `cd #{config.repository}; reprepro includedeb #{@built_on} #{@file}`
23
+ end
24
+
25
+ def cleanup
26
+ File.delete @file
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ module Footman
2
+ module Package
3
+ class Rpm < Footman::Package::Base
4
+
5
+ def process
6
+ copy_package
7
+ add_package
8
+ cleanup
9
+ end
10
+
11
+ def cleanup
12
+ File.delete @file
13
+ end
14
+
15
+ def add_package
16
+ `createrepo #{config.repository}`
17
+ end
18
+
19
+ def copy_package
20
+ `cp #{@file} #{config.repository}/#{File.basename(@file)}`
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Footman
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'listen'
2
+
3
+ module Footman
4
+ module Watcher
5
+ extend self
6
+
7
+ def build
8
+ ::Listen::Listener.new(config.directory, relative_paths: false) do |_modified, added, _removed|
9
+ added.each do |file|
10
+ package(file).process
11
+ end
12
+ end
13
+ end
14
+
15
+ def start
16
+ build.start
17
+ end
18
+
19
+ def config
20
+ Footman.config
21
+ end
22
+
23
+ def package(file)
24
+ Package.factory(file)
25
+ end
26
+
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: footman
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - tylerjones
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ffi
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: methadone
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
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
+ - !ruby/object:Gem::Dependency
47
+ name: listen
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: ! "# Footman\n\nThis gem is still growing.\n\n## Installation\nDepends
79
+ upon having reprepro tool installed (if debian based) or createrepo installed (if
80
+ red hat based).\nRuby 1.9.+ is required to use this gem.\n\n'createrepo' (rpm) tool
81
+ does not require any pre-setup to the repository or watched directory.\n- - -\n'reprepro'
82
+ (deb) tool requires pre-setup.\nThe repository directory for deb files must contain:\n<pre><code>\nconf/\nconf/distributions\nconf/options\nconf/override.precise\n</pre></code>\n\noptions
83
+ file is empty, but needed to make reprepro happy\n\ndistributions file will contain:\n<pre><code>Origin:
84
+ Tyler\nLabel: Tyler's Personal Debs\nCodename: precise\nArchitectures: i386 amd64
85
+ source lpia\nComponents: main\nDescription: Tylers Personal Debian Repository\nDebOverride:
86
+ override.precise\nDscOverride: override.precise\n\nOrigin: Tyler\nLabel: Tyler's
87
+ Personal Debs\nCodename: lenny\nArchitectures: i386 amd64 source lpia\nComponents:
88
+ main\nDescription: Tylers Personal Debian Repository\nDebOverride: override.lenny\nDscOverride:
89
+ override.lenny\n</code></pre>\nNote that the code name is for each distribution
90
+ repository you support.\nfor each distribtuion repository you support there must
91
+ be an override file.\n\noverride file can be left empty, footman will fill it out
92
+ when a new package is added.\n\nThe watched directory must have sub directorys named
93
+ after each of the distribution repositories\nyou support. For example my watched
94
+ directory at /path/ will have two subdirectories:\n<pre><code>/path/lenny/\n/path/precise/</code></pre>\nPackages
95
+ must be dropped into the subdirectory that corrosponds with the distribution they
96
+ were\nbuilt on.\n- - -\n\nAdd this line to your application's Gemfile:\n\n gem
97
+ 'footman'\n\nAnd then execute:\n\n $ bundle\n\nOr install it yourself as:\n\n
98
+ \ $ gem install footman\n\nOr locally:\n\n $ gem build footman.gemspec\n $
99
+ gem install footman --local\n\n## Usage\n\nfootman path/to/watch path/to/repo\n\n##
100
+ Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3.
101
+ Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch
102
+ (`git push origin my-new-feature`)\n5. Create new Pull Request\n"
103
+ email:
104
+ - tjones@pagodabox.com
105
+ executables:
106
+ - footman
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - Gemfile
111
+ - Gemfile.lock
112
+ - LICENSE.txt
113
+ - README.md
114
+ - bin/footman
115
+ - lib/footman.rb
116
+ - lib/footman/config.rb
117
+ - lib/footman/package.rb
118
+ - lib/footman/package/base.rb
119
+ - lib/footman/package/deb.rb
120
+ - lib/footman/package/rpm.rb
121
+ - lib/footman/version.rb
122
+ - lib/footman/watcher.rb
123
+ homepage: https://github.com/Pagoda/footman
124
+ licenses: []
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 1.8.24
144
+ signing_key:
145
+ specification_version: 3
146
+ summary: A tool for accepting binary packages and updating their corresponding repos
147
+ (i.e. rpm, deb)
148
+ test_files: []