Class: Generator::Specs
- Inherits:
-
Object
- Object
- Generator::Specs
- Defined in:
- lib/generator/specs.rb
Overview
Manages the local checkout of Amazon's selling-partner-api-models repo.
Generation is reproducible: sync(ref:) checks out an exact revision (the
pinned SHA for generate/verify). advance! is the only path that moves
the pin forward, used by rake generate:update / the nightly workflow.
Constant Summary collapse
- REPO_URL =
"https://github.com/amzn/selling-partner-api-models.git"- PIN_FILE =
File.join(Config::BASE_PATH, "selling-partner-api-models.sha")
Class Method Summary collapse
-
.advance! ⇒ Object
Pull the latest upstream default branch, point the pin at it, and return the resolved SHA.
-
.directory ⇒ Object
-
.pinned_sha ⇒ Object
-
.sync(ref:) ⇒ Object
Ensure the local clone exists and is checked out at +ref+.
Class Method Details
.advance! ⇒ Object
Pull the latest upstream default branch, point the pin at it, and return the resolved SHA. Caller is responsible for regenerating.
29 30 31 32 33 34 35 36 37 |
# File 'lib/generator/specs.rb', line 29 def advance! ensure_clone! fetch! checkout!("origin/HEAD") sha = resolve_head write_pin(sha) Generator.logger.info("Advanced API models pin to #{sha}") sha end |
.directory ⇒ Object
43 44 45 |
# File 'lib/generator/specs.rb', line 43 def directory File.join(Config::BASE_PATH, "selling-partner-api-models") end |
.pinned_sha ⇒ Object
39 40 41 |
# File 'lib/generator/specs.rb', line 39 def pinned_sha File.read(PIN_FILE).strip end |
.sync(ref:) ⇒ Object
Ensure the local clone exists and is checked out at +ref+.
20 21 22 23 24 25 |
# File 'lib/generator/specs.rb', line 20 def sync(ref:) ensure_clone! fetch! checkout!(ref) Generator.logger.info("Synced API models to #{ref}") end |