devinstall 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.idea/codeStyleSettings.xml +13 -0
- data/.idea/devinstall.iml +23 -0
- data/.idea/dictionaries/dragos.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/inspectionProfiles/Project_Default.xml +11 -0
- data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README +1 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/bin/pkg-tool +38 -0
- data/devinstall.gemspec +24 -0
- data/doc/example.yml +58 -0
- data/lib/devinstall/deep_symbolize.rb +65 -0
- data/lib/devinstall/settings.rb +55 -0
- data/lib/devinstall/version.rb +3 -0
- data/lib/devinstall.rb +96 -0
- metadata +119 -0
data/.gitignore
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectCodeStyleSettingsManager">
|
4
|
+
<option name="PER_PROJECT_SETTINGS">
|
5
|
+
<value>
|
6
|
+
<XML>
|
7
|
+
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
8
|
+
</XML>
|
9
|
+
</value>
|
10
|
+
</option>
|
11
|
+
</component>
|
12
|
+
</project>
|
13
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="$MODULE_DIR$/test" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$">
|
14
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
15
|
+
</content>
|
16
|
+
<orderEntry type="inheritedJdk" />
|
17
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.0.pre.8, ruby-1.9.3-p374) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="getopt (v1.4.1, ruby-1.9.3-p374) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.0.3, ruby-1.9.3-p374) [gem]" level="application" />
|
21
|
+
</component>
|
22
|
+
</module>
|
23
|
+
|
data/.idea/encodings.xml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
2
|
+
<profile version="1.0" is_locked="false">
|
3
|
+
<option name="myName" value="Project Default" />
|
4
|
+
<option name="myLocal" value="false" />
|
5
|
+
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
6
|
+
<option name="processCode" value="true" />
|
7
|
+
<option name="processLiterals" value="true" />
|
8
|
+
<option name="processComments" value="true" />
|
9
|
+
</inspection_tool>
|
10
|
+
</profile>
|
11
|
+
</component>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/devinstall.iml" filepath="$PROJECT_DIR$/.idea/devinstall.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
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.
|
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
This file was created by JetBrains RubyMine 5.0 for binding GitHub repository
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Devinstall
|
2
|
+
|
3
|
+
This is a poor man automatic builder / installer / deployer for packages.
|
4
|
+
|
5
|
+
The build happens on a remote machine (in the future on several remote machines by package type)
|
6
|
+
via external tools rsync and ssh.
|
7
|
+
|
8
|
+
The packages are installed on the remote machines also via external rsync/scp and sshsudo
|
9
|
+
(until I will implement something more appropriate in Ruby)
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'devinstall'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install devinstall
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Example command:
|
28
|
+
|
29
|
+
$ devinstall –config ./config.yml --environment dev --package ui-lbgenerate --action install
|
30
|
+
|
31
|
+
This will build and install the package on dev environment
|
32
|
+
|
33
|
+
or
|
34
|
+
|
35
|
+
$ devinstall --config ./config.yml --environment dev-rh --package ui-lbgenerate --action upload
|
36
|
+
|
37
|
+
This will build and upload package to repository for dev-rh environment as defined in config.yml
|
38
|
+
|
39
|
+
The command line parameters are:
|
40
|
+
|
41
|
+
--config: the config file (defaults to ./config.yml)
|
42
|
+
|
43
|
+
--environment: the environment for the install or upload action
|
44
|
+
|
45
|
+
-- package: the package to be built and installed/uploaded
|
46
|
+
|
47
|
+
--type: only for –action build and specifies the package type (deb, rpm, tar.gz, arc....)
|
48
|
+
|
49
|
+
--action: can be build (require also --type), install (require --environment) or upload (also require --environment)
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/pkg-tool
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'getoptlong'
|
4
|
+
require 'devinstall'
|
5
|
+
require 'devinstall/settings'
|
6
|
+
|
7
|
+
opt =Getopt::Long.getopts(
|
8
|
+
['--package', '-p', Getopt::REQUIRED],
|
9
|
+
['--config', '-c', Getopt::REQUIRED],
|
10
|
+
['--type', '-t', Getopt::REQUIRED],
|
11
|
+
['--env', '-e', Getopt::REQUIRED],
|
12
|
+
['--build', '-b', ],
|
13
|
+
['--upload', '-u', ],
|
14
|
+
['--install', '-i', ],
|
15
|
+
['--help', '-h', ],
|
16
|
+
)
|
17
|
+
|
18
|
+
if opt['help']
|
19
|
+
p('Usage: pkg-install --package|-p <package> --config|-c <config file> --build|--upload|--install')
|
20
|
+
exit!(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
Settings.load!(opt['config'])
|
24
|
+
package=Pkg.new(opt['package'])
|
25
|
+
|
26
|
+
if opt[:build]
|
27
|
+
package.build!(opt['type'].to_sym)
|
28
|
+
end
|
29
|
+
|
30
|
+
if opt[:install]
|
31
|
+
package.build!(opt['type'].to_sym)
|
32
|
+
package.install!(opt['env'].to_sym)
|
33
|
+
end
|
34
|
+
|
35
|
+
if opt[:upload]
|
36
|
+
package.build!(opt['type'].to_sym)
|
37
|
+
package.upload!(opt['env'].to_sym)
|
38
|
+
end
|
data/devinstall.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'devinstall/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'devinstall'
|
8
|
+
spec.version = Devinstall::VERSION
|
9
|
+
spec.authors = ['Dragos Boca']
|
10
|
+
spec.email = ['dboca@mail.com']
|
11
|
+
spec.description = %q{remote builder and installer}
|
12
|
+
spec.summary = %q{Copy the source files to a build host, build the packages and install builded packages}
|
13
|
+
spec.homepage = 'http://github.com/dboca/devinstall'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = %w(lib)
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'getopt'
|
24
|
+
end
|
data/doc/example.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
base:
|
2
|
+
rsync: /usr/bin/rsync
|
3
|
+
ssh: /usr/bin/ssh
|
4
|
+
scp: /usr/bin/scp
|
5
|
+
sudo: /usr/bin/sshsudo
|
6
|
+
local:
|
7
|
+
# folder - source folder
|
8
|
+
# temp - temporary folder
|
9
|
+
folder: ~/work/project
|
10
|
+
temp: ~/tmp
|
11
|
+
build:
|
12
|
+
# host - build machine
|
13
|
+
# folder - rsync to?
|
14
|
+
# target - the folder where packages will be generated (defaults to folder)
|
15
|
+
# user - for ssh / rsync
|
16
|
+
user: dboca
|
17
|
+
host: vm.development.lan
|
18
|
+
folder: rs
|
19
|
+
target: rs
|
20
|
+
install:
|
21
|
+
# host - dev/prod deploy and install host
|
22
|
+
# user - for scp / ssh / rsync (defaults to base[user])
|
23
|
+
# environment - live/qa/dev/...
|
24
|
+
user: dboca
|
25
|
+
environments:
|
26
|
+
dev:
|
27
|
+
host: dev01.server.lan
|
28
|
+
type: deb
|
29
|
+
folder: ~ ## folder for scp
|
30
|
+
user: dboca1
|
31
|
+
prod:
|
32
|
+
host: prod01.server.lan
|
33
|
+
type: rpm
|
34
|
+
# user defaults to install[:user]
|
35
|
+
repos:
|
36
|
+
# for repository deployment
|
37
|
+
environments:
|
38
|
+
dev:
|
39
|
+
type: deb
|
40
|
+
user: upload
|
41
|
+
host: debian-repo01.server.lan
|
42
|
+
folder: /srv/repo
|
43
|
+
dev-rh:
|
44
|
+
type: rpm
|
45
|
+
packages:
|
46
|
+
ui-lbgenerate:
|
47
|
+
# might contain all the sections above (local, build, install, repodeploy)
|
48
|
+
# type and build_command are mandatory
|
49
|
+
# in build_command the folowing expansions are made:
|
50
|
+
# %f build[folder]
|
51
|
+
# %t build[target]
|
52
|
+
# %p package (current package)
|
53
|
+
# %T type (deb, rpm, tar.gz ,...)
|
54
|
+
deb:
|
55
|
+
build_command: "cd %f && dpkg-buildpackage"
|
56
|
+
ui-lbcli:
|
57
|
+
deb:
|
58
|
+
build_command: "cd %f && dpkg-buildpackage"
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Symbolizes all of hash's keys and subkeys.
|
2
|
+
# Also allows for custom pre-processing of keys (e.g. downcasing, etc)
|
3
|
+
# if the block is given:
|
4
|
+
#
|
5
|
+
# somehash.deep_symbolize { |key| key.downcase }
|
6
|
+
#
|
7
|
+
# Usage: either include it into global Hash class to make it available to
|
8
|
+
# to all hashes, or extend only your own hash objects with this
|
9
|
+
# module.
|
10
|
+
# E.g.:
|
11
|
+
# 1) class Hash; include DeepSymbolizable; end
|
12
|
+
# 2) myhash.extend DeepSymbolizable
|
13
|
+
|
14
|
+
module DeepSymbolizable
|
15
|
+
|
16
|
+
class Hash
|
17
|
+
include DeepSymbolizable
|
18
|
+
end
|
19
|
+
|
20
|
+
def deep_symbolize(&block)
|
21
|
+
method = self.class.to_s.downcase.to_sym
|
22
|
+
syms = DeepSymbolizable::Symbolizers
|
23
|
+
syms.respond_to?(method) ? syms.send(method, self, &block) : self
|
24
|
+
end
|
25
|
+
|
26
|
+
module Symbolizers
|
27
|
+
extend self
|
28
|
+
|
29
|
+
# the primary method - symbolizes keys of the given hash,
|
30
|
+
# preprocessing them with a block if one was given, and recursively
|
31
|
+
# going into all nested enumerables
|
32
|
+
def hash(hash, &block)
|
33
|
+
hash.inject({}) do |result, (key, value)|
|
34
|
+
# Recursively deep-symbolize subhashes
|
35
|
+
value = _recurse_(value, &block)
|
36
|
+
|
37
|
+
# Pre-process the key with a block if it was given
|
38
|
+
key = yield key if block_given?
|
39
|
+
# Symbolize the key string if it responds to to_sym
|
40
|
+
sym_key = key.to_sym rescue key
|
41
|
+
|
42
|
+
# write it back into the result and return the updated hash
|
43
|
+
result[sym_key] = value
|
44
|
+
result
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# walking over arrays and symbolizing all nested elements
|
49
|
+
def array(ary, &block)
|
50
|
+
ary.map { |v| _recurse_(v, &block) }
|
51
|
+
end
|
52
|
+
|
53
|
+
# handling recursion - any Enumerable elements (except String)
|
54
|
+
# is being extended with the module, and then symbolized
|
55
|
+
def _recurse_(value, &block)
|
56
|
+
if value.is_a?(Enumerable) && !value.is_a?(String)
|
57
|
+
# support for a use case without extended core Hash
|
58
|
+
value.extend DeepSymbolizable unless value.class.include?(DeepSymbolizable)
|
59
|
+
value = value.deep_symbolize(&block)
|
60
|
+
end
|
61
|
+
value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'devinstall/deep_symbolize'
|
3
|
+
|
4
|
+
module Settings
|
5
|
+
# again - it's a singleton, thus implemented as a self-extended module
|
6
|
+
extend self
|
7
|
+
|
8
|
+
@_settings = {}
|
9
|
+
attr_reader :_settings
|
10
|
+
|
11
|
+
def load!(filename, options = {})
|
12
|
+
newsets = YAML::load_file(filename).deep_symbolize
|
13
|
+
newsets = newsets[options[:env].to_sym] if options[:env] && newsets[options[:env].to_sym]
|
14
|
+
deep_merge!(@_settings, newsets)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Deep merging of hashes
|
18
|
+
# deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
|
19
|
+
def deep_merge!(target, data)
|
20
|
+
merger = proc { |_, v1, v2|
|
21
|
+
Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
|
22
|
+
target.merge! data, &merger
|
23
|
+
end
|
24
|
+
|
25
|
+
#def method_missing(name, *args, &block)
|
26
|
+
# @_settings[name.to_sym] ||
|
27
|
+
# fail(NoMethodError, "unknown configuration root #{name}", caller)
|
28
|
+
#end
|
29
|
+
|
30
|
+
def base
|
31
|
+
@_settings[:base]
|
32
|
+
end
|
33
|
+
|
34
|
+
def local
|
35
|
+
@_settings[:local]
|
36
|
+
end
|
37
|
+
|
38
|
+
def build
|
39
|
+
@_settings[:build]
|
40
|
+
end
|
41
|
+
|
42
|
+
def install
|
43
|
+
@_settings[:install]
|
44
|
+
end
|
45
|
+
|
46
|
+
def repos
|
47
|
+
@_settings[:repos]
|
48
|
+
end
|
49
|
+
|
50
|
+
def packages
|
51
|
+
@_settings[:packages]
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
data/lib/devinstall.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'devinstall/version'
|
2
|
+
require 'devinstall/settings' ## in near future we will have to abandon Settings
|
3
|
+
# for something more complex because we will need to
|
4
|
+
# define things (repos/install-hosts) for different
|
5
|
+
# environments (dev/qa/prelive/live/prod/backup and so)
|
6
|
+
|
7
|
+
module Devinstall
|
8
|
+
class Pkg
|
9
|
+
|
10
|
+
def get_version(type)
|
11
|
+
if type == :deb # curently implemented only for .deb packages
|
12
|
+
deb_changelog ="#{Settings.local[:folder]}/#{package}/debian/changelog"
|
13
|
+
deb_package_version =File.open(deb_changelog, 'r').gets.chomp.sub(/^.*\((.*)\).*$/, "\1")
|
14
|
+
@_package_version[:deb]=deb_package_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def new (package)
|
19
|
+
# curently implemented only for .deb packages (for .rpm later :D)
|
20
|
+
@package =package.to_sym
|
21
|
+
@_package_version =Hash.new # versions for types:
|
22
|
+
@package_files =Hash.new
|
23
|
+
pname ="#{package}_#{get_version :deb}"
|
24
|
+
@package_files[:deb] ={deb: "#{pname}_all.deb",
|
25
|
+
tgz: "#{pname}.tar.gz",
|
26
|
+
dsc: "#{pname}.dsc",
|
27
|
+
chg: "#{pname}_debian.changes"}
|
28
|
+
end
|
29
|
+
|
30
|
+
def upload! (environment)
|
31
|
+
scp =Settings.base[:scp]
|
32
|
+
repo =Hash.new
|
33
|
+
type =Settings.repos[environment][:type]
|
34
|
+
[:user, :host, :folder].each do |k|
|
35
|
+
fail("Unexistent key repos:#{environment}:#{k}") unless Settings.repos[environment].has_key?(k)
|
36
|
+
repo[k]=Settings.repos[environment][k]
|
37
|
+
end
|
38
|
+
build(type)
|
39
|
+
@package_files[type].each do |p|
|
40
|
+
system("#{scp} #{Settings.local[:temp]}/#{p} #{repo[:user]}@#{repo[:host]}:#{repo[:folder]}")
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def build! (type)
|
46
|
+
unless Settings.packages[@package].has_key?(type)
|
47
|
+
puts("Package '#{@package}' cannot be built for the required environment")
|
48
|
+
puts("undefined build configuration for '#{type.to_s}'")
|
49
|
+
exit!(1)
|
50
|
+
end
|
51
|
+
build =Hash.new
|
52
|
+
[:user, :host, :folder, :target].each do |k|
|
53
|
+
unless Settings.build.has_key?(k)
|
54
|
+
puts("Undefined key 'build:#{k.to_s}:'")
|
55
|
+
exit!(1)
|
56
|
+
end
|
57
|
+
build[k]=Settings.build[k]
|
58
|
+
end
|
59
|
+
ssh =Settings.base[:ssh]
|
60
|
+
build_command=Settings.packages[@package][type][:build_command]
|
61
|
+
rsync =Settings.base[:rsync]
|
62
|
+
local_folder =Settings.local[:folder]
|
63
|
+
local_temp =Settings.local[:temp]
|
64
|
+
system("#{rsync} -az #{local_folder}/ #{build[:user]}@#{build[:host]}:#{build[:folder]}")
|
65
|
+
system("#{ssh} #{build[:user]}@#{build[:host]} -c \"#{build_command}\"")
|
66
|
+
@package_files[type].each do |p|
|
67
|
+
system("#{rsync} -az #{build[:user]}@#{build[:host]}/#{build[:target]}/#{p} #{local_temp}")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def install! (environment)
|
72
|
+
sudo =Settings.base[:sudo]
|
73
|
+
scp =Settings.base[:scp]
|
74
|
+
type =Settings.install[environment][:type]
|
75
|
+
local_temp =Settings.local[:temp]
|
76
|
+
build!(type)
|
77
|
+
install=Hash.new
|
78
|
+
[:user, :host, :folder].each do |k|
|
79
|
+
unless Settings.install[environment].has_key?(k)
|
80
|
+
puts "Undefined key 'install:#{environment.to_s}:#{k.to_s}'"
|
81
|
+
exit!(1)
|
82
|
+
end
|
83
|
+
install[k]=Settings[environment][k]
|
84
|
+
end
|
85
|
+
case type.to_sym
|
86
|
+
when :deb
|
87
|
+
system("#{scp} #{local_temp}/#{@package_files[type][:deb]} #{install[:user]}@#{install[:host]}/#{install[:folder]}")
|
88
|
+
system("#{sudo} #{build![:user]}@#{build[:host]} \"dpkg -i #{install[:folder]}/#{@package_files[type][:deb]}")
|
89
|
+
else
|
90
|
+
puts "unknown package type '#{type.to_s}'"
|
91
|
+
exit!(1)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: devinstall
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dragos Boca
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
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: rake
|
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
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: getopt
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
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
|
+
description: remote builder and installer
|
63
|
+
email:
|
64
|
+
- dboca@mail.com
|
65
|
+
executables:
|
66
|
+
- pkg-tool
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .idea/codeStyleSettings.xml
|
72
|
+
- .idea/devinstall.iml
|
73
|
+
- .idea/dictionaries/dragos.xml
|
74
|
+
- .idea/encodings.xml
|
75
|
+
- .idea/inspectionProfiles/Project_Default.xml
|
76
|
+
- .idea/inspectionProfiles/profiles_settings.xml
|
77
|
+
- .idea/misc.xml
|
78
|
+
- .idea/modules.xml
|
79
|
+
- .idea/scopes/scope_settings.xml
|
80
|
+
- .idea/vcs.xml
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/pkg-tool
|
87
|
+
- devinstall.gemspec
|
88
|
+
- doc/example.yml
|
89
|
+
- lib/devinstall.rb
|
90
|
+
- lib/devinstall/deep_symbolize.rb
|
91
|
+
- lib/devinstall/settings.rb
|
92
|
+
- lib/devinstall/version.rb
|
93
|
+
homepage: http://github.com/dboca/devinstall
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.8.25
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: Copy the source files to a build host, build the packages and install builded
|
118
|
+
packages
|
119
|
+
test_files: []
|