-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevelopjs
More file actions
executable file
·154 lines (125 loc) · 5.11 KB
/
developjs
File metadata and controls
executable file
·154 lines (125 loc) · 5.11 KB
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
39
40
41
42
43
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env sh
# This file is part of developjs. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/KisanHub/developjs/master/COPYRIGHT. No part of developjs, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
# Copyright © 2015 The developers of developjs. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/KisanHub/developjs/master/COPYRIGHT.
_program()
{
core_usesIn developjs
developjs()
{
developjs_populateAllPackagesIfNoneSupplied
developjs_createOutputPath
developjs_processPackages
}
}
_program_name='developjs'
_program_version='unversioned'
_program_package_or_build=''
_program_path="$([ "${_program_fattening_program_path+set}" = 'set' ] && printf '%s\n' "$_program_fattening_program_path" || ([ "${0%/*}" = "${0}" ] && printf '%s\n' '.' || printf '%s\n' "${0%/*}"))"
_program_libPath="${_program_path}/lib"
_program_etcPath="${_program_path}/etc"
_program_varPath="${_program_path}/var"
_program_entrypoint='developjs'
_program_commandLine_parseInitialise()
{
developjs_packagePath_default="$(pwd)"/source
developjs_outputPath_default="$(pwd)"/output
}
_program_commandLine_helpMessage()
{
_program_commandLine_helpMessage_usage="[OPTION]... -- [PACKAGES]..."
_program_commandLine_helpMessage_description="Parses *.package.json files to create concatenated JavaScript"
_program_commandLine_helpMessage_options="
-p, --package-path PATH PATH to package folder.
Defaults to '$developjs_packagePath_default'.
-o, --output-path PATH PATH to folder of concatenated JavaScript.
Defaults to '$developjs_outputPath_default'.
-l, --copyright-file PATH PATH to copyright file.
Defaults to '--package-path ../COPYRIGHT', currently:-
'$developjs_packagePath_default/../COPYRIGHT'.
-f, --force Force overwriting of existing modules."
_program_commandLine_helpMessage_optionsSpacing=' '
_program_commandLine_helpMessage_configurationKeys="
developjs_packagePath Equivalent to --package-path
developjs_outputPath Equivalent to --output-path
developjs_copyrightFile Equivalent to --copyright-file
"
_program_commandLine_helpMessage_examples="
${_program_name} -- mongojs.package.json
"
}
_program_commandLine_optionExists()
{
case "$optionName" in
p|package-path)
echo 'yes-argumented'
;;
o|output-path)
echo 'yes-argumented'
;;
l|copyright-file)
echo 'yes-argumented'
;;
f|force)
echo 'yes-argumentless'
;;
*)
echo 'no'
;;
esac
}
_program_commandLine_processOptionWithoutArgument()
{
case "$optionName" in
f|force)
developjs_force='yes'
;;
esac
}
_program_commandLine_processOptionWithArgument()
{
case "$optionName" in
p|package-path)
core_validate_folderPathReadableAndSearchableAndWritable $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue"
developjs_packagePath="$optionValue"
;;
o|output-path)
core_validate_folderPathIsReadableAndSearchableAndWritableOrCanBeCreated $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue"
developjs_outputPath="$optionValue"
;;
l|copyright-file)
core_validate_filePathReadable $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue"
developjs_copyrightFile="$optionValue"
;;
esac
}
_program_commandLine_handleNonOptions()
{
core_variable_array_initialise developjs_packages
core_variable_array_append developjs_packages "$@"
}
_program_commandLine_validate()
{
if core_variable_isUnset developjs_packagePath; then
developjs_packagePath="$developjs_packagePath_default"
else
core_validate_folderPathReadableAndSearchableAndWritable $core_commandLine_exitCode_CONFIG 'configuration setting' 'developjs_packagePath' "$developjs_packagePath"
fi
if core_variable_isUnset developjs_outputPath; then
developjs_outputPath="$developjs_outputPath_default"
else
core_validate_folderPathIsReadableAndSearchableAndWritableOrCanBeCreated $core_commandLine_exitCode_CONFIG 'configuration setting' 'developjs_outputPath' "$developjs_outputPath"
fi
if core_variable_isUnset developjs_copyrightFile; then
developjs_copyrightFile="$developjs_packagePath"/../COPYRIGHT
core_validate_filePathReadable $core_commandLine_exitCode_CONFIG 'default' '--copyright-file' "$developjs_copyrightFile"
else
core_validate_filePathReadable $core_commandLine_exitCode_CONFIG 'configuration setting' 'developjs_outputPath' "$developjs_outputPath"
fi
if core_variable_isSet developjs_force; then
core_validate_isBoolean $core_commandLine_exitCode_CONFIG 'configuration setting' 'developjs_force' "$developjs_force"
else
developjs_force='no'
fi
}
# Assumes pwd, and so requires this code to be running from this folder
. "$_program_libPath"/shellfire/core/init.functions "$@"