Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.

Commit a5dc363

Browse files
committed
make step-id namespace public (#84)
1 parent 6aa436e commit a5dc363

File tree

7 files changed

+53
-29
lines changed

7 files changed

+53
-29
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ The official release will have a defined and more stable API. If you are already
1111
* `lambdacd.presentation.pipeline-state/overall-build-status`
1212
* `lambdacd.presentation.pipeline-state/latest-most-recent-update`
1313
* `lambdacd.presentation.pipeline-state/earliest-first-update`
14-
* `lambdacd.presentation.pipeline-state/build-duration`
14+
* `lambdacd.presentation.pipeline-state/build-duration`
15+
* Renames namespace `lambdacd.internal.step-id` to `lambdacd.step-id` to officially make it public.
16+
In case someone was using the internal namespace, it is still there but is considered DEPRECATED and will be removed in subsequent releases.
1517
* UI: Link LambdaCD header to "/" to link back to overview in cases with multiple pipelines (#82)
1618
* Bugs:
1719
* `with-workspace` now creates temporary directories in the home-dir (#79)

src/clj/lambdacd/internal/execution.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require [clojure.core.async :as async]
44
[lambdacd.internal.pipeline-state :as pipeline-state]
55
[clojure.tools.logging :as log]
6-
[lambdacd.internal.step-id :as step-id]
6+
[lambdacd.step-id :as step-id]
77
[lambdacd.steps.status :as status]
88
[clojure.repl :as repl]
99
[lambdacd.event-bus :as event-bus])

src/clj/lambdacd/internal/step_id.clj

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
11
(ns lambdacd.internal.step-id
2-
(:require [lambdacd.util :as util]))
2+
(:require [lambdacd.util :as util]
3+
[lambdacd.step-id :as step-id]))
34

4-
; TODO: make this namespace public
5+
; THIS NAMESPACE IS DEPRECATED and will be removed in subsequent releases.
6+
; Use lambdacd.step-id instead.
57

68
(defn parent-of? [a b]
7-
(let [cut-off-b (take-last (count a) b)]
8-
(and
9-
(not= a b)
10-
(= a cut-off-b))))
9+
(step-id/parent-of? a b))
1110

1211
(defn later-than? [a b]
13-
(let [length (max (count a) (count b))
14-
a-parents-first (reverse a)
15-
b-parents-first (reverse b)
16-
equal-length-a (util/fill a-parents-first length -1)
17-
equal-length-b (util/fill b-parents-first length -1)
18-
a-and-b (map vector equal-length-a equal-length-b)
19-
first-not-equal (first (drop-while (fn [[x y]] (= x y)) a-and-b))
20-
[x y] first-not-equal]
21-
(if (nil? first-not-equal)
22-
(> (count a) (count b))
23-
(> x y))))
12+
(step-id/later-than? a b))
2413

2514
(defn before? [a b]
26-
(and
27-
(not= a b)
28-
(not (later-than? a b))))
15+
(step-id/later-than? a b))
2916

3017
(defn child-id [parent-step-id child-number]
31-
(cons child-number parent-step-id))
18+
(step-id/child-id parent-step-id child-number))
3219

3320
(defn root-step-id? [step-id]
34-
(= 1 (count step-id)))
21+
(step-id/root-step-id? step-id))
3522

3623
(defn root-step-id-of [step-id]
37-
(last step-id))
24+
(step-id/root-step-id-of step-id))

src/clj/lambdacd/presentation/pipeline_state.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[clj-time.core :as t]
44
[clojure.tools.logging :as log]
55
[clj-timeframes.core :as tf]
6-
[lambdacd.internal.step-id :as step-id]))
6+
[lambdacd.step-id :as step-id]))
77

88
(defn- desc [a b]
99
(compare b a))

src/clj/lambdacd/step_id.clj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(ns lambdacd.step-id
2+
(:require [lambdacd.util :as util]))
3+
4+
(defn parent-of? [a b]
5+
(let [cut-off-b (take-last (count a) b)]
6+
(and
7+
(not= a b)
8+
(= a cut-off-b))))
9+
10+
(defn later-than? [a b]
11+
(let [length (max (count a) (count b))
12+
a-parents-first (reverse a)
13+
b-parents-first (reverse b)
14+
equal-length-a (util/fill a-parents-first length -1)
15+
equal-length-b (util/fill b-parents-first length -1)
16+
a-and-b (map vector equal-length-a equal-length-b)
17+
first-not-equal (first (drop-while (fn [[x y]] (= x y)) a-and-b))
18+
[x y] first-not-equal]
19+
(if (nil? first-not-equal)
20+
(> (count a) (count b))
21+
(> x y))))
22+
23+
(defn before? [a b]
24+
(and
25+
(not= a b)
26+
(not (later-than? a b))))
27+
28+
(defn child-id [parent-step-id child-number]
29+
(cons child-number parent-step-id))
30+
31+
(defn root-step-id? [step-id]
32+
(= 1 (count step-id)))
33+
34+
(defn root-step-id-of [step-id]
35+
(last step-id))

src/clj/lambdacd/steps/control_flow.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require [lambdacd.core :as core]
44
[clojure.core.async :as async]
55
[lambdacd.steps.support :as support]
6-
[lambdacd.internal.step-id :as step-id]
6+
[lambdacd.step-id :as step-id]
77
[lambdacd.steps.status :as status]
88
[lambdacd.util :as utils])
99
(:refer-clojure :exclude [alias])

test/clj/lambdacd/internal/step_id_test.clj renamed to test/clj/lambdacd/step_id_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(ns lambdacd.internal.step-id-test
1+
(ns lambdacd.step-id-test
22
(:use [lambdacd.testsupport.test-util])
33
(:require [clojure.test :refer :all]
4-
[lambdacd.internal.step-id :refer :all]))
4+
[lambdacd.step-id :refer :all]))
55

66
(deftest later-or-before-test
77
(testing "that [2] is after [1]"

0 commit comments

Comments
 (0)