devinstall 0.0.3 → 0.0.4

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/.idea/devinstall.iml CHANGED
@@ -15,7 +15,7 @@
15
15
  </content>
16
16
  <orderEntry type="inheritedJdk" />
17
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" />
18
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.4, ruby-1.9.3-p374) [gem]" level="application" />
19
19
  <orderEntry type="library" scope="PROVIDED" name="getopt (v1.4.1, ruby-1.9.3-p374) [gem]" level="application" />
20
20
  <orderEntry type="library" scope="PROVIDED" name="rake (v10.0.3, ruby-1.9.3-p374) [gem]" level="application" />
21
21
  </component>
data/bin/pkg-tool CHANGED
@@ -4,7 +4,9 @@ require 'getopt/long'
4
4
  require 'devinstall'
5
5
  require 'devinstall/settings'
6
6
 
7
+ begin
7
8
  opt =Getopt::Long.getopts(
9
+ ['--version', '-v',],
8
10
  ['--package', '-p', Getopt::REQUIRED],
9
11
  ['--config', '-c', Getopt::REQUIRED],
10
12
  ['--type', '-t', Getopt::REQUIRED],
@@ -14,12 +16,25 @@ opt =Getopt::Long.getopts(
14
16
  ['--install', '-i', ],
15
17
  ['--help', '-h', ],
16
18
  )
19
+ rescue
20
+ puts "Invalid option in command line"
21
+ puts 'Usage: pkg-install --config|-c <file> --package|-p <package> --type|-t <package_type> --env|-e <environment> --build|--upload|--install'
22
+ exit!(1)
23
+ end
17
24
 
25
+ if opt['version']
26
+ puts "devinstall version #{Devinstall::VERSION}"
27
+ puts "pkg-tool version #{Devinstall::VERSION}"
28
+ exit(0)
29
+ end
18
30
  if opt['help']
19
- p('Usage: pkg-install --package|-p <package> --config|-c <config file> --build|--upload|--install')
31
+ puts 'Usage: pkg-install --config|-c <file> --package|-p <package> --type|-t <package_type> --env|-e <environment> --build|--upload|--install'
32
+ exit!(0)
33
+ end
34
+ if !( opt['package'] && opt['config'] && opt['type'] && opt['env'] && (opt['build'] || opt['upload'] || opt['install']))
35
+ puts 'You must speciffy --config file, --package, --type and --env and one of the actions (--build, --install, --upload)'
20
36
  exit!(0)
21
37
  end
22
-
23
38
  Settings.load!(opt['config'])
24
39
  package=Pkg.new(opt['package'])
25
40
 
@@ -2,20 +2,20 @@ require 'yaml'
2
2
  require 'devinstall/deep_symbolize'
3
3
 
4
4
  module Settings
5
- # again - it's a singleton, thus implemented as a self-extended module
6
5
  extend self
7
6
 
8
7
  @_settings = {}
9
8
  attr_reader :_settings
10
9
 
11
10
  def load!(filename, options = {})
11
+ unless File.exist?(filename)
12
+ puts "Unable to find config file \"#{filename}\""
13
+ exit!(1)
14
+ end
12
15
  newsets = YAML::load_file(filename).deep_symbolize
13
16
  newsets = newsets[options[:env].to_sym] if options[:env] && newsets[options[:env].to_sym]
14
17
  deep_merge!(@_settings, newsets)
15
18
  end
16
-
17
- # Deep merging of hashes
18
- # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
19
19
  def deep_merge!(target, data)
20
20
  merger = proc { |_, v1, v2|
21
21
  Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
@@ -1,3 +1,3 @@
1
1
  module Devinstall
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/devinstall.rb CHANGED
@@ -42,6 +42,7 @@ module Devinstall
42
42
 
43
43
  end
44
44
 
45
+ # @param [Symbol] type
45
46
  def build! (type)
46
47
  unless Settings.packages[@package].has_key?(type)
47
48
  puts("Package '#{@package}' cannot be built for the required environment")
@@ -61,6 +62,11 @@ module Devinstall
61
62
  rsync =Settings.base[:rsync]
62
63
  local_folder =Settings.local[:folder]
63
64
  local_temp =Settings.local[:temp]
65
+ build_command.sub('%f', Settings.build[:folder]).
66
+ sub('%t', Settings.build[:target]).
67
+ sub('%p', @package.to_s).
68
+ sub('%T', type.to_s)
69
+
64
70
  system("#{rsync} -az #{local_folder}/ #{build[:user]}@#{build[:host]}:#{build[:folder]}")
65
71
  system("#{ssh} #{build[:user]}@#{build[:host]} -c \"#{build_command}\"")
66
72
  @package_files[type].each do |p|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devinstall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-23 00:00:00.000000000 Z
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler