Module: Wralph::Adapters::ObjectiveRepositories::GithubIssues
- Defined in:
- lib/wralph/adapters/objective_repositories/github_issues.rb
Class Method Summary collapse
Class Method Details
.download!(identifier) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wralph/adapters/objective_repositories/github_issues.rb', line 12 def self.download!(identifier) # Ensure objectives directory exists objectives_dir = File.join(Interfaces::Repo.wralph_dir, 'objectives') FileUtils.mkdir_p(objectives_dir) # Get the local file path file_path = local_file_path(identifier) # Fetch GitHub issue content issue_content, stderr, success = Interfaces::Shell.run_command("gh issue view #{Shellwords.shellescape(identifier)}") raise "Failed to download GitHub issue ##{identifier}: #{stderr}" unless success # Write the issue content to the file (overwrites if exists) File.write(file_path, issue_content) file_path end |
.local_file_path(identifier) ⇒ Object
30 31 32 33 |
# File 'lib/wralph/adapters/objective_repositories/github_issues.rb', line 30 def self.local_file_path(identifier) objectives_dir = File.join(Interfaces::Repo.wralph_dir, 'objectives') File.join(objectives_dir, "#{identifier}.md") end |