-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.thor
38 lines (30 loc) · 990 Bytes
/
package.thor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.dirname(__FILE__) + '/lib/hashToCS.rb'
require 'fileutils'
class Package < Thor::Group
include Thor::Actions
# thor package <app>
argument :app, :type => :string, :description => "specifies which application to build"
desc "builds app source ready for release, and package it into the app directory"
attr_accessor :package_dir, :output_dir, :input_dir
def setup
@input_dir = File.dirname(__FILE__) + '/build/.'
@package_dir = File.dirname(__FILE__) + '/package/'
@output_dir = @package_dir + app
end
def build
puts 'building...'
thor :build, app
puts "middleman building #{app} ..."
`middleman build`
end
def copy_to_package_dir
puts "copying built app to ./#{app}/ ..."
Dir.mkdir(@package_dir) unless File.directory?(@package_dir)
FileUtils.rm_rf @output_dir if File.directory?(@output_dir)
Dir.mkdir(@output_dir)
FileUtils.cp_r(@input_dir, @output_dir)
end
def done
puts 'Done!'
end
end