Doc: Add stable and unstable version, try bitcoin-s script

This commit is contained in:
Torkel Rogstad 2019-05-31 16:59:34 +02:00
parent b14a053bb6
commit a19dc94bef
3 changed files with 51 additions and 19 deletions

View File

@ -284,7 +284,8 @@ lazy val docs = project
mdocExtraArguments := List("--no-link-hygiene"), mdocExtraArguments := List("--no-link-hygiene"),
name := "bitcoin-s-docs", name := "bitcoin-s-docs",
mdocVariables := Map( mdocVariables := Map(
"VERSION" -> version.value "STABLE_VERSION" -> previousStableVersion.value.get,
"UNSTABLE_VERSION" -> version.value
), ),
publishWebsite := Def publishWebsite := Def
.sequential( .sequential(

View File

@ -12,15 +12,18 @@ downloads and installs [Coursier](https://get-coursier.io/) and uses it to
fetch the [Ammonite](https://ammonite.io) REPL and the latest version of fetch the [Ammonite](https://ammonite.io) REPL and the latest version of
Bitcoin-S. It then drops you into immediately into a REPL session. Bitcoin-S. It then drops you into immediately into a REPL session.
``` ```bash
% curl -s https://raw.githubusercontent.com/bitcoin-s/bitcoin-s-core/master/try-bitcoin-s.sh | bash $ curl -s https://raw.githubusercontent.com/bitcoin-s/bitcoin-s/master/try-bitcoin-s.sh | bash
Loading... Loading...
Welcome to the Ammonite Repl 1.0.3 Welcome the Bitcoin-S REPL, powered by Ammonite
(Scala 2.12.4 Java 1.8.0_152) Check out our documentation and examples at
If you like Ammonite, please support our development at www.patreon.com/lihaoyi https://bitcoin-s.org/docs/getting-started
@ 23 :: "foo" :: true :: HNil @ val priv = ECPrivateKey()
res0: Int :: String :: Boolean :: HNil = 23 :: "foo" :: true :: HNil @ val pub = priv.publicKey
% @ val spk = P2WPKHWitnessSPKV0(pub)
@ val address = Bech32Address(spk, MainNet)
@ address.value # Tada! You've just made a Bech32 address
res4: String = "bc1q7ynsz7tamtnvlmts4snrl7e98jc9d8gqwsjsr5"
``` ```
## Build tools ## Build tools
@ -33,17 +36,39 @@ instructions for your build tool
Add this to your `build.sbt`: Add this to your `build.sbt`:
```scala ```scala
libraryDependencies +="org.bitcoins" % "bitcoin-s-secp256k1jni" % "@VERSION@" libraryDependencies +="org.bitcoin-s" % "bitcoin-s-secp256k1jni" % "@STABLE_VERSION@"
libraryDependencies += "org.bitcoins" %% "bitcoin-s-core" % "@VERSION@" withSources() withJavadoc() libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-core" % "@STABLE_VERSION@"
libraryDependencies += "org.bitcoins" %% "bitcoin-s-bitcoind-rpc" % "@VERSION@" withSources() withJavadoc() libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-bitcoind-rpc" % "@STABLE_VERSION@"
libraryDependencies += "org.bitcoins" %% "bitcoin-s-eclair-rpc" % "@VERSION@" withSources() withJavadoc() libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-eclair-rpc" % "@STABLE_VERSION@"
libraryDependencies += "org.bitcoins" %% "bitcoin-s-testkit" % "@VERSION@" withSources() withJavadoc() libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-testkit" % "@STABLE_VERSION@"
libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-zmq" % "@STABLE_VERSION@"
```
```scala mdoc:passthrough
val isUnstable = "@UNSTABLE_VERSION" != "@STABLE_VERSION@"
if (isUnstable) {
println(s"""
### Nightly builds
You can also run on the bleeding edge of Bitcoin-S, by
adding a snapshot build to your `build.sbt`. The most
recent snapshot published is `@UNSTABLE_VERSION@`.
To fetch snapshot, you will need to add the correct
resolver in your `build.sbt`:
```sbt
resolvers += Resolver.sonatypeRepo("snapshots")
${List.fill(3)("`").mkString /* Hacky solution to get around nesting backticks */ }
""")
}
libraryDependencies += "org.bitcoins" %% "bitcoin-s-zmq" % "@VERSION@" withSources() withJavadoc()
``` ```
### Mill ### Mill

View File

@ -11,9 +11,15 @@ test -e ~/.coursier/coursier || \
(mkdir -p ~/.coursier && curl -L -s --output ~/.coursier/coursier $COURSIER_URL && chmod +x ~/.coursier/coursier) (mkdir -p ~/.coursier && curl -L -s --output ~/.coursier/coursier $COURSIER_URL && chmod +x ~/.coursier/coursier)
MSG="Welcome the Bitcoin-S REPL, powered by Ammonite MSG="Welcome the Bitcoin-S REPL, powered by Ammonite
Check out our documentation at https://bitcoin-s.org" Check out our documentation and examples at
https://bitcoin-s.org/docs/getting-started"
IMPORT_STATEMENT="import org.bitcoins.core._; import currency._, \
protocol.blockchain._, number._, crypto._, hd._, protocol.script._, \
protocol.ln, wallet.builder._, protocol.transaction._, \
script._, config._, protocol._ "
# launch Ammonite with bitcoin-s on the classpath # launch Ammonite with bitcoin-s on the classpath
~/.coursier/coursier launch -q -P \ ~/.coursier/coursier launch -q -P \
com.lihaoyi:ammonite_2.12.4:latest.release \ com.lihaoyi:ammonite_2.12.8:1.6.0 \
org.bitcoin-s:core.12:latest.release \ org.bitcoin-s:bitcoin-s-core_2.12:latest.release \
-- --predef-code 'import org.bitcoins.core._' --banner $MSG < /dev/tty -M ammonite.Main -- --banner "$MSG" \
--predef-code "$IMPORT_STATEMENT" < /dev/tty