Class: Agentilda::Linear::Import
- Inherits:
-
Object
- Object
- Agentilda::Linear::Import
- Defined in:
- lib/agentilda/linear/import.rb
Overview
What a plan folder would become in Linear, and what has already become of it. Reads the filesystem; touches nothing else.
One folder is one issue, and the units inside its plan.md are that
issue's children. Projects are never created: a team's project list is
something a human curated, and every plan is filed under one the caller
named on the command line.
Keeping the whole decision offline is what makes --commit honest. The
dry run is not an approximation of what a push would do — it is the same
object the push consumes, so what gets printed and what gets sent cannot
disagree. Everything that needs the network — the project, the repository
pull request list — is handed in.
Instance Attribute Summary collapse
-
#project ⇒ Hash
readonly
The project everything is filed under.
-
#team ⇒ String
readonly
The team key.
Instance Method Summary collapse
-
#actions ⇒ Array<Agentilda::Linear::Action>
Each plan's issue, followed by that issue's children.
-
#initialize(tree:, team:, project:, adopted: {}, since: nil, statuses: nil, force: false) ⇒ Import
constructor
A new instance of Import.
- #pending ⇒ Array<Agentilda::Linear::Action>
- #project_name ⇒ String
-
#to_json(*_args) ⇒ String
The whole import, for a pipe.
-
#unplaced ⇒ Hash{Agentilda::Status => Array<String>}
Plans in a state nobody has decided how to file, and why not.
Constructor Details
#initialize(tree:, team:, project:, adopted: {}, since: nil, statuses: nil, force: false) ⇒ Import
Returns a new instance of Import.
70 71 72 73 74 75 76 77 78 |
# File 'lib/agentilda/linear/import.rb', line 70 def initialize(tree:, team:, project:, adopted: {}, since: nil, statuses: nil, force: false) @tree = tree @team = team.to_s.strip.upcase @project = project @adopted = adopted @since = since && Ordinal.parse(since) @statuses = statuses @force = force end |
Instance Attribute Details
#project ⇒ Hash (readonly)
Returns the project everything is filed under.
84 85 86 |
# File 'lib/agentilda/linear/import.rb', line 84 def project @project end |
#team ⇒ String (readonly)
Returns the team key.
81 82 83 |
# File 'lib/agentilda/linear/import.rb', line 81 def team @team end |
Instance Method Details
#actions ⇒ Array<Agentilda::Linear::Action>
Returns each plan's issue, followed by that issue's children.
91 |
# File 'lib/agentilda/linear/import.rb', line 91 def actions = @actions ||= subjects.flat_map { |s| actions_for(s) } |
#pending ⇒ Array<Agentilda::Linear::Action>
94 |
# File 'lib/agentilda/linear/import.rb', line 94 def pending = actions.select(&:pending?) |
#project_name ⇒ String
87 |
# File 'lib/agentilda/linear/import.rb', line 87 def project_name = project["name"].to_s |
#to_json(*_args) ⇒ String
Returns the whole import, for a pipe.
97 98 99 |
# File 'lib/agentilda/linear/import.rb', line 97 def to_json(*_args) JSON.pretty_generate(team:, project: project_name, actions: actions.map(&:to_h_json)) end |
#unplaced ⇒ Hash{Agentilda::Status => Array<String>}
Plans in a state nobody has decided how to file, and why not.
104 105 106 107 |
# File 'lib/agentilda/linear/import.rb', line 104 def unplaced @unplaced ||= (chosen - subjects).group_by(&:status) .transform_values { |group| group.map { |s| s.feature.ordinal.to_s } } end |