frasco 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +32 -12
- data/frasco.gemspec +2 -2
- data/lib/frasco/cli.rb +67 -13
- data/lib/frasco/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -6,21 +6,19 @@ Test environment manager for iOS simulator.
|
|
6
6
|
|
7
7
|
$ gem install frasco
|
8
8
|
|
9
|
-
|
9
|
+
Execute `setup` subcommand.
|
10
10
|
|
11
|
-
|
11
|
+
$ frasco setup
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
`init` subcommand create `.frasco` directory in current directory.
|
13
|
+
## Create Snapshot of Test Environment
|
16
14
|
|
17
|
-
###
|
15
|
+
### 1. Backup the current iOS simulator environment and clear
|
18
16
|
|
19
17
|
$ frasco stash
|
20
18
|
|
21
|
-
If iOS simulator is running, execute with `--quit` option.
|
19
|
+
If iOS simulator is running, execute with `-f` or `--quit` option.
|
22
20
|
|
23
|
-
###
|
21
|
+
### 2. Run iOS simulator, and make environment do as you wish
|
24
22
|
|
25
23
|
$ frasco simulator run
|
26
24
|
|
@@ -28,14 +26,15 @@ Example: Register Twitter accounts.
|
|
28
26
|
|
29
27
|
If you need a clean environment, you do not need to do anything.
|
30
28
|
|
31
|
-
###
|
29
|
+
### 3. Save the snapshot
|
32
30
|
|
33
31
|
$ frasco save MySnapshot
|
34
32
|
|
35
|
-
###
|
33
|
+
### 4. Cleanup and restore 1st step's backup
|
36
34
|
|
37
|
-
$ frasco cleanup
|
35
|
+
$ frasco cleanup -f
|
38
36
|
|
37
|
+
|
39
38
|
## Test Using the Snapshot
|
40
39
|
|
41
40
|
### 1. Restore the snapshot
|
@@ -50,7 +49,28 @@ Test by Xcode or xcodebuild, or manually…
|
|
50
49
|
|
51
50
|
### 3. Cleanup and restore 1st step's backup
|
52
51
|
|
53
|
-
$ frasco cleanup
|
52
|
+
$ frasco cleanup -f
|
53
|
+
|
54
|
+
|
55
|
+
## Use Snapshot Archive
|
56
|
+
|
57
|
+
### 1. Archive snapshot
|
58
|
+
|
59
|
+
$ frasco archive MySnapshot ArchivedMySnapshot.frasco-snapshot
|
60
|
+
|
61
|
+
Created "ArchivedMySnapshot.frasco-snapshot" archive file.
|
62
|
+
|
63
|
+
### 2. Restore archived snapshot
|
64
|
+
|
65
|
+
$ frasco up-archive ArchivedMySnapshot.frasco-snapshot
|
66
|
+
|
67
|
+
### 3. Test on iOS simulator
|
68
|
+
|
69
|
+
Test by Xcode or xcodebuild, or manually…
|
70
|
+
|
71
|
+
### 4. Cleanup and restore 2nd step's backup
|
72
|
+
|
73
|
+
$ frasco cleanup -f
|
54
74
|
|
55
75
|
## Contributing
|
56
76
|
|
data/frasco.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Frasco::VERSION
|
9
9
|
spec.authors = ["mtmta"]
|
10
10
|
spec.email = ["d.masamoto@covelline.com"]
|
11
|
-
spec.
|
12
|
-
spec.
|
11
|
+
spec.description = %q{Test environment manager for iOS simulator.}
|
12
|
+
spec.summary = spec.description
|
13
13
|
spec.homepage = "http://neethouse.org/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/frasco/cli.rb
CHANGED
@@ -14,7 +14,7 @@ module Frasco
|
|
14
14
|
if options.include?(:quit)
|
15
15
|
method_option :quit,
|
16
16
|
:type => :boolean,
|
17
|
-
:aliases => "-
|
17
|
+
:aliases => "-f",
|
18
18
|
:desc => "Quit simulator before execute command."
|
19
19
|
end
|
20
20
|
|
@@ -40,13 +40,13 @@ module Frasco
|
|
40
40
|
|
41
41
|
#######################################
|
42
42
|
|
43
|
-
desc "
|
44
|
-
def
|
43
|
+
desc "setup", "Create '.frasco' directory in home directory"
|
44
|
+
def setup
|
45
45
|
|
46
46
|
raise FrascoError.new("already initialized") \
|
47
|
-
if File.exists?(
|
47
|
+
if File.exists?(_default_frasco_dir)
|
48
48
|
|
49
|
-
FileUtils.mkdir(
|
49
|
+
FileUtils.mkdir(_default_frasco_dir)
|
50
50
|
end
|
51
51
|
|
52
52
|
|
@@ -193,6 +193,52 @@ module Frasco
|
|
193
193
|
end
|
194
194
|
|
195
195
|
|
196
|
+
#######################################
|
197
|
+
|
198
|
+
desc "archive <NAME> <ARCHIVE-FILE>", "Archive snapshot of tar.gz"
|
199
|
+
|
200
|
+
method_option :overwrite,
|
201
|
+
:type => :boolean,
|
202
|
+
:aliases => "-f",
|
203
|
+
:desc => "Overwrite exists archive file"
|
204
|
+
|
205
|
+
def archive(name, archive_path)
|
206
|
+
|
207
|
+
snapshot = _get_snapshot(name)
|
208
|
+
|
209
|
+
raise FrascoError.snapshot_notfound_error(snapshot) \
|
210
|
+
unless snapshot.exists?
|
211
|
+
|
212
|
+
raise FrascoError.new("speficied archive file is already exists: #{archive_path}\nOverwrite with -f/--overwrite option.") \
|
213
|
+
if File.exists?(archive_path) && !options["overwrite"]
|
214
|
+
|
215
|
+
archive_path = File.absolute_path(archive_path)
|
216
|
+
|
217
|
+
system("cd '#{snapshot.path}' && tar czf '#{archive_path}' .")
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
|
222
|
+
#######################################
|
223
|
+
|
224
|
+
desc "up-archive <ARCHIVE-FILE>", "Backup current environment to stash, and restore archived snapshot"
|
225
|
+
|
226
|
+
preset_method_option :quit
|
227
|
+
|
228
|
+
def up_archive(archive_path)
|
229
|
+
|
230
|
+
_before_bang_command
|
231
|
+
|
232
|
+
raise FrascoError.new("no such file: #{archive_path}") \
|
233
|
+
unless File.exists?(archive_path)
|
234
|
+
|
235
|
+
stash
|
236
|
+
|
237
|
+
system("mkdir '#{@simulator_dir}' && tar xzf '#{archive_path}' -C '#{@simulator_dir}'")
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
|
196
242
|
#######################################
|
197
243
|
|
198
244
|
desc "simulator [COMMAND]", SimulatorCLI::DESC
|
@@ -224,7 +270,7 @@ module Frasco
|
|
224
270
|
if options[:quit]
|
225
271
|
simulator.quit
|
226
272
|
else
|
227
|
-
raise FrascoError.new("Simulator is running. Quit with
|
273
|
+
raise FrascoError.new("Simulator is running. Quit with -f/--quit option.")
|
228
274
|
end
|
229
275
|
end
|
230
276
|
end
|
@@ -244,18 +290,22 @@ module Frasco
|
|
244
290
|
end
|
245
291
|
|
246
292
|
|
247
|
-
#
|
293
|
+
# Returns $FRASCO_DIR or $HOME/.frasco
|
294
|
+
# Raise an error when .frasco dir is not exists.
|
248
295
|
private
|
249
296
|
def _find_frasco_dir
|
250
297
|
|
251
|
-
dir =
|
298
|
+
dir = ENV["FRASCO_DIR"] || _default_frasco_dir
|
252
299
|
|
253
|
-
|
254
|
-
|
255
|
-
raise FrascoError.new(".frasco directory not exists\nPlease execute 'frasco init' command.") if dir == "/"
|
256
|
-
end
|
300
|
+
raise FrascoError.new("frasco is not setup\nPlease execute 'frasco setup' command.") \
|
301
|
+
unless File.exists?(dir)
|
257
302
|
|
258
|
-
|
303
|
+
dir
|
304
|
+
end
|
305
|
+
|
306
|
+
private
|
307
|
+
def _default_frasco_dir
|
308
|
+
"#{Dir::home}/.frasco"
|
259
309
|
end
|
260
310
|
|
261
311
|
private
|
@@ -263,6 +313,10 @@ module Frasco
|
|
263
313
|
_find_snapshots_dir = "#{_find_frasco_dir}/snapshots"
|
264
314
|
end
|
265
315
|
|
316
|
+
def self.exit_on_failure?
|
317
|
+
true
|
318
|
+
end
|
319
|
+
|
266
320
|
end
|
267
321
|
|
268
322
|
end
|
data/lib/frasco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frasco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description:
|
62
|
+
description: Test environment manager for iOS simulator.
|
63
63
|
email:
|
64
64
|
- d.masamoto@covelline.com
|
65
65
|
executables:
|