packmule 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/packmule/archiver.rb +12 -11
- data/lib/packmule/cli.rb +6 -5
- data/lib/packmule/version.rb +4 -3
- data/lib/packmule.rb +6 -5
- metadata +2 -2
data/lib/packmule/archiver.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Packmule
|
3
3
|
# Copyright (c) 2012 Nirix
|
4
4
|
# All Rights Reserved
|
5
|
+
# https://github.com/nirix
|
5
6
|
#
|
6
|
-
#
|
7
|
+
# Packmule is released under
|
7
8
|
# the GNU GPL v3 only license.
|
8
9
|
#
|
9
10
|
|
@@ -14,7 +15,7 @@ module Packmule
|
|
14
15
|
# with the passed options.
|
15
16
|
def self.create(options)
|
16
17
|
puts "Creating archives..."
|
17
|
-
|
18
|
+
|
18
19
|
options[:formats].each do |format|
|
19
20
|
if format == 'zip'
|
20
21
|
# Zipit, zipit good
|
@@ -30,10 +31,10 @@ module Packmule
|
|
30
31
|
Packmule::Archiver::Tar.create(options.merge({:bzip => true}))
|
31
32
|
end
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
puts "Done creating archives"
|
35
36
|
end
|
36
|
-
|
37
|
+
|
37
38
|
##
|
38
39
|
# Zipper
|
39
40
|
class Zip
|
@@ -57,12 +58,12 @@ module Packmule
|
|
57
58
|
z.add(file.sub("#{options[:dir]}/", ''), file) if not options[:ignore].include?(file.sub("#{options[:dir]}/", ''))
|
58
59
|
end # Dir
|
59
60
|
end # Zip block
|
60
|
-
|
61
|
+
|
61
62
|
puts " - #{options[:filename]}.zip created"
|
62
63
|
return true
|
63
64
|
end # self.create
|
64
65
|
end # Zip class
|
65
|
-
|
66
|
+
|
66
67
|
##
|
67
68
|
# Tar
|
68
69
|
class Tar
|
@@ -71,13 +72,13 @@ module Packmule
|
|
71
72
|
def self.create(options)
|
72
73
|
options = {:gzip => false, :bzip => false}.merge(options)
|
73
74
|
filename = "#{options[:filename]}.tar" + (options[:gzip] ? '.gz' : (options[:bzip] ? '.bz2' : ''))
|
74
|
-
|
75
|
+
|
75
76
|
# Make sure it doesn't exist..
|
76
77
|
if ::FileTest.exists? "./#{filename}"
|
77
78
|
puts "#{filename} already exists, skipping"
|
78
79
|
return false
|
79
80
|
end
|
80
|
-
|
81
|
+
|
81
82
|
if options[:gzip] == true
|
82
83
|
# Tar and gzip like a boss
|
83
84
|
`tar czf #{filename} -C #{options[:dir]} ./`
|
@@ -88,11 +89,11 @@ module Packmule
|
|
88
89
|
# Totally boss taring code, yo
|
89
90
|
`tar cf #{filename} -C #{options[:dir]} ./`
|
90
91
|
end
|
91
|
-
|
92
|
+
|
92
93
|
if ::FileTest.exists? "./#{filename}"
|
93
94
|
puts " - #{filename} created"
|
94
95
|
end
|
95
|
-
|
96
|
+
|
96
97
|
return true
|
97
98
|
end # self.create
|
98
99
|
end # Tar
|
data/lib/packmule/cli.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Packmule
|
3
3
|
# Copyright (c) 2012 Nirix
|
4
4
|
# All Rights Reserved
|
5
|
+
# https://github.com/nirix
|
5
6
|
#
|
6
|
-
#
|
7
|
+
# Packmule is released under
|
7
8
|
# the GNU GPL v3 only license.
|
8
9
|
#
|
9
10
|
|
@@ -36,16 +37,16 @@ module Packmule
|
|
36
37
|
exit
|
37
38
|
end
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
##
|
41
42
|
# Pack command
|
42
43
|
class Pack < ::Shebang::Command
|
43
44
|
command :pack
|
44
45
|
banner 'Reads the Packfile and packages the directory.'
|
45
46
|
usage 'packmule pack -v 1.2.3-beta2'
|
46
|
-
|
47
|
+
|
47
48
|
o :v, :version, 'Version of the archive', :type => :string, :default => ''
|
48
|
-
|
49
|
+
|
49
50
|
def index
|
50
51
|
Packmule.pack :version => option(:version)
|
51
52
|
end
|
data/lib/packmule/version.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Packmule
|
3
3
|
# Copyright (c) 2012 Nirix
|
4
4
|
# All Rights Reserved
|
5
|
+
# https://github.com/nirix
|
5
6
|
#
|
6
|
-
#
|
7
|
+
# Packmule is released under
|
7
8
|
# the GNU GPL v3 only license.
|
8
9
|
#
|
9
10
|
|
10
11
|
module Packmule
|
11
|
-
VERSION = "0.4.
|
12
|
+
VERSION = "0.4.1"
|
12
13
|
end
|
data/lib/packmule.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Packmule
|
3
3
|
# Copyright (c) 2012 Nirix
|
4
4
|
# All Rights Reserved
|
5
|
+
# https://github.com/nirix
|
5
6
|
#
|
6
|
-
#
|
7
|
+
# Packmule is released under
|
7
8
|
# the GNU GPL v3 only license.
|
8
9
|
#
|
9
10
|
|
@@ -39,6 +40,9 @@ module Packmule
|
|
39
40
|
:commands => config['commands']
|
40
41
|
}
|
41
42
|
|
43
|
+
# Clone directory
|
44
|
+
::FileUtils.cp_r './', tempdir
|
45
|
+
|
42
46
|
# Any commands?
|
43
47
|
if opt[:commands]
|
44
48
|
opt[:commands].each do |c|
|
@@ -47,9 +51,6 @@ module Packmule
|
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
|
-
# Clone directory
|
51
|
-
::FileUtils.cp_r './', tempdir
|
52
|
-
|
53
54
|
# Remove ignored files and directories
|
54
55
|
opt[:ignore].each do |badness|
|
55
56
|
::FileUtils.rm_rf Dir["#{tempdir}/#{badness}"], :secure => true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packmule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
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: 2012-
|
12
|
+
date: 2012-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shebang
|