@@ -33,6 +33,51 @@ class XCSKarelApplication
33
33
global_option ( '--no_pretty' , 'Disables output JSON prettification' )
34
34
global_option ( '--no_filter' , 'Prints full JSON payload for objects instead of just filtering the important ones' )
35
35
36
+ # Managing local xcsconfig folder
37
+
38
+ command :'config list' do |c |
39
+ c . syntax = 'xcskarel config [options]'
40
+ c . description = 'Lists the Xcode Bot configurations found in this folder'
41
+ c . action do |args , options |
42
+ config_folder = XCSKarel ::XCSFile . get_config_folder
43
+ return unless config_folder
44
+ configs = XCSKarel ::XCSFile . load_configs ( config_folder )
45
+ if configs . count == 0
46
+ XCSKarel . log . info "Found no existing configs in #{ config_folder } " . yellow
47
+ else
48
+ out = "\n " + configs . map { |c | "#{ File . basename ( c . path ) } " . yellow + " - from " + "\" #{ c . name } \" " . yellow + ", created at #{ c . created } " } . join ( "\n " )
49
+ XCSKarel . log . info "Found #{ configs . count } configs in \" #{ config_folder } \" :"
50
+ XCSKarel . log . info out
51
+ end
52
+ end
53
+ end
54
+
55
+ command :'config new' do |c |
56
+ c . syntax = 'xcskarel config new [options]'
57
+ c . description = 'Starts the interactive process of creating a new config from an existing Bot'
58
+ add_xcs_options ( c )
59
+ c . action do |args , options |
60
+
61
+ # let user chose a bot from the server
62
+ server = create_server_from_options ( options )
63
+ bot = XCSKarel ::Application . choose_bot ( server )
64
+
65
+ # get our config folder
66
+ config_folder = XCSKarel ::XCSFile . get_config_folder
67
+ return unless config_folder
68
+
69
+ # dump the bot into that config folder under a random name
70
+ new_config_path = XCSKarel ::XCSFile . new_config_name ( config_folder )
71
+ new_config = XCSKarel ::Config . new ( bot , server . api_version , new_config_path )
72
+ new_config . save
73
+
74
+ XCSKarel . log . info "Saved Bot \" #{ new_config . name } \" configuration to #{ new_config_path } ." . green
75
+ system "open \" #{ new_config_path } \" "
76
+ end
77
+ end
78
+
79
+ # Talking to Xcode Server API
80
+
36
81
command :bots do |c |
37
82
c . syntax = 'xcskarel bots [options]'
38
83
c . description = 'Fetches all Bots found on the specified server'
@@ -87,6 +132,8 @@ class XCSKarelApplication
87
132
end
88
133
end
89
134
135
+ # Managing a local Xcode Server
136
+
90
137
command :'server start' do |c |
91
138
c . syntax = 'xcskarel server start [options]'
92
139
c . description = 'Start local Xcode Server'
@@ -137,6 +184,8 @@ class XCSKarelApplication
137
184
end
138
185
end
139
186
187
+ # Managing Xcode
188
+
140
189
command :'xcode select' do |c |
141
190
c . syntax = 'xcskarel xcode select'
142
191
c . description = 'Interactive xcode-select'
0 commit comments