File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 98
98
$ duct --init
99
99
Created duct.edn
100
100
----
101
+
102
+ This will create a file, `duct.edn` with the content:
103
+
104
+ [,clojure]
105
+ ----
106
+ {:system {}}
107
+ ----
108
+
109
+ == Fundamentals
110
+
111
+ This section will introduce the fundamentals of Duct's design and
112
+ implement a minimal '`Hello World`' application. While it may be
113
+ tempting to skip ahead, a sound understanding of how to use Duct will
114
+ make later sections easier to follow.
115
+
116
+ As mentioned previously, Duct uses a file, `duct.edn`, to define the
117
+ structure of your application. We'll begin by adding a new component
118
+ key to the system:
119
+
120
+ [,clojure]
121
+ ----
122
+ {:system
123
+ {:tutorial.print/hello {}}}
124
+ ----
125
+
126
+ If we try running Duct, it will complain about a missing namespace.
127
+
128
+ [,shell]
129
+ ----
130
+ $ duct --main
131
+ ✓ Initiating system...
132
+ Execution error (IllegalArgumentException) at integrant.core/eval1191$fn (core.cljc:490).
133
+ No such namespace: tutorial.print
134
+ ----
135
+
136
+ Duct is searching for a definition for the component, but not finding
137
+ anything. This is unsurprising, as we haven't written any code yet.
138
+ Let's fix this.
139
+
140
+ First we'll create the directories.
141
+
142
+ [,shell]
143
+ ----
144
+ mkdir -p src/tutorial
145
+ ----
146
+
147
+ Then a minimal Clojure file at: `src/tutorial/print.clj`.
148
+
149
+ [,clojure]
150
+ ----
151
+ (ns tutorial.print)
152
+
153
+ (defn hello [_options]
154
+ (println "Hello World"))
155
+ ----
156
+
157
+ Now if we try to run the application, we get the expected output.
158
+
159
+ [,shell]
160
+ ----
161
+ $ duct --main
162
+ ✓ Initiating system...
163
+ Hello World
164
+ ----
165
+
166
+ Congratulations on your first Duct application!
You can’t perform that action at this time.
0 commit comments