packmule 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -13,17 +13,24 @@ Now create a file called `Packfile` in your projects directory and place the fol
13
13
  package-as: MyProject
14
14
  formats:
15
15
  - zip
16
+ - tar.gz
16
17
  ignore:
18
+ - .DS_Store
17
19
  - badfile.bad
18
20
  - logs/
19
21
  - assets/*.psd
20
22
 
21
23
  Now all you need to do is run `packmule pack --version 1.0` inside the directory and your
22
- your project is packaged.
24
+ your project is packaged into `MyProject-1.0.zip` and `MyProject-1.0.tar.gz`.
23
25
 
24
26
  The Packfile
25
27
  ------------
26
28
 
27
- The `Packfile` a YAML file and contains the config options for Packmule when packaging the directory.
29
+ The `Packfile` is a YAML file and contains the config options for Packmule when packaging the directory.
28
30
 
29
- Currently only Zip archives are supported.
31
+ Packmule supports the following archive formats:
32
+
33
+ - zip
34
+ - tar
35
+ - tar.gz
36
+ - tar.bz2
@@ -17,7 +17,17 @@ module Packmule
17
17
 
18
18
  options[:formats].each do |format|
19
19
  if format == 'zip'
20
+ # Zipit, zipit good
20
21
  Packmule::Archiver::Zip.create(options)
22
+ elsif format == 'tar'
23
+ # TARzan
24
+ Packmule::Archiver::Tar.create(options)
25
+ elsif format == 'tar.gz'
26
+ # Targz, klingon pets
27
+ Packmule::Archiver::Tar.create(options.merge({:gzip => true}))
28
+ elsif format == 'tar.bz2'
29
+ # Tarbz2, I got nothing...
30
+ Packmule::Archiver::Tar.create(options.merge({:bzip => true}))
21
31
  end
22
32
  end
23
33
 
@@ -32,8 +42,8 @@ module Packmule
32
42
  def self.create(options)
33
43
  # Make sure the archive doesn't exist..
34
44
  if ::FileTest.exists? "./#{options[:filename]}.zip"
35
- puts "#{options[:filename]}.zip already exists, stopping"
36
- exit
45
+ puts "#{options[:filename]}.zip already exists, skipping"
46
+ return false
37
47
  end
38
48
 
39
49
  # Get the needed Zip stuff
@@ -48,8 +58,43 @@ module Packmule
48
58
  end # Dir
49
59
  end # Zip block
50
60
 
51
- puts " - #{options[:filename]}.zip created"
52
- end # Archive
61
+ puts " - #{options[:filename]}.zip created"
62
+ return true
63
+ end # self.create
53
64
  end # Zip class
65
+
66
+ ##
67
+ # Tar
68
+ class Tar
69
+ ##
70
+ # Creates the tar file, like a BOSS!
71
+ def self.create(options)
72
+ options = {:gzip => false, :bzip => false}.merge(options)
73
+ filename = "#{options[:filename]}.tar" + (options[:gzip] ? '.gz' : (options[:bzip] ? '.bz2' : ''))
74
+
75
+ # Make sure it doesn't exist..
76
+ if ::FileTest.exists? "./#{filename}"
77
+ puts "#{filename} already exists, skipping"
78
+ return false
79
+ end
80
+
81
+ if options[:gzip] == true
82
+ # Tar and gzip like a boss
83
+ `tar czf #{filename} -C #{options[:dir]} ./`
84
+ elsif options[:bzip] == true
85
+ # Bzippit
86
+ `tar cfj #{filename} -C #{options[:dir]} ./`
87
+ else
88
+ # Totally boss taring code, yo
89
+ `tar cf #{filename} -C #{options[:dir]} ./`
90
+ end
91
+
92
+ if ::FileTest.exists? "./#{filename}"
93
+ puts " - #{filename} created"
94
+ end
95
+
96
+ return true
97
+ end # self.create
98
+ end # Tar
54
99
  end # Archiver
55
100
  end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Packmule
11
- VERSION = "0.2.0"
11
+ VERSION = "0.3.0"
12
12
  end
data/lib/packmule.rb CHANGED
@@ -43,7 +43,7 @@ module Packmule
43
43
 
44
44
  # Remove ignored files and directories
45
45
  opt[:ignore].each do |badness|
46
- ::FileUtils.rm_r Dir["#{tempdir}/#{badness}"], :secure => true
46
+ ::FileUtils.rm_rf Dir["#{tempdir}/#{badness}"], :secure => true
47
47
  end
48
48
 
49
49
  # Archive the directory
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.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-20 00:00:00.000000000 Z
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shebang
16
- requirement: &70362586961040 !ruby/object:Gem::Requirement
16
+ requirement: &70195365902560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70362586961040
24
+ version_requirements: *70195365902560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rubyzip
27
- requirement: &70362584034660 !ruby/object:Gem::Requirement
27
+ requirement: &70195365902140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70362584034660
35
+ version_requirements: *70195365902140
36
36
  description: Packmule makes packaging projects into archives easier than ever.
37
37
  email:
38
38
  - nrx@nirix.net