@@ -8,6 +8,10 @@ module Reporting.Exit
88 , Diff(..)
99 , diffToReport
1010 --
11+ , Bump(..)
12+ , bumpToReport
13+ , newPackageOverview
14+ --
1115 , Install(..)
1216 , installToReport
1317 --
@@ -60,13 +64,8 @@ import qualified Reporting.Error as Error
6064
6165
6266data Exit
63− -- bump
64− = BumpApplication
65− | BumpUnexpectedVersion V.Version [V.Version]
66− | BumpMustHaveLatestRegistry RegistryProblem
67− | BumpCannotFindDocs Pkg.Name V.Version DocsProblem
6867 -- publish
69− | PublishMustHaveLatestRegistry RegistryProblem
68+ = PublishMustHaveLatestRegistry RegistryProblem
7069 | PublishApplication
7170 | PublishNotInitialVersion V.Version
7271 | PublishAlreadyPublished V.Version
@@ -218,6 +217,75 @@ diffToReport diff =
218217
219218
220219
220+-- BUMP
221+
222+
223+data Bump
224+ = BumpNoOutline
225+ | BumpBadOutline Outline
226+ | BumpApplication
227+ | BumpUnexpectedVersion V.Version [V.Version]
228+ | BumpMustHaveLatestRegistry RegistryProblem
229+ | BumpCannotFindDocs Pkg.Name V.Version DocsProblem
230+
231+
232+bumpToReport :: Bump -> Help.Report
233+bumpToReport bump =
234+ case bump of
235+ BumpApplication ->
236+ Help.report "CANNOT BUMP APPLICATIONS" (Just "elm.json")
237+ "Your elm.json says this is an application. That means it cannot be published\
238+ \ on <https://package.elm-lang.org> and therefore has no version to bump!"
239+ []
240+
241+ BumpUnexpectedVersion vsn versions ->
242+ Help.docReport "CANNOT BUMP" (Just "elm.json")
243+ ( D.fillSep
244+ ["Your","elm.json","says","I","should","bump","relative","to","version"
245+ ,D.red (D.fromVersion vsn) <> ","
246+ ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
247+ ,"That","means","there","is","no","API","for","me","to","diff","against","and"
248+ ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
249+ ]
250+ )
251+ [ D.fillSep $
252+ ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
253+ ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
254+ , D.vcat $ map (D.green . D.fromVersion) versions
255+ ]
256+
257+ BumpMustHaveLatestRegistry problem ->
258+ error "TODO BumpMustHaveLatestRegistry" problem
259+
260+ BumpCannotFindDocs name version problem ->
261+ error "TODO BumpCannotFindDocs" name version problem
262+
263+
264+
265+-- OVERVIEW OF VERSIONING
266+
267+
268+newPackageOverview :: String
269+newPackageOverview =
270+ unlines
271+ [ "This package has never been published before. Here's how things work:"
272+ , ""
273+ , " - Versions all have exactly three parts: MAJOR.MINOR.PATCH"
274+ , ""
275+ , " - All packages start with initial version " ++ V.toChars V.one
276+ , ""
277+ , " - Versions are incremented based on how the API changes:"
278+ , ""
279+ , " PATCH = the API is the same, no risk of breaking code"
280+ , " MINOR = values have been added, existing values are unchanged"
281+ , " MAJOR = existing values have been changed or removed"
282+ , ""
283+ , " - I will bump versions for you, automatically enforcing these rules"
284+ , ""
285+ ]
286+
287+
288+
221289-- INSTALL
222290
223291
@@ -429,36 +497,6 @@ _toReport :: Exit -> Help.Report
429497_toReport exit =
430498 case exit of
431499
432− -- bump
433−
434− BumpApplication ->
435− Help.report "CANNOT BUMP APPLICATIONS" (Just "elm.json")
436− "Your elm.json says this is an application. That means it cannot be published\
437− \ on <https://package.elm-lang.org> and therefore has no version to bump!"
438− []
439−
440− BumpUnexpectedVersion vsn versions ->
441− Help.docReport "CANNOT BUMP" (Just "elm.json")
442− ( D.fillSep
443− ["Your","elm.json","says","I","should","bump","relative","to","version"
444− ,D.red (D.fromVersion vsn) <> ","
445− ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
446− ,"That","means","there","is","no","API","for","me","to","diff","against","and"
447− ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
448− ]
449− )
450− [ D.fillSep $
451− ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
452− ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
453− , D.vcat $ map (D.green . D.fromVersion) versions
454− ]
455−
456− BumpMustHaveLatestRegistry problem ->
457− error "TODO BumpMustHaveLatestRegistry" problem
458−
459− BumpCannotFindDocs name version problem ->
460− error "TODO BumpCannotFindDocs" name version problem
461−
462500 -- publish
463501
464502 PublishMustHaveLatestRegistry problem ->