nixenvironment 0.0.70 → 0.0.71
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/nixenvironment +39 -102
- data/lib/nixenvironment.rb +2 -0
- data/lib/nixenvironment/archiver.rb +43 -50
- data/lib/nixenvironment/build_env_vars_loader.rb +69 -6
- data/lib/nixenvironment/config.rb +9 -5
- data/lib/nixenvironment/deployer.rb +129 -0
- data/lib/nixenvironment/scm.rb +179 -0
- data/lib/nixenvironment/version.rb +1 -1
- data/lib/nixenvironment/xcodebuild.rb +6 -0
- data/nixenvironment.gemspec +2 -1
- metadata +20 -13
- data/legacy/CleanWorkingCopy.sh +0 -69
- data/legacy/DeployIPA.sh +0 -125
- data/legacy/DetectSCM.sh +0 -11
- data/legacy/LoadBuildEnvVars.sh +0 -123
- data/legacy/MakeTag.sh +0 -94
- data/legacy/SaveRevision.sh +0 -122
- data/legacy/VerifyBinarySigning.py +0 -80
- data/legacy/svn-clean.pl +0 -246
- data/legacy/svncopy.pl +0 -1134
data/legacy/SaveRevision.sh
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
#!/bin/sh -e
|
2
|
-
|
3
|
-
# Created by Yuri Govorushchenko on 6/24/11.
|
4
|
-
# Copyright 2011 nix. All rights reserved.
|
5
|
-
|
6
|
-
# Script which saves next vars into _last_revision.sh:
|
7
|
-
# SCM revision of working copy
|
8
|
-
# "monotonic" revision (good for build numbers) of working copy
|
9
|
-
# checks if working copy is not modified
|
10
|
-
|
11
|
-
currentScriptDir=$(cd "$(dirname "$0")"; pwd)
|
12
|
-
SCM_TYPE=$("${currentScriptDir}/DetectSCM.sh")
|
13
|
-
|
14
|
-
# Subversion
|
15
|
-
if [[ "${SCM_TYPE}" = "svn" ]]; then
|
16
|
-
echo "SVN working copy detected"
|
17
|
-
CURRENT_REVISION="$(svnversion)"
|
18
|
-
CURRENT_MONOTONIC_REVISION=${CURRENT_REVISION} # SVN revision is already an incrementing number
|
19
|
-
|
20
|
-
# simply check that the SVN version is a digit
|
21
|
-
if [[ ${CURRENT_REVISION} =~ ^[0-9]+$ ]]; then
|
22
|
-
WORKING_COPY_IS_CLEAN=1
|
23
|
-
else
|
24
|
-
echo "Working copy is not clean because of svnversion returning ${CURRENT_REVISION}"
|
25
|
-
WORKING_COPY_IS_CLEAN=0
|
26
|
-
fi
|
27
|
-
|
28
|
-
# git
|
29
|
-
elif [[ "${SCM_TYPE}" = "git" ]]; then
|
30
|
-
echo "GIT working copy detected"
|
31
|
-
CURRENT_REVISION="$(git rev-parse HEAD | xargs)"
|
32
|
-
LAST_REVISION_IN_REPO="$(git rev-list --all | head -n 1 | xargs)"
|
33
|
-
|
34
|
-
if [[ $CURRENT_REVISION == $LAST_REVISION_IN_REPO ]]; then
|
35
|
-
UNLESS_STARTS_FROM=1
|
36
|
-
else
|
37
|
-
UNLESS_STARTS_FROM=2
|
38
|
-
fi
|
39
|
-
|
40
|
-
CURRENT_MONOTONIC_REVISION=$(git rev-list --all | perl -ne "print unless $UNLESS_STARTS_FROM../$CURRENT_REVISION/" | wc -l | xargs) # number of pushes before current
|
41
|
-
|
42
|
-
if [[ $UNLESS_STARTS_FROM == 1 ]]; then
|
43
|
-
CURRENT_MONOTONIC_REVISION=$(($CURRENT_MONOTONIC_REVISION + 1))
|
44
|
-
fi
|
45
|
-
|
46
|
-
STATUS="$(git status --porcelain)"
|
47
|
-
|
48
|
-
if [[ "${STATUS}" = "" ]]; then
|
49
|
-
WORKING_COPY_IS_CLEAN=1
|
50
|
-
else
|
51
|
-
# ignore changes to build folder, because it's created by Xcode before the script runs as a build phase
|
52
|
-
LINES_COUNT=$(echo "$STATUS" | wc -l)
|
53
|
-
|
54
|
-
if [ ${LINES_COUNT} != 1 ]; then
|
55
|
-
printf "Working copy is not clean because of status:\n${STATUS}"
|
56
|
-
WORKING_COPY_IS_CLEAN=0
|
57
|
-
else
|
58
|
-
MODIFIED_PATH=$(echo "$STATUS" | colrm 1 3)
|
59
|
-
WC_ROOT=$(git rev-parse --show-toplevel)
|
60
|
-
ABS_MODIFIED_PATH="${WC_ROOT}/${MODIFIED_PATH}"
|
61
|
-
|
62
|
-
# compare path to Xcode env var
|
63
|
-
if [[ "${ABS_MODIFIED_PATH}" -ef "${BUILD_ROOT}" ]]; then
|
64
|
-
WORKING_COPY_IS_CLEAN=1
|
65
|
-
else
|
66
|
-
printf "Working copy is not clean because of status:\n${STATUS}"
|
67
|
-
WORKING_COPY_IS_CLEAN=0
|
68
|
-
fi
|
69
|
-
fi
|
70
|
-
fi
|
71
|
-
|
72
|
-
# mercurial
|
73
|
-
elif [[ "${SCM_TYPE}" = "mercurial" ]]; then
|
74
|
-
echo "Mercurial working copy detected"
|
75
|
-
CURRENT_REVISION="$(hg id -i)"
|
76
|
-
CURRENT_MONOTONIC_REVISION="$(hg log --template '{rev}:{node|short} {desc|firstline} ({author})\n' | wc -l | tr -d ' ')" # number of pushes in current branch
|
77
|
-
|
78
|
-
STATUS="$(hg status)"
|
79
|
-
|
80
|
-
if [[ "${STATUS}" = "" ]]; then
|
81
|
-
WORKING_COPY_IS_CLEAN=1
|
82
|
-
else
|
83
|
-
# ignore changes to build folder, because it's created by Xcode before the script runs as a build phase
|
84
|
-
LINES_COUNT=$(echo "$STATUS" | wc -l)
|
85
|
-
|
86
|
-
if [ ${LINES_COUNT} != 1 ]; then
|
87
|
-
printf "Working copy is not clean because of status:\n${STATUS}"
|
88
|
-
WORKING_COPY_IS_CLEAN=0
|
89
|
-
else
|
90
|
-
MODIFIED_PATH=$(echo "$STATUS" | colrm 1 3)
|
91
|
-
WC_ROOT=$(git rev-parse --show-toplevel)
|
92
|
-
ABS_MODIFIED_PATH="${WC_ROOT}/${MODIFIED_PATH}"
|
93
|
-
|
94
|
-
# compare path to Xcode env var
|
95
|
-
if [[ "${ABS_MODIFIED_PATH}" -ef "${BUILD_ROOT}" ]]; then
|
96
|
-
WORKING_COPY_IS_CLEAN=1
|
97
|
-
else
|
98
|
-
printf "Working copy is not clean because of status:\n${STATUS}"
|
99
|
-
WORKING_COPY_IS_CLEAN=0
|
100
|
-
fi
|
101
|
-
fi
|
102
|
-
fi
|
103
|
-
|
104
|
-
# undefined SCM
|
105
|
-
else
|
106
|
-
echo "warning: script must be run from working copy. Revision is undefined."
|
107
|
-
|
108
|
-
CURRENT_REVISION="undefined"
|
109
|
-
CURRENT_MONOTONIC_REVISION="undefined"
|
110
|
-
WORKING_COPY_IS_CLEAN=0
|
111
|
-
fi
|
112
|
-
|
113
|
-
OUTPUT="
|
114
|
-
REVISION=\"${CURRENT_REVISION}\"
|
115
|
-
MONOTONIC_REVISION=\"${CURRENT_MONOTONIC_REVISION}\"
|
116
|
-
WORKING_COPY_IS_CLEAN=\"${WORKING_COPY_IS_CLEAN}\"
|
117
|
-
"
|
118
|
-
|
119
|
-
echo "${OUTPUT}"
|
120
|
-
echo "#!/bin/sh
|
121
|
-
### AUTOGENERATED BY SaveRevision.sh; DO NOT EDIT ###
|
122
|
-
${OUTPUT}" > _last_revision.sh
|
@@ -1,80 +0,0 @@
|
|
1
|
-
#!/usr/bin/python
|
2
|
-
|
3
|
-
import os
|
4
|
-
import optparse
|
5
|
-
import sys
|
6
|
-
|
7
|
-
def main():
|
8
|
-
parser = optparse.OptionParser(description='Verifies that iOS binary has expected keychain-access-group. Using the same keychain-access-group insures\
|
9
|
-
that app will have access to its keychain after updates.',
|
10
|
-
prog='VerifyBinarySigning')
|
11
|
-
|
12
|
-
parser.add_option("-b", "--binary", dest="path_to_binary", help="Full path to app binary", metavar="BINARY")
|
13
|
-
parser.add_option("-s", "--keychain_access_group", dest="keychain_access_group", help="Expected keychain-access-group", metavar="KEYCHAIN-ACCESS-GROUP")
|
14
|
-
|
15
|
-
(options, args) = parser.parse_args()
|
16
|
-
|
17
|
-
if options.path_to_binary is None or options.keychain_access_group is None:
|
18
|
-
parser.error('All arguments must be specified. Use option -h to see the usage.')
|
19
|
-
|
20
|
-
logfile = open(options.path_to_binary, "r").readlines()
|
21
|
-
|
22
|
-
currentLineNumber = 0
|
23
|
-
|
24
|
-
"""
|
25
|
-
example from the binary:
|
26
|
-
|
27
|
-
.
|
28
|
-
.
|
29
|
-
.
|
30
|
-
<key>keychain-access-groups</key>
|
31
|
-
<array>
|
32
|
-
<string>KEYCHAIN-ACCESS-GROUP</string>
|
33
|
-
</array>
|
34
|
-
.
|
35
|
-
.
|
36
|
-
.
|
37
|
-
"""
|
38
|
-
|
39
|
-
for line in logfile:
|
40
|
-
if line.find('keychain-access-groups') != -1:
|
41
|
-
currentLineNumber += 1
|
42
|
-
|
43
|
-
if logfile[currentLineNumber].strip() != "<array>":
|
44
|
-
print_error("Something wrong happened, there is no <array> in the <key>keychain-access-groups</key>")
|
45
|
-
return 1
|
46
|
-
|
47
|
-
currentLineNumber += 1
|
48
|
-
|
49
|
-
while logfile[currentLineNumber].strip() != "</array>":
|
50
|
-
line_with_access_group = logfile[currentLineNumber].strip().replace("<string>","").replace("</string>","")
|
51
|
-
|
52
|
-
print line_with_access_group
|
53
|
-
|
54
|
-
if line_with_access_group == options.keychain_access_group:
|
55
|
-
print 'App is signed correctly'
|
56
|
-
return 0
|
57
|
-
|
58
|
-
currentLineNumber += 1
|
59
|
-
|
60
|
-
print_error("App is signed incorrectly, specified keychain access group '%s' was not found" % options.keychain_access_group)
|
61
|
-
return 1
|
62
|
-
|
63
|
-
currentLineNumber += 1
|
64
|
-
|
65
|
-
print_error('App must be signed')
|
66
|
-
return 1
|
67
|
-
|
68
|
-
def print_error(error_message):
|
69
|
-
""" Prints error message with predefined prefix.
|
70
|
-
|
71
|
-
Args:
|
72
|
-
error_message: Error message.
|
73
|
-
"""
|
74
|
-
|
75
|
-
XCODE_ERROR_PREFIX = 'error: ' # log messages with such prefix are highlighted in XCode as errors
|
76
|
-
|
77
|
-
print('%s%s' % (XCODE_ERROR_PREFIX, error_message))
|
78
|
-
|
79
|
-
if __name__ == '__main__':
|
80
|
-
sys.exit(main())
|
data/legacy/svn-clean.pl
DELETED
@@ -1,246 +0,0 @@
|
|
1
|
-
#!/usr/bin/perl
|
2
|
-
|
3
|
-
# svn-clean - Wipes out unversioned files from SVN working copy.
|
4
|
-
# Copyright (C) 2004, 2005, 2006 Simon Perreault
|
5
|
-
#
|
6
|
-
# This program is free software; you can redistribute it and/or
|
7
|
-
# modify it under the terms of the GNU General Public License
|
8
|
-
# as published by the Free Software Foundation; either version 2
|
9
|
-
# of the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This program is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with this program; if not, write to the Free Software
|
18
|
-
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
19
|
-
|
20
|
-
use strict;
|
21
|
-
use Cwd;
|
22
|
-
use File::Path;
|
23
|
-
use Getopt::Long;
|
24
|
-
use Pod::Usage;
|
25
|
-
|
26
|
-
# Try to use SVN module if available.
|
27
|
-
my $use_svn_module = eval { require SVN::Client };
|
28
|
-
|
29
|
-
my $CWD = getcwd;
|
30
|
-
|
31
|
-
my @exclude = ();
|
32
|
-
my $force = 0;
|
33
|
-
my $quiet = 0;
|
34
|
-
my $print = 0;
|
35
|
-
my $help = 0;
|
36
|
-
my $man = 0;
|
37
|
-
my $nonrecursive = 0;
|
38
|
-
my @paths = ($CWD);
|
39
|
-
GetOptions(
|
40
|
-
"exclude=s" => \@exclude,
|
41
|
-
"force" => \$force,
|
42
|
-
"non-recursive|N" => \$nonrecursive,
|
43
|
-
"quiet" => \$quiet,
|
44
|
-
"print" => \$print,
|
45
|
-
"help|?" => \$help,
|
46
|
-
"man" => \$man
|
47
|
-
) or pod2usage(2);
|
48
|
-
pod2usage(1) if $help;
|
49
|
-
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
|
50
|
-
@paths = map { Cwd::abs_path($_) } @ARGV if @ARGV;
|
51
|
-
|
52
|
-
# Precompile regexes.
|
53
|
-
$_ = qr/$_/ foreach @exclude;
|
54
|
-
|
55
|
-
if ($use_svn_module) {
|
56
|
-
|
57
|
-
# Create SVN client object. No need for connection to remote server.
|
58
|
-
my $ctx = new SVN::Client;
|
59
|
-
|
60
|
-
# Call handler function with status info for each file.
|
61
|
-
$ctx->status( $_, undef, \&clean, !$nonrecursive, 1, 0, 1 )
|
62
|
-
for @paths;
|
63
|
-
}
|
64
|
-
else {
|
65
|
-
warn "Warning: Not using SVN Perl modules, this might be slow.\n"
|
66
|
-
unless $quiet;
|
67
|
-
|
68
|
-
# Build svn client command
|
69
|
-
my @command = qw(svn status --no-ignore -v);
|
70
|
-
if ($nonrecursive) {
|
71
|
-
push @command, '-N';
|
72
|
-
}
|
73
|
-
|
74
|
-
# Main file-wiping loop.
|
75
|
-
if ( $^O eq 'MSWin32' ) {
|
76
|
-
|
77
|
-
# Perl on Windows currently doesn't have list pipe opens.
|
78
|
-
open SVN, join( ' ', @command, @paths ) . '|'
|
79
|
-
or die "Can't call program \"svn\": $!\n";
|
80
|
-
}
|
81
|
-
else {
|
82
|
-
open SVN, "-|", @command, @paths
|
83
|
-
or die "Can't call program \"svn\": $!\n";
|
84
|
-
}
|
85
|
-
LINE: while (<SVN>) {
|
86
|
-
if (/^([\?ID])/) {
|
87
|
-
my $file = (split)[-1];
|
88
|
-
foreach my $ex (@exclude) {
|
89
|
-
if ( $file =~ $ex ) {
|
90
|
-
print "excluded $file\n" unless $quiet or $print;
|
91
|
-
next LINE;
|
92
|
-
}
|
93
|
-
}
|
94
|
-
if ( $1 eq 'D' ) {
|
95
|
-
next unless -f $file;
|
96
|
-
}
|
97
|
-
else {
|
98
|
-
next unless -e $file;
|
99
|
-
}
|
100
|
-
if ($print) {
|
101
|
-
print "$file\n";
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
rmtree( $file, !$quiet, !$force );
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}
|
108
|
-
}
|
109
|
-
|
110
|
-
# Main file-wiping function.
|
111
|
-
sub clean {
|
112
|
-
my ( $path, $status ) = @_;
|
113
|
-
|
114
|
-
# Use relative path for pretty-printing.
|
115
|
-
if ( $path =~ s/^\Q$CWD\E\/?//o ) {
|
116
|
-
|
117
|
-
# If the substitution succeeded, we should have a relative path. Make
|
118
|
-
# sure we don't delete critical stuff.
|
119
|
-
return if $path =~ /^\//;
|
120
|
-
}
|
121
|
-
|
122
|
-
# Find files needing to be removed.
|
123
|
-
if ( $status->text_status == $SVN::Wc::Status::unversioned
|
124
|
-
or $status->text_status == $SVN::Wc::Status::ignored
|
125
|
-
or $status->text_status == $SVN::Wc::Status::deleted )
|
126
|
-
{
|
127
|
-
foreach my $ex (@exclude) {
|
128
|
-
if ( $path =~ $ex ) {
|
129
|
-
print "excluded $path\n" unless $quiet or $print;
|
130
|
-
return;
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
# Make sure the file exists before removing it. Do not remove deleted
|
135
|
-
# directories as they are needed to remove the files they contain when
|
136
|
-
# committing.
|
137
|
-
lstat $path or stat $path;
|
138
|
-
if (
|
139
|
-
-e _
|
140
|
-
and ( not -d _
|
141
|
-
or $status->text_status != $SVN::Wc::Status::deleted )
|
142
|
-
)
|
143
|
-
{
|
144
|
-
if ($print) {
|
145
|
-
print "$path\n";
|
146
|
-
}
|
147
|
-
else {
|
148
|
-
rmtree( $path, !$quiet, !$force );
|
149
|
-
}
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
__END__
|
155
|
-
|
156
|
-
=head1 NAME
|
157
|
-
|
158
|
-
svn-clean - Wipes out unversioned files from Subversion working copy
|
159
|
-
|
160
|
-
=head1 SYNOPSIS
|
161
|
-
|
162
|
-
svn-clean [options] [directory or file ...]
|
163
|
-
|
164
|
-
=head1 DESCRIPTION
|
165
|
-
|
166
|
-
B<svn-clean> will scan the given files and directories recursively and find
|
167
|
-
unversioned files and directories (files and directories that are not present in
|
168
|
-
the Subversion repository). After the scan is done, these files and directories
|
169
|
-
will be deleted.
|
170
|
-
|
171
|
-
If no file or directory is given, B<svn-clean> defaults to the current directory
|
172
|
-
(".").
|
173
|
-
|
174
|
-
B<svn-clean> uses the SVN Perl modules if they are available. This is much
|
175
|
-
faster than parsing the output of the B<svn> command-line client.
|
176
|
-
|
177
|
-
=head1 OPTIONS
|
178
|
-
|
179
|
-
=over 8
|
180
|
-
|
181
|
-
=item B<-e>, B<--exclude>
|
182
|
-
|
183
|
-
A regular expression for filenames to be exluded. For example, the following
|
184
|
-
command will skip files ending in ".zip":
|
185
|
-
|
186
|
-
=over 8
|
187
|
-
|
188
|
-
svn-clean --exclude '\.zip$'
|
189
|
-
|
190
|
-
=back
|
191
|
-
|
192
|
-
Multiple exclude patterns can be specified. If at least one matches, then the
|
193
|
-
file is skipped. For example, the following command will skip files ending in
|
194
|
-
".jpg" or ".png":
|
195
|
-
|
196
|
-
=over 8
|
197
|
-
|
198
|
-
svn-clean --exclude '\.jpg$' --exclude '\.png$'
|
199
|
-
|
200
|
-
=back
|
201
|
-
|
202
|
-
The following command will skip the entire "build" subdirectory:
|
203
|
-
|
204
|
-
=over 8
|
205
|
-
|
206
|
-
svn-clean --exclude '^build(/|$)'
|
207
|
-
|
208
|
-
=back
|
209
|
-
|
210
|
-
=item B<-f>, B<--force>
|
211
|
-
|
212
|
-
Files to which you do not have delete access (if running under VMS) or write
|
213
|
-
access (if running under another OS) will not be deleted unless you use this
|
214
|
-
option.
|
215
|
-
|
216
|
-
=item B<-N>, B<--non-recursive>
|
217
|
-
|
218
|
-
Do not search recursively for unversioned files and directories. Unversioned
|
219
|
-
directories will still be deleted along with all their contents.
|
220
|
-
|
221
|
-
=item B<-q>, B<--quiet>
|
222
|
-
|
223
|
-
Do not print progress info. In particular, do not print a message each time a
|
224
|
-
file is examined, giving the name of the file, and indicating whether "rmdir" or
|
225
|
-
"unlink" is used to remove it, or that it's skipped.
|
226
|
-
|
227
|
-
=item B<-p>, B<--print>
|
228
|
-
|
229
|
-
Do not delete anything. Instead, print the name of every file and directory that
|
230
|
-
would have been deleted.
|
231
|
-
|
232
|
-
=item B<-?>, B<-h>, B<--help>
|
233
|
-
|
234
|
-
Prints a brief help message and exits.
|
235
|
-
|
236
|
-
=item B<--man>
|
237
|
-
|
238
|
-
Prints the manual page and exits.
|
239
|
-
|
240
|
-
=back
|
241
|
-
|
242
|
-
=head1 AUTHOR
|
243
|
-
|
244
|
-
Simon Perreault <nomis80@nomis80.org>
|
245
|
-
|
246
|
-
=cut
|