phoenx 0.3.2 → 0.3.3

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: 963226c9078e130ef2598a6c492f3be316df19e6
4
- data.tar.gz: 2057ca4d0d70d4a6eb5ead440fbbb5c061ed6093
3
+ metadata.gz: feded64f42c998c69a907d3072b3bc79d663afe3
4
+ data.tar.gz: ad664cdeaa3e933fe747d8d46b8e1fdfdbce2060
5
5
  SHA512:
6
- metadata.gz: 6a67de14d50e88466874f6bfe93e955a2c8ae1662690a647cab14a78c999d1ce79ab21fd769064181e8d0e35dea99d30e90c3de4cb0e43d11c79320331699c60
7
- data.tar.gz: 72a7354bdbefe9cd2264d4c1cc8ae601424e4f677552a362440b2bb11ed075679bf3ac4d896c2412e39101f8bcb0df77ae8494f634ab45721b67af35541997dc
6
+ metadata.gz: 934d06c3ed6c0a0ed1a8d5a8b52c9d6771aaa7fecbe76085fefc3f4e860cfc7f47a46bcd7446aea7304a43782d72fa9b5d94fbf8897b334c16dd600d145904f1
7
+ data.tar.gz: 01dde15c9767dd129bfad8b5645520d4bd8a5958b7975fa851220cc7da50bf3d4b7a5d2256ce14c7343a2fdaaca2ae84845248bada2b9fd342f7e7bb7f582da1
@@ -7,193 +7,115 @@ module Phoenx
7
7
  class Factory
8
8
 
9
9
  def workspace_command
10
-
11
10
  command = Phoenx::Cli::Command.new "workspace", "Builds the workspace and projects" do
12
-
13
11
  command.print
14
12
  exit
15
-
16
13
  end
17
-
18
14
  command.base_command = "phoenx workspace"
19
15
  command.usage = "Initializes the workspace by generating the xcodeproj and xcworkspace files."
20
-
21
16
  # Add workspace build command
22
-
23
17
  build_command = Phoenx::Cli::Command.new "build", "Builds the workspace and projects" do
24
-
25
18
  workspaces = Dir["*." + Phoenx::WORKSPACE_EXTENSION]
26
-
27
19
  if workspaces.count < 1
28
-
29
20
  puts "Error: No workspace spec found!".red
30
21
  exit
31
-
32
22
  end
33
-
34
23
  workspace = eval File.read(workspaces.first)
35
-
36
24
  if !workspace
37
-
38
25
  puts "Error: No workspace spec found!".red
39
26
  exit
40
-
41
27
  end
42
-
43
28
  puts "\r\nWorkspace ".green + workspace.name.bold
44
-
45
29
  generator = Phoenx::GenerateWorkspace.new workspace
46
30
  generator.generate
47
-
48
31
  exit
49
-
50
32
  end
51
-
52
-
53
33
  build_command.base_command = "phoenx workspace"
54
34
  build_command.usage = "Initializes the workspace by generating the xcodeproj and xcworkspace files."
55
-
56
35
  build_help_option = Phoenx::Cli::Option.new("--help", "-h","Shows this help",false) do
57
36
  build_command.print
58
37
  exit
59
38
  end
60
-
61
39
  build_command.add_option build_help_option
62
-
63
40
  command.add_command build_command
64
-
65
41
  return command
66
-
67
42
  end
68
43
 
69
44
  def project_command
70
-
71
45
  command = Phoenx::Cli::Command.new "project", "Builds the project" do
72
-
73
46
  command.print
74
47
  exit
75
-
76
48
  end
77
-
78
49
  command.base_command = "phoenx project"
79
50
  command.usage = "Generates the xcodeproj file from the pxproject specification."
80
-
81
51
  # Add project build command
82
-
83
52
  build_command = Phoenx::Cli::Command.new "build", "Builds the project" do
84
-
85
53
  projects = Dir["*." + Phoenx::PROJECT_EXTENSION]
86
-
87
54
  if projects.count < 1
88
-
89
55
  puts "Error: No project spec found!".red
90
56
  exit
91
-
92
57
  end
93
-
94
58
  project = eval File.read(projects.first)
95
-
96
59
  if !project
97
-
98
60
  puts "Error: No project spec found!".red
99
61
  exit
100
-
101
62
  end
102
-
103
63
  puts "\r\nGenerating project ".green + project.project_name.bold + ".xcodeproj".bold
104
-
105
64
  generator = Phoenx::GenerateProject.new project
106
65
  generator.build
107
-
108
66
  exit
109
-
110
67
  end
111
-
112
-
113
68
  build_command.base_command = "phoenx project"
114
69
  build_command.usage = "Generates the xcodeproj file."
115
-
116
70
  build_help_option = Phoenx::Cli::Option.new("--help", "-h","Shows this help",false) do
117
71
  build_command.print
118
72
  exit
119
73
  end
120
-
121
74
  build_command.add_option build_help_option
122
-
123
75
  command.add_command build_command
124
-
125
76
  # Add project extract command
126
-
127
77
  extract_command = Phoenx::Cli::Command.new "extract", "Extracts all build settings." do
128
-
129
78
  projects = Dir["*.xcodeproj"]
130
-
131
79
  if projects.length < 1
132
-
133
80
  puts "No Xcode project found.".red
134
81
  exit
135
-
136
82
  end
137
-
138
83
  project = Xcodeproj::Project::open(projects[0])
139
-
140
84
  extractor = Phoenx::ExtractBuildSettings.new project
141
85
  extractor.extract
142
-
143
86
  exit
144
-
145
87
  end
146
-
147
-
148
88
  extract_command.base_command = "phoenx project"
149
89
  extract_command.usage = "Extracts all project and scheme build settings to separate xcconfig files"
150
-
151
90
  extract_help_option = Phoenx::Cli::Option.new("--help", "-h","Shows this help",false) do
152
91
  extract_command.print
153
92
  exit
154
93
  end
155
-
156
94
  extract_command.add_option extract_help_option
157
-
158
95
  command.add_command extract_command
159
-
160
96
  return command
161
-
162
97
  end
163
98
 
164
99
  def cli
165
-
166
100
  # Build cli
167
-
168
101
  cli = Phoenx::Cli::Command.new "root", "" do |c|
169
-
170
102
  c.print
171
-
172
103
  end
173
-
174
104
  cli.base_command = "phoenx"
175
-
176
105
  # Add version and help options
177
-
178
106
  version_option = Phoenx::Cli::Option.new("--version","-v","Shows version information",false) do
179
107
  puts "phoenx version " + Phoenx::VERSION.bold
180
-
181
108
  exit
182
109
  end
183
-
184
110
  help_option = Phoenx::Cli::Option.new("--help","-h","Shows this help",false) do
185
111
  cli.print
186
112
  exit
187
113
  end
188
-
189
114
  cli.add_option version_option
190
115
  cli.add_option help_option
191
-
192
116
  cli.add_command self.workspace_command
193
117
  cli.add_command self.project_command
194
-
195
118
  return cli
196
-
197
119
  end
198
120
 
199
121
  end
@@ -16,166 +16,99 @@ module Phoenx
16
16
  @@indent = 20
17
17
 
18
18
  def initialize(name, description, &block)
19
-
20
19
  @name = name
21
20
  @description = description
22
21
  @block = block
23
-
24
22
  @options = []
25
23
  @commands = []
26
-
27
24
  end
28
25
 
29
26
  def add_option(option)
30
-
31
27
  @options << option
32
-
33
28
  end
34
29
 
35
30
  def add_command(command)
36
-
37
31
  @commands << command
38
-
39
32
  end
40
33
 
41
34
  def parse(args)
42
-
43
35
  args_tmp = args.dup
44
-
45
36
  if args_tmp.empty?
46
-
47
37
  @block.call self
48
-
49
38
  else
50
-
51
39
  args_tmp.each do |arg|
52
-
53
40
  @commands.each do |command|
54
-
55
41
  if arg == command.name
56
-
57
42
  args_tmp.delete(arg)
58
-
59
43
  command.parse(args_tmp)
60
-
61
44
  end
62
-
63
45
  end
64
-
65
46
  @options.each do |option|
66
-
67
47
  if arg == option.name || arg == option.short_cut
68
-
69
- args_tmp.delete(arg)
70
-
48
+ args_tmp.delete(arg)
71
49
  option.execute
72
-
73
50
  end
74
-
75
51
  end
76
-
77
52
  end
78
-
79
53
  end
80
-
81
54
  unless args_tmp.empty?
82
-
83
55
  error = "Unknown arguments: "
84
-
85
56
  args_tmp.each do |arg|
86
-
87
57
  error += arg + " "
88
-
89
58
  end
90
-
91
59
  puts error
92
-
93
60
  print
94
-
95
61
  exit
96
-
97
62
  end
98
-
99
63
  end
100
64
 
101
65
  def print
102
-
103
66
  puts
104
67
  puts "Usage".underline
105
68
  puts
106
69
  cmd = " $ ".bold + base_command
107
-
108
70
  unless @commands.empty?
109
-
110
71
  cmd += " " + "[command]".green.bold
111
-
112
72
  end
113
-
114
73
  unless @options.empty?
115
-
116
74
  cmd += " [options]".blue.bold
117
-
118
75
  end
119
-
120
76
  puts cmd
121
-
122
77
  unless @usage.nil?
123
-
124
78
  puts
125
79
  puts " " + @usage
126
-
127
80
  end
128
-
129
-
130
81
  if !@commands.empty?
131
-
132
82
  puts
133
83
  puts "Commands".underline
134
84
  puts
135
-
136
85
  @commands.each do |command|
137
-
138
86
  puts " ".green + command.name.green.bold + whitespace(command.name) + command.description
139
-
140
87
  end
141
-
142
88
  end
143
-
144
89
  if !@options.empty?
145
-
146
90
  puts
147
91
  puts "Options".underline
148
92
  puts
149
-
150
93
  @options.each do |option|
151
-
152
94
  output = option.name + ", " + option.short_cut
153
95
  puts " " + output.bold.blue + whitespace(output) + option.description
154
-
155
96
  end
156
97
  end
157
-
158
98
  puts
159
-
160
99
  end
161
100
 
162
101
  private
163
102
 
164
103
  def whitespace(message)
165
-
166
104
  count = @@indent - message.length
167
105
  i = 0
168
106
  result = ""
169
-
170
107
  until count == i do
171
-
172
108
  result << " "
173
109
  i += 1
174
-
175
110
  end
176
-
177
111
  return result
178
-
179
112
  end
180
113
 
181
114
  end
@@ -12,19 +12,15 @@ module Phoenx
12
12
  @block
13
13
 
14
14
  def initialize(name, short_cut, description, has_argument, &block)
15
-
16
15
  @name = name
17
16
  @short_cut = short_cut
18
17
  @description = description
19
18
  @has_argument = has_argument
20
- @block = block
21
-
19
+ @block = block
22
20
  end
23
21
 
24
22
  def execute
25
-
26
23
  @block.call
27
-
28
24
  end
29
25
 
30
26
  end
@@ -1,15 +1,12 @@
1
1
  module Phoenx
2
2
 
3
3
  class Configuration
4
-
5
4
  attr_accessor :parent
6
5
  attr_accessor :name
7
6
 
8
7
  def initialize(name, parent)
9
-
10
8
  @name = name
11
9
  @parent = parent
12
-
13
10
  end
14
11
 
15
12
  end
@@ -1,17 +1,14 @@
1
1
  module Phoenx
2
2
 
3
3
  class Dependency
4
-
5
4
  attr_accessor :target_name
6
5
  attr_accessor :path
7
6
  attr_accessor :embed
8
7
 
9
8
  def initialize(target_name, embed = true, path = nil)
10
-
11
9
  @target_name = target_name
12
10
  @path = path
13
11
  @embed = embed
14
-
15
12
  end
16
13
 
17
14
  end
@@ -1,10 +1,8 @@
1
1
  module Phoenx
2
2
 
3
3
  class Project
4
-
5
4
  attr_reader :configurations
6
5
  attr_reader :config_files
7
-
8
6
  attr_accessor :pre_install_scripts
9
7
  attr_accessor :post_install_scripts
10
8
  attr_accessor :project_name
@@ -14,7 +12,6 @@ module Phoenx
14
12
  attr_accessor :deterministic_project
15
13
 
16
14
  def initialize
17
-
18
15
  @configurations = []
19
16
  @config_files = {}
20
17
  @targets = []
@@ -23,27 +20,19 @@ module Phoenx
23
20
  @support_files = []
24
21
  @excluded_support_files = []
25
22
  @deterministic_project = false
26
-
27
23
  yield self
28
-
29
24
  end
30
25
 
31
26
  def configuration(name, parent)
32
-
33
27
  @configurations << Configuration.new(name, parent)
34
-
35
28
  end
36
29
 
37
30
  def target(name, type, platform, version, &block)
38
-
39
31
  targets << Phoenx::TestableTarget.new(name, type, platform, version, &block)
40
-
41
32
  end
42
33
 
43
34
  def project_file_name
44
-
45
35
  return @project_name + "." + XCODE_PROJECT_EXTENSION
46
-
47
36
  end
48
37
 
49
38
  end