guardian-angel 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/guardian-angel +0 -1
  3. data/lib/ga_loader.rb +23 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e8a07cc9d415e7805881f31d56576a065f0b0ae
4
- data.tar.gz: 60e6055cda8f7621571eca4ba028883553eff487
3
+ metadata.gz: 8e448d846f7832faaf993bc66da560f47df9f9e7
4
+ data.tar.gz: 7ee0374d51306fcba167848fcec8adf014e7cdca
5
5
  SHA512:
6
- metadata.gz: 757379efb86edd265634fafbe27d69574c9ee4aae22235e116d433dfa9f1ceaf6ab8f72b3a504cbd4027785f4bd785b69749e1b9e9bdc90b395e1d0a5de8ad15
7
- data.tar.gz: f2135736d1d9760211d793a552b776ba3fc0b19e5690e16ba54d4e8b1968ade9c6dba6f1224aaf1e3781046eae7067435a16e75a4b15a59db05c2092cd2d4b92
6
+ metadata.gz: 25fc3c497a2a8f6ef1b36aeb962deea5343b4da4294e0b7fcc9e076e64866751e9d489306e278fedf7e64953f7785cc662570fc61b4da0a43dade895eb394241
7
+ data.tar.gz: ab080ed038aea304e99ee068414c7315193b58d69074ccc2e273dd48bb8b5e0c4471c4f331ffba64acb803ce4a33f07dc332b0f271b341cd98447c2691312a9e
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'ga_loader'
4
4
  require 'guardian_angel'
5
- require 'ga_logger'
6
5
 
7
6
  trap("INT") { exit }
8
7
 
@@ -30,14 +30,24 @@ class GALoader
30
30
 
31
31
  # Returns a possible workspace, in case one is not provided in the configuration
32
32
  #
33
- # @note this searches only in the current directory
33
+ # @note this searches only in the top level directory
34
34
  def self.findWorkspace
35
- workspace = value = `find . -maxdepth 1 -name '*.xcworkspace'`
35
+ workspace = `find . -maxdepth 1 -name '*.xcworkspace'`
36
36
  return nil if workspace.empty?
37
37
 
38
38
  return File.basename(workspace, ".*")
39
39
  end
40
40
 
41
+ # Returns a possible project, in case one is not provided in the configuration
42
+ #
43
+ # @note this searches only in the top level directory
44
+ def self.findProject
45
+ project = `find . -maxdepth 1 -name '*.xcodeproj'`
46
+ return nil if project.empty?
47
+
48
+ return File.basename(project, ".*")
49
+ end
50
+
41
51
  # Validates a given configuration
42
52
  #
43
53
  # @param configuration [GAConfiguration] the configuration to validate
@@ -51,13 +61,20 @@ class GALoader
51
61
 
52
62
  if !possibleWorkspace
53
63
  if configuration.project.nil?
54
- GALogger.log("workspace or project was not specified, exiting", :Error)
55
- outputSampleConfiguration()
56
- abort
64
+ possibleProject = findProject()
65
+
66
+ if !possibleProject
67
+ GALogger.log("workspace or project was not specified, exiting", :Error)
68
+ outputSampleConfiguration()
69
+ abort
70
+ else
71
+ configurationMerge = GAConfiguration.new(GAConfiguration::GAConfigurationProject => possibleProject)
72
+ end
57
73
  end
74
+ else
75
+ configurationMerge = GAConfiguration.new(GAConfiguration::GAConfigurationWorkspace => possibleWorkspace)
58
76
  end
59
77
 
60
- configurationMerge = GAConfiguration.new(GAConfiguration::GAConfigurationWorkspace => possibleWorkspace)
61
78
  configuration = configuration.merge(configurationMerge)
62
79
  end
63
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guardian-angel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vittorio Monaco