nixenvironment 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3526732db0e17b9f34a822a5b677cf205dbacdb7
4
- data.tar.gz: 459bbd9b2d37acd6c521fe8a94e4d94a15724167
3
+ metadata.gz: 6038c1ba13612621fdf47bea372dcc0967e48e4b
4
+ data.tar.gz: 41b2f2670e4bbc5ba47910a0370cec404dc103dc
5
5
  SHA512:
6
- metadata.gz: 4027c122a44ba48f21c42c9923f8450511532a1d32169aa6fa2ae53d663ed94b09a8ccb04070d94dabe2cb929c66e6425d483c832177bcc770f6e77d9b161dba
7
- data.tar.gz: 174a76a624f69ac626e4e932a679b327910481ceecb0e920a398ef1836da6e02b7b4c89fa5caf634ccbeca813d73e4f701a7e025636a1ae911cc9277cd5569fb
6
+ metadata.gz: 57c4ac0d9615bfef6ea692d0b612c4520ba69ba0bf600d13e575c5f11055318ee57b5c78db2e9c72e1ce5cb953a5ce63fe631fba187c7244386221307de7bc3f
7
+ data.tar.gz: c77c38efa209d4f9fa4c1e097c0544dfb57b51ee27d8b639cda07ed669af5dfb0356ec9df2049852d9f66b53ba7d1d7a593f409111bc3f694b2cf336e39285a2
data/.gitignore CHANGED
@@ -13,4 +13,5 @@
13
13
  *.o
14
14
  *.a
15
15
  mkmf.log
16
- .idea/
16
+ .idea/
17
+ *.gem
data/README.md CHANGED
@@ -15,6 +15,8 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
15
15
  clean # Remove temp files and clean all targets for xcode project
16
16
 
17
17
  clean_working_copy # Make working copy clean
18
+
19
+ code_coverage # Generate xctest unit tests code coverage report
18
20
 
19
21
  code_duplication_report # Generate code duplication report
20
22
 
@@ -26,7 +28,7 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
26
28
 
27
29
  tag # Make SVN/git/mercurial tag, SCM_USERNAME and SCM_PASSWORD must be defined on calling this target
28
30
 
29
- test # Build unit tests and run them in simulator
31
+ test # Build xctest unit tests and run them in simulator
30
32
 
31
33
  update # Install or update ninbas and other environment stuff
32
34
 
@@ -61,5 +63,5 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
61
63
 
62
64
  1. Move project adjuster to this gem.
63
65
  2. Implement bunch ipa making and deployment.
64
- 3. Implement xctest and code_coverage_for_xctest commands (https://bitbucket.org/nixsolutions/ninbas/pull-request/1/added-scripts-for-xctests/).
65
- 4. Rewrite XcodeIconTagger/tagIcons.sh and use it in prebuild method.
66
+ 3. Rewrite XcodeIconTagger/tagIcons.sh and use it in prebuild method.
67
+ 4. Rewrite README for ninbas!
data/bin/Config ADDED
@@ -0,0 +1,38 @@
1
+ ---
2
+ # set these vars if you have multiple projects in the root directory:
3
+ PROJECT_TO_BUILD:
4
+ PROJECT_TARGET_TO_BUILD:
5
+ PROJECT_TARGET_TO_TEST:
6
+
7
+ # OR set these vars if you want to build the workspace instead of the project:
8
+ WORKSPACE_TO_BUILD: NIXProject.xcworkspace
9
+ WORKSPACE_SCHEME_TO_BUILD: Application
10
+ WORKSPACE_SCHEME_TO_TEST: Tests
11
+
12
+ # for osx projects sdk should be macosx10.8 or macosx10.7
13
+ SDK: iphoneos
14
+ SDK_FOR_TESTS: iphonesimulator
15
+
16
+ EXCLUDE_PATTERN_FOR_CODE_COVERAGE: ".*/Vendor/.*|.*/Tests/.*"
17
+ EXCLUDE_PATTERN_FOR_CODE_DUPLICATION: "**/Vendor|**/Scripts"
18
+
19
+ # you shouldn't touch these variables, because they will be defined on the CI server:
20
+ # DEPLOY_HOST:
21
+ # DEPLOY_PATH:
22
+ # DEPLOY_USERNAME:
23
+ # DEPLOY_PASSWORD:
24
+
25
+ # set these var if you want to add build number on icon
26
+ ICONS_PATH: Resources/Icons
27
+
28
+ # Specifies the device to be used as destination
29
+ XCTEST_DESTINATION_DEVICE: platform=iOS Simulator,name=iPhone 5,OS=latest
30
+
31
+ # Configuration of code coverage
32
+ CONFIGURATION_FILES_PATH: ./Scripts/ConfigurationFiles
33
+ CODE_COVERAGE_CONFIGURATION: /CodeCoverage/CodeCoverageConfiguration.xcconfig
34
+ CODE_COVERAGE_OUTPUT_DIRECTORY: ./Coverage/
35
+
36
+ ENV_VAR_PREFIX: NIXENV_
37
+
38
+ INFOPLIST_PATH: Resources/Plists/Info.plist
data/bin/nixenvironment CHANGED
@@ -26,9 +26,11 @@ command :build do |c|
26
26
  c.description = 'Build project for selected configuration and make signed/resigned ipa'
27
27
  c.option '--config NAME', String, 'Select configuration'
28
28
  c.option '--ipa NAME', String, 'Select sign'
29
+ c.option '--ci_build VALUE', String, 'Define NIXENV_CI_BUILD environment variable'
29
30
  c.action do |args, options|
30
- options.default :config => 'Debug', :ipa => 'ipa'
31
+ options.default :config => 'Debug', :ipa => 'ipa', :ci_build => 'yes'
31
32
  read_config
33
+ enable_ci_build(options.ci_build)
32
34
  build_settings = setup(options.config)
33
35
  prebuild(build_settings)
34
36
  build(options.config, options.ipa)
@@ -55,16 +57,25 @@ end
55
57
 
56
58
  command :test do |c|
57
59
  c.syntax = 'nixenvironment test'
58
- c.description = 'Build unit tests and run them in simulator'
60
+ c.description = 'Build xctest unit tests and run them in simulator'
59
61
  c.action do |args, options|
60
62
  read_config
61
63
  test
62
64
  end
63
65
  end
64
66
 
67
+ command :code_coverage do |c|
68
+ c.syntax = 'nixenvironment code_coverage'
69
+ c.description = 'Generate xctest unit tests code coverage report'
70
+ c.action do |args, options|
71
+ read_config
72
+ code_coverage
73
+ end
74
+ end
75
+
65
76
  command :code_duplication_report do |c|
66
77
  c.syntax = 'nixenvironment code_duplication_report'
67
- c.description = 'Generate code duplication report'
78
+ c.description = 'Generate code duplication report for xctest'
68
79
  c.action do |args, options|
69
80
  read_config
70
81
  code_duplication_report
@@ -147,12 +158,22 @@ end
147
158
 
148
159
  def read_config
149
160
  begin
150
- @config = YAML.load(File.read('Config'))
161
+ @config = YAML.load(File.read(File.join(File.dirname(__FILE__), 'Config')))
151
162
  rescue
152
163
  abort('Config file processing error!')
153
164
  end
154
165
  end
155
166
 
167
+ def enable_ci_build(ci_build)
168
+ if ci_build == 'yes' or ci_build == 'true' or ci_build == '1' or ci_build == 'on'
169
+ ENV['NIXENV_CI_BUILD'] = '1'
170
+ p('CI_BUILD enabled.')
171
+ else
172
+ ENV['NIXENV_CI_BUILD'] = nil
173
+ p('CI_BUILD disabled.')
174
+ end
175
+ end
176
+
156
177
  def working_copy_is_clean?
157
178
  is_clean = system("
158
179
  LAST_REVISION_FILE=\"_last_revision.sh\"
@@ -258,7 +279,11 @@ def build(config, ipa)
258
279
  --configuration \"#{config}\"\
259
280
  --sdk \"#{@config['SDK']}\"\
260
281
  --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"")
261
- abort('Build error!') unless build_success
282
+
283
+ unless build_success
284
+ revert_info_plist
285
+ abort('Build error!')
286
+ end
262
287
 
263
288
  case ipa
264
289
  # create .ipa file from last built app product
@@ -278,7 +303,11 @@ def build(config, ipa)
278
303
  end
279
304
 
280
305
  make_success = system("#{make}") if defined? make
281
- abort("#{make} error!") unless make_success
306
+
307
+ unless make_success
308
+ revert_info_plist
309
+ abort("#{make} error!")
310
+ end
282
311
  end
283
312
 
284
313
  def revert_info_plist
@@ -312,24 +341,37 @@ def clean
312
341
  end
313
342
 
314
343
  def test
315
- build = File.join(BUILD_SCRIPTS_PATH, 'Build.py')
316
- run_tests = File.join(BUILD_SCRIPTS_PATH, 'RunTests.sh')
317
- generate_code_coverage_report = File.join(BUILD_SCRIPTS_PATH, 'GenerateCodeCoverageReport.sh')
344
+ code_coverage_configuration = File.join(@config['CONFIGURATION_FILES_PATH'], @config['CODE_COVERAGE_CONFIGURATION'])
345
+ timeout = 10
346
+ ocunit2junit = File.join(BUILD_SCRIPTS_PATH, 'Utils/ocunit2junit')
347
+
348
+ run_tests_success = system("xcodebuild -workspace \"#{@config['WORKSPACE_TO_BUILD']}\"\
349
+ -scheme \"#{@config['WORKSPACE_SCHEME_TO_TEST']}\"\
350
+ -configuration \"Debug\"\
351
+ -sdk \"#{@config['SDK_FOR_TESTS']}\"\
352
+ -xcconfig \"#{code_coverage_configuration}\"\
353
+ -destination-timeout \"#{timeout}\"\
354
+ -destination \"#{@config['XCTEST_DESTINATION_DEVICE']}\"\
355
+ test 2>&1 | \"#{ocunit2junit}\"")
318
356
 
319
- build_success = system("#{build} --project \"#{@config['PROJECT_TO_BUILD']}\"\
320
- --target \"#{@config['PROJECT_TARGET_TO_TEST']}\"\
321
- --workspace \"#{@config['WORKSPACE_TO_BUILD']}\"\
322
- --scheme \"#{@config['WORKSPACE_SCHEME_TO_TEST']}\"\
323
- --configuration \"Release\"\
324
- --sdk \"#{@config['SDK_FOR_TESTS']}\"\
325
- --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"")
326
- abort('Build for test error!') unless build_success
327
-
328
- run_tests_success = system("#{run_tests}")
329
357
  abort('Run test error!') unless run_tests_success
358
+ end
330
359
 
331
- coverage_success = system("#{generate_code_coverage_report} \"#{@config['EXCLUDE_PATTERN_FOR_CODE_COVERAGE']}\" coverage.xml")
332
- abort('Generate code coverage error!') unless coverage_success
360
+ def code_coverage
361
+ generate_code_coverage_report = File.join(BUILD_SCRIPTS_PATH, 'GenerateCodeCoverageForXCTests.sh')
362
+ code_coverage_configuration = File.join(@config['CONFIGURATION_FILES_PATH'], @config['CODE_COVERAGE_CONFIGURATION'])
363
+ timeout = 10
364
+
365
+ report_success = system("#{generate_code_coverage_report} -workspace \"#{@config['WORKSPACE_TO_BUILD']}\"\
366
+ -scheme \"#{@config['WORKSPACE_SCHEME_TO_TEST']}\"\
367
+ -configuration \"Debug\"\
368
+ -sdk \"#{@config['SDK_FOR_TESTS']}\"\
369
+ -xcconfig \"#{code_coverage_configuration}\"\
370
+ -exclude \"#{@config['EXCLUDE_PATTERN_FOR_CODE_COVERAGE']}\"\
371
+ -output \"#{@config['CODE_COVERAGE_OUTPUT_DIRECTORY']}\"\
372
+ -destination-timeout \"#{timeout}\"\
373
+ -destination \"#{@config['XCTEST_DESTINATION_DEVICE']}\"")
374
+ abort('Code coverage error!') unless report_success
333
375
  end
334
376
 
335
377
  def code_duplication_report
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nixenvironment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Arzumanian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,6 +81,7 @@ files:
81
81
  - LICENSE.txt
82
82
  - README.md
83
83
  - Rakefile
84
+ - bin/Config
84
85
  - bin/nixenvironment
85
86
  - gemify.sh
86
87
  - lib/nixenvironment.rb