Class: AndParcel::PackageCommand

Inherits:
Command
  • Object
show all
Defined in:
bin/parcel

Instance Method Summary collapse

Methods inherited from Command

inherited

Instance Method Details

#runObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'bin/parcel', line 44

def run
  opts=Trollop::options do
    banner "parcel package"
    opt :project, "path to Android project (defaults to parcel JSON directory)", :short=>'p'
    opt :dir, "directory for parcel output, relative to --project", :default=>'bin'
    opt :jars, "paths to JARs to bundle (primary and libs)", :type=>:strings, :short=>'j', :required=>true
    opt :docs, "files/directories of docs to package", :type=>:strings, :short=>'d'
    opt :manifest, "manifest containing components to package (defaults to AndroidManifest.xml in project)", :type=>:string, :short=>'m'
#       opt :dependencies, "names of parcels this parcel depends on", :type=>:strings
    opt :res, "files/directories of resources to package (defaults to res/ in project)", :type=>:strings, :short=>'r'
    opt :assets, "files/directories of assets to package (defaults to assets/ in project)", :type=>:strings, :short=>'a'
  end
  
  pkg_info=ARGV.shift || "package.json"
  
  Trollop::die "cannot find #{pkg_info}" if !File.exists?(pkg_info)
  
  if !opts[:project]
    opts[:project]=File.dirname(pkg_info)
    pkg_info=File.basename(pkg_info)
  end
  
  if !opts[:res]
    opts[:res]=['res']
  end
  
  if !opts[:assets]
    opts[:assets]=['assets']
  end
  
  if !opts[:manifest]
    opts[:manifest]='AndroidManifest.xml'
  end
  
  AndParcel::Parcel.package(pkg_info, opts)
end