Class: AndParcel::LintCommand

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

Instance Method Summary collapse

Methods inherited from Command

inherited

Instance Method Details

#runObject



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'bin/parcel', line 138

def run
	opts=Trollop::options do
		banner "parcel lint"
		opt :project, "path to Android project (defaults to parcel.json directory)", :short=>'p'
		opt :repair, "tells parcel to repair problems", :short=>'r', :default=>false
		opt :quiet, "whether it should print output on success", :short=>'q', :default=>false
		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

	Trollop::die "parcel not provided" if ARGV.size==0
	
	pkg_info=ARGV.shift

	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
	
	AndParcel::Parcel.lint(pkg_info, opts)
end