Class: PredictabilityEngine::Jira
Constant Summary
Constants included
from CliBase
CliBase::SIZE_DESC, CliBase::VALID_SIZES
Instance Method Summary
collapse
#build_profile_data, #prompt_auth_fields
Methods included from CliBase
included, #initialize
Instance Method Details
#config(profile) ⇒ Object
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/predictability_engine/cli.rb', line 177
def config(profile)
site = ask('Jira site (e.g., https://your-domain.atlassian.net):')
context_path = ask('Context path, if any (e.g., /jira — leave blank for Atlassian Cloud):')
mode = options[:auth_mode]
profile_data = build_profile_data(site, context_path, mode)
path = Config.jira_credentials_file
FileUtils.mkdir_p(File.dirname(path))
cfg = File.exist?(path) ? Config.load_yaml_file(path) : {}
cfg ||= {}
cfg['profiles'] ||= {}
cfg['profiles'][profile] = profile_data
File.write(path, cfg.to_yaml)
PredictabilityEngine.logger.info { "Jira credentials for profile '#{profile}' saved to #{path}" }
end
|
#init(filename) ⇒ Object
193
194
195
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/predictability_engine/cli.rb', line 193
def init(filename)
filename += '.yml' unless filename.end_with?('.yml', '.yaml')
content = <<~YAML
# JIRA Data Source Configuration
# jira_profile: prod-instance # Optional: profile name from ~/.config/jira/jira_credentials.yml
# project: MYPROJ # Optional: JIRA Project Key
# filter_id: "12345" # Optional: JIRA Filter ID
# filter_name: "My Filter" # Optional: JIRA Filter Name
# query: "project = PROJ" # Optional: Direct JQL query
YAML
File.write(filename, content)
PredictabilityEngine.logger.info { "Template created at #{filename}" }
end
|
#workflow(profile, output = nil) ⇒ Object
211
212
213
214
215
216
217
218
219
|
# File 'lib/predictability_engine/cli.rb', line 211
def workflow(profile, output = nil)
path = output || JiraWorkflow.default_path(profile)
fresh = JiraWorkflow.(profile)
wf = File.exist?(path) ? JiraWorkflow.load(path).refresh(fresh) : fresh
wf.write(path)
action = File.exist?(path) ? 'refreshed' : 'written'
PredictabilityEngine.logger.info { "Workflow for profile '#{profile}' #{action}: #{path}" }
PredictabilityEngine.logger.info { "Review #{path} and set role: arrival / departure / null per status." }
end
|
#workflow_merge(output, *sources) ⇒ Object
225
226
227
228
229
230
231
232
233
234
|
# File 'lib/predictability_engine/cli.rb', line 225
def workflow_merge(output, *sources)
raise Error, 'Need at least one workflow source to merge' if sources.empty?
configs = sources.map do |src|
path = File.exist?(src) ? src : JiraWorkflow.default_path(src)
JiraWorkflow.load(path) || raise(Error, "Workflow not found for '#{src}' (tried #{path})")
end
JiraWorkflow.merge(configs).write(output)
PredictabilityEngine.logger.info { "Merged workflow from #{sources.join(', ')} written to #{output}" }
end
|