packmule 0.1.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/bin/packmule +7 -0
- data/lib/packmule/cli.rb +77 -0
- data/lib/packmule/version.rb +8 -0
- data/lib/packmule.rb +8 -0
- data/packmule.gemspec +15 -0
- metadata +61 -0
data/bin/packmule
ADDED
data/lib/packmule/cli.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#
|
2
|
+
# PackMule
|
3
|
+
# Copyright (c) 2012 Nirix
|
4
|
+
# All Rights Reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'shebang'
|
8
|
+
|
9
|
+
module PackMule
|
10
|
+
module CLI
|
11
|
+
module Commands
|
12
|
+
class Default < ::Shebang::Command
|
13
|
+
command :default
|
14
|
+
banner 'PackMule makes packaging project archives easy.'
|
15
|
+
usage 'packmule [command] [options]'
|
16
|
+
|
17
|
+
o :v, :version, 'Shows PackMules version', :method => :_version
|
18
|
+
o :p, :pack, 'Packs the project, example: packmule pack --ver 1.2.3-beta', :method => :pack
|
19
|
+
o :nil, :ver, 'Package archive version', :type => String, :default => ''
|
20
|
+
|
21
|
+
def index
|
22
|
+
help
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Displays the gem version.
|
27
|
+
def _version
|
28
|
+
puts PackMule::VERSION
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Packs the project according to the PackMule file.
|
34
|
+
def pack
|
35
|
+
require 'yaml'
|
36
|
+
|
37
|
+
# Read the PackMule file and exit if it doesn't exist
|
38
|
+
puts "Reading PackMule file..."
|
39
|
+
begin
|
40
|
+
config = YAML::load_file('./PackMule')
|
41
|
+
rescue
|
42
|
+
puts "No PackMule file found, stopping"
|
43
|
+
exit;
|
44
|
+
end
|
45
|
+
|
46
|
+
# Create the archive name
|
47
|
+
archive_name = config['package-as'] + (option(:ver) != '' ? '-' + option(:ver) : '')
|
48
|
+
|
49
|
+
# Check the format, currently only .zip
|
50
|
+
if config['format'] == 'zip'
|
51
|
+
# Make sure the archive doesn't exist..
|
52
|
+
if FileTest.exists? "./#{archive_name}.zip"
|
53
|
+
puts "#{archive_name}.zip already exists, stopping"
|
54
|
+
exit
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get the needed Zip stuff
|
58
|
+
puts "Creating zip archive"
|
59
|
+
gem 'rubyzip'
|
60
|
+
require 'zip/zip'
|
61
|
+
require 'zip/zipfilesystem'
|
62
|
+
|
63
|
+
# Create the archive
|
64
|
+
Zip::ZipFile.open("./#{archive_name}.zip", 'w') do |z|
|
65
|
+
Dir["./**/**"].each do |file|
|
66
|
+
z.add(file.sub("./", ''), file) if not config['ignore'].include?(file.sub('./', ''))
|
67
|
+
end # Dir
|
68
|
+
end # Zip
|
69
|
+
end # format == zip
|
70
|
+
|
71
|
+
puts "Done, #{archive_name} created"
|
72
|
+
exit
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/packmule.rb
ADDED
data/packmule.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../lib/packmule/version', __FILE__)
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = 'packmule'
|
4
|
+
s.version = PackMule::VERSION
|
5
|
+
s.summary = "A project packager."
|
6
|
+
s.description = "PackMule makes packaging projects into archives easier than ever."
|
7
|
+
s.author = ["Jack Polgar"]
|
8
|
+
s.email = 'nrx@nirix.net'
|
9
|
+
s.files = `git ls-files`.split("\n").sort
|
10
|
+
s.executables = ['packmule']
|
11
|
+
s.homepage = 'http://github.com/nirix/packmule'
|
12
|
+
|
13
|
+
s.required_ruby_version = '>= 1.9.2'
|
14
|
+
s.add_dependency 'shebang'
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: packmule
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jack Polgar
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: shebang
|
16
|
+
requirement: &22738032 !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: *22738032
|
25
|
+
description: PackMule makes packaging projects into archives easier than ever.
|
26
|
+
email: nrx@nirix.net
|
27
|
+
executables:
|
28
|
+
- packmule
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- bin/packmule
|
33
|
+
- lib/packmule.rb
|
34
|
+
- lib/packmule/cli.rb
|
35
|
+
- lib/packmule/version.rb
|
36
|
+
- packmule.gemspec
|
37
|
+
homepage: http://github.com/nirix/packmule
|
38
|
+
licenses: []
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.9.2
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.7
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: A project packager.
|
61
|
+
test_files: []
|