phoenx 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fad0b0f9374828489be8c28913ece8ddaaf7217
4
- data.tar.gz: e7938fed66e650597c6fb8bd18991c86ae482c23
3
+ metadata.gz: 2acf8c64c97fe3a5d70cf865fa728eb38c91390e
4
+ data.tar.gz: 5e0ca207a9b54ce5c26ea247e7bd3b92d6fa431c
5
5
  SHA512:
6
- metadata.gz: b67b56961ca16928126ec99fd58d2cf33cf24266173f08c0f7978204d2204976b2c29c5deca3eb87d5bd207fb39cf6e5042b2e4143c2ca77f56605963ec3c0f9
7
- data.tar.gz: 6538c60c4698ca63a92b26293b0f9610f68ec10f7bcfa70982eba9d4828f4b7443aa41ab7c157a95843a5c99fecf374d360f94a5eda1a5b2d046d9aabf477af8
6
+ metadata.gz: c23b840744f677f9268554420ffa719bc3fcf2623c45197159962a271075bf9b4bdd437d3e0fee08b597370c2bc6d1e63cc552199e67a04a4f4cd175f8816e03
7
+ data.tar.gz: a6c91ecdc78043b4434cd4f0fddc5ab7f184ab2f2ffa028038ac78f63c1ebfc589455e36bb0adb138dd8098048c1c9ffc39826bed0719e0a7b6ef344fedbca34
data/lib/phoenx.rb CHANGED
@@ -18,6 +18,7 @@ require 'phoenx/entities/dependency'
18
18
  require 'phoenx/use_cases/generate_workspace'
19
19
  require 'phoenx/use_cases/generate_project'
20
20
  require 'phoenx/use_cases/generate_target'
21
+ require 'phoenx/use_cases/extract_build_settings'
21
22
 
22
23
  require 'phoenx/utilities/xcodeproj_utils'
23
24
  require 'phoenx/utilities/files_utils'
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module Phoenx
2
4
 
3
5
  module Cli
@@ -76,7 +78,7 @@ module Phoenx
76
78
  command.base_command = "phoenx project"
77
79
  command.usage = "Generates the xcodeproj file from the pxproject specification."
78
80
 
79
- # Add workspace build command
81
+ # Add project build command
80
82
 
81
83
  build_command = Phoenx::Cli::Command.new "build", "Builds the project" do
82
84
 
@@ -119,6 +121,41 @@ module Phoenx
119
121
  build_command.add_option build_help_option
120
122
 
121
123
  command.add_command build_command
124
+
125
+ # Add project extract command
126
+
127
+ extract_command = Phoenx::Cli::Command.new "extract", "Extracts all build settings." do
128
+
129
+ projects = Dir["*.xcodeproj"]
130
+
131
+ if projects.length < 1
132
+
133
+ puts "No Xcode project found.".red
134
+ exit
135
+
136
+ end
137
+
138
+ project = Xcodeproj::Project::open(projects[0])
139
+
140
+ extractor = Phoenx::ExtractBuildSettings.new project
141
+ extractor.extract
142
+
143
+ exit
144
+
145
+ end
146
+
147
+
148
+ extract_command.base_command = "phoenx project"
149
+ extract_command.usage = "Extracts all project and scheme build settings to separate xcconfig files"
150
+
151
+ extract_help_option = Phoenx::Cli::Option.new("--help", "-h","Shows this help",false) do
152
+ extract_command.print
153
+ exit
154
+ end
155
+
156
+ extract_command.add_option extract_help_option
157
+
158
+ command.add_command extract_command
122
159
 
123
160
  return command
124
161
 
@@ -1,5 +1,5 @@
1
1
  module Phoenx
2
2
 
3
- VERSION = "0.1.4".freeze unless defined? Phoenx::VERSION
3
+ VERSION = "0.2.0".freeze unless defined? Phoenx::VERSION
4
4
 
5
5
  end
@@ -0,0 +1,98 @@
1
+ module Phoenx
2
+
3
+ class ExtractBuildSettings
4
+
5
+ :project
6
+
7
+ def initialize(project)
8
+
9
+ @project = project
10
+
11
+ end
12
+
13
+ def extract_target_settings
14
+
15
+ @project.targets.each do |target|
16
+
17
+ FileUtils::mkdir_p 'xcconfig/' + target.name
18
+
19
+ target.build_configuration_list.build_configurations.each do |config|
20
+
21
+ file = open('xcconfig/' + target.name + '/' + config.name + '.xcconfig', 'w')
22
+
23
+ config.build_settings.each do |key,values|
24
+
25
+ file.write(key + ' = ')
26
+
27
+ if values.is_a?(String)
28
+
29
+ file.write(values)
30
+
31
+ else
32
+
33
+ values.each do |value|
34
+
35
+ file.write(value + ' ')
36
+
37
+ end
38
+
39
+ end
40
+
41
+ file.puts
42
+
43
+ end
44
+
45
+ file.close
46
+
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+
53
+ def extract_project_settings
54
+
55
+ FileUtils::mkdir_p 'xcconfig'
56
+
57
+ @project.build_configuration_list.build_configurations.each do |config|
58
+
59
+ file = open('xcconfig/' + config.name + '.xcconfig', 'w')
60
+
61
+ config.build_settings.each do |key,values|
62
+
63
+ file.write(key + ' = ')
64
+
65
+ if values.is_a?(String)
66
+
67
+ file.write(values)
68
+
69
+ else
70
+
71
+ values.each do |value|
72
+
73
+ file.write(value + ' ')
74
+
75
+ end
76
+
77
+ end
78
+
79
+ file.puts
80
+
81
+ end
82
+
83
+ file.close
84
+
85
+ end
86
+
87
+ end
88
+
89
+ def extract
90
+
91
+ self.extract_target_settings
92
+ self.extract_project_settings
93
+
94
+ end
95
+
96
+ end
97
+
98
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoenx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Meder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-06 00:00:00.000000000 Z
11
+ date: 2016-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.beta.2
19
+ version: 1.3.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0.beta.2
26
+ version: 1.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colored
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +87,7 @@ files:
87
87
  - lib/phoenx/entities/target.rb
88
88
  - lib/phoenx/entities/workspace.rb
89
89
  - lib/phoenx/gem_version.rb
90
+ - lib/phoenx/use_cases/extract_build_settings.rb
90
91
  - lib/phoenx/use_cases/generate_project.rb
91
92
  - lib/phoenx/use_cases/generate_target.rb
92
93
  - lib/phoenx/use_cases/generate_workspace.rb