arli 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e66d1d140d209c8afbc79e983511356099ba62a8
4
- data.tar.gz: 230a68d260099f99f18a36b5e942fe290e5051ef
3
+ metadata.gz: adcc3fbbb5dd94f24a30c1662c9770bb010eab0e
4
+ data.tar.gz: 3ac5b432418cf52430e664b5409e9377f83959ab
5
5
  SHA512:
6
- metadata.gz: b6845831dcc2b447ffff45103fab7b620c616564b1df6a5a0e5b44cf7b0de5320a1e895bfe92b55a6357938b1fe6542e0e18039f730dff2de9607d4319a2d2da
7
- data.tar.gz: 5b1264568dd1e1c5f3716d66a724a4fc29edc42ed33b079072700a86313ee493e6f764fa029be94ff24f0d8a9b1c83442d615faebfeacf1caf58f17c93187f5e
6
+ metadata.gz: 4301495fc38c55dc8ce4a4dc4062b87e87bb325ab40c7607427a9650d2b135cf7e78a6e693211e44428cae27ae8bc40965add0784e9deb5f7548c82571bea007
7
+ data.tar.gz: d9f2ff1345a4d6205b1258e4a81574bb58496386526a60700aaea95637113fadd293dd3edcaf0bef175890b807a4362fbd1c0619b2255161c4b29031a8f19e0d
data/.gitignore CHANGED
@@ -16,4 +16,5 @@
16
16
  /spec/fixtures/file*/Arlifile.*
17
17
  /spec/fixtures/file*/libraries
18
18
  .rake_tasks~
19
+ .vscode
19
20
 
data/README.md CHANGED
@@ -7,58 +7,98 @@ Please visit Gitter to discuss this project.
7
7
 
8
8
  [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/arduino-cmake-arli/)
9
9
 
10
-
11
10
  # Arli — The Missing Arduino Library Manager
12
11
 
13
- **Arli** is a simple and very easy to use command-line tool, that provides several key functions to aid in Arduino project development.
12
+ **Arli** is a simple and very easy to use the command-line tool, which offers several vital features to aid in Arduino project development, especially for larger projects with many depenencies and external libraries.
13
+
14
+ Arli can:
15
+
16
+ * automatically **find, download and install** of any number of third-party Arduino library dependencies, while performing a [library folder name resolution](#folder-detection)
17
+
18
+ * **maintain a consistent set of libraries** for a given project using a YAML-formatted `Arlifile`.
19
+
20
+ * **generate a new project skeleton** that uses [`arduino-cmake`](https://github.com/arduino-cmake/arduino-cmake) as the build environment, which builds and uploads your firmware "out of the box".
21
+
22
+ * **search for Arduino libraries** in the official public [database](http://downloads.arduino.cc/libraries/library_index.json.gz) maintained by Arduino using any library attribute by exact match, or regular expression, substring, and more.
23
+
24
+ ### Who is Arli For?
25
+
26
+ _Arli is ideally suited for C/C++ programmers who have some basic knowledge of CMake, and who want to build larger-than-trivial projects on Arduino platform. Arli promotes use and reuse of libraries, which help take advantage of the Object Oriented Design Patterns, decoupling your code into reusable libraries._
27
+
28
+ Having said that, Arli is also helpful for projects that do NOT use CMake. It can be used purely as a library manager, or GitHub repo downloader.
29
+
30
+ ### Why not the Arduino IDE?
14
31
 
15
- ### Why not Arduino IDE? Why not Platform.IO?
32
+ Arduino IDE is not meant for professional engineers — it's a fantastic educational tool for students. And while it lacks basic features of C/C++ development it succeeds in making Arduino programming accessible to young kids and students.
16
33
 
17
- Arduino IDE is not meant for professional engineers — it's an educational tool for students. But if you want to build a sophisticated project in Arduino, you could leverage most of the Object Oriented practices thanks to the C++ support, as well as decoupling your code into modules and/or libraries.
34
+ ### Why not Platform.IO?
18
35
 
19
- Unfortunately, this is not very easy to do with neither Arduino IDE, nor Platform.IO AFAIK.
36
+ [PlatformIO](http://platformio.org/) is a great "eco-system" that includes not just Arduino, but many other boards, provides integrated library manager, and Atom as the primary IDE. It's a fantastic tool for beginner/intermediate developers, much better than Arduino IDE.
20
37
 
21
- ### So, How does Arli Do It?
38
+ But it's not without its downsides: to some — PlatformIO feels *too heavy*. It comes with a gazillion additional features you'll never use and it tries to be too much all at once. Perhaps for some people — it can be a feature. But for the author and other members of the Arduino dev community, PlatformIO design goes against the fundamental principals of [Unix Philosophy](https://en.wikipedia.org/wiki/Unix_philosophy), which promotes a minimalist, modular software development delegated to specialized commands that can be all interconnected (think `grep`, `awk`, `sort`, `uniq`).
22
39
 
23
- Arli integrates natively with the [arduino-cmake](https://github.com/arduino-cmake/arduino-cmake) project, and provides an automatic generator for new projects, that should compile and upload out of the box.
40
+ ### How is Arli Different?
24
41
 
25
- You can easily declare new library depenencies, and Arli will happily find and install them for you, while the [arli-cmake](https://github.com/kigster/arli-cmake) project (that's a bridge between the two) knows how to compile each external library into a static .a object, and link it with your firmware in the end.
42
+ Arli is a fast, small, and pretty specialized command line tool (written in Ruby) that only does **four or five things very well**, and relies on other well-supported projects do their job in particular, it relies on Arduino SDK, and `arduino-cmake` when it generates new projects.
43
+
44
+ Arli shines when you need to build a complicated and multi-dependency project using an Arduino compatible board such as [Teensy](https://www.pjrc.com/teensy/), which has 16x more RAM than the Arduino UNO, and therefore allows you to take advantage of many more third-party Arduino libraries at once within a single project.
45
+
46
+ > A few years ago the author built a complex project called [**Filx Capacitor**](https://github.com/kigster/flix-capacitor), which relied on **ten** external libraries. Managing these dependencies was very time-consuming. Asking someone else to build this project on their system was near impossible. Not just that, but even for the author himself, after taking some time off and returning to the project — it was still difficult to figure out why it was suddenly refusing to build. So many things could have gone wrong.
47
+ >
48
+ > This is the problem Arli (together with the very powerful `arduino-cmake` project) attempts to solve. Your project's dependencies can be cleanly defined in a YAML file called `Arlifile`, together with an optional board name and a CPU. Next, you add a bunch of C/C++ files to the folder, update `CMakeLists.txt` file and rebuild the project, upload the firmware, or connect to the serial port. See [arli-cmake](https://github.com/kigster/arli-cmake#manual-builds) for more information.
26
49
 
27
50
  ## Overview
28
51
 
29
52
  Arli offers several commands, explained below:
30
53
 
31
- * `arli search [ terms ]` — search for a library by name or any attribute
54
+ * `arli search [ name | regex | ruby-expression]`
55
+ [searches](#search-command) for a library by name or any attribute
56
+
57
+ * `arli install [ name | regex | ruby-expression ]`
58
+ search, and [install](#install-command) a single library if the search resulted in one and only one match.
59
+
60
+ * `arli bundle [ -f [ yaml | json | cmake | text ] ] `
61
+ reads a YAML-formatted `Arlifile`, and [bundles](#bundle-command), i.e., searches, downloads, resolves the appropriate library folder name, and installs all libraries to either a global location, or a custom location specified by a `-l` flag, or in the `Arlifile` itself.
62
+
63
+ In the CMake mode, generates `Arlifile.cmake` that is included in the main CMake of the project.
64
+
65
+ * `arli generate ProjectName [ -w ~/workspace ]`
66
+ [generates](#generate-command) a clean brand new C/C++ project in a given folder, that consists of `Arlifile`, a C++ file, a `CMakeLists.txt` file, and the dependent CMake libraries all included.
32
67
 
33
- * `arli install 'library-name'` — search, and install a single library
34
- * `arli bundle` — uses a YAML-formatted `Arlifile` to install a bunch of dependencies. Can optionally generate a CMake include file for this project.
35
- * `arli generate ProjectName --workspace ~/coding` — generates a clean brand new project in a given folder, that's equipped with `Arlifile`, and builds out of the box.
68
+ ## Arlifile and the Bundle Command
36
69
 
37
- ### Arlifile and Bundle Command
70
+ This is the cornerstone of this library, and so we discuss this in detail.
38
71
 
39
- `Arlifile` should be placed at the top of your project sources. Here is an example of a simple Arlifile with a bunch of dependencies:
72
+ Below is the image of a pretty comprehensive version of an [`Arlifile`](https://github.com/kigster/weather-pod/blob/master/src/Arlifile), which should be placed at the top of your project sources.
40
73
 
41
74
  ![](docs/arlifile.png)
42
75
 
43
- Next, below is a screenshot of running `arli bundle` inside of that folder. In this particular case, libraries are installed into the default folder `~/Documents/Arduino/Libraries`:
76
+ The `dependencies` is the key that lists third-party libraries. But you can also define hardware dependencies such as `Wire`, and the BOARD name and the CPU if your project relies on a particular board.
44
77
 
45
- ![](docs/arli-in-action.png)
78
+ > One of Arli's design goals was for `Arlifile` to become a central "configuration" file for the project, and go beyond pure dependencies and also contain some additional metadata about the project that makes your code easily portable to another computer.
46
79
 
47
80
  #### Bundle Command Explained
48
81
 
49
- Let's break down what you see on the above screenshot:
82
+ When you run `arli bundle` in the folder with an `Arlifile`, many things happen. Below is another screenshot of running bundle:
50
83
 
51
- * First Arli prints the header, containing Arli version, the command, as well as the destination library path that the libraries are going to get installed to.
84
+ ![](docs/arli-bundle.png)
52
85
 
53
- * Next, Arli is looping, and for each library without the `url` field, it performs a search by the library `name` (and optionally its `version`), and then it prints the resulting library's name in blue.
54
- * The `version` that either was specified in the `Arlifile`, or is the latest for this library is printed next, in green.
55
- * Then Arli downloads the library sources either using the URL provided, or the URL attribute of the search result. Note, that **Arli always downloads libraries into a temporary folder first.**.
56
- * Arli then scans the files inside each folder, and cleverly determines the *canonical directory name* for each library based on the most appropriate C/C++ header file.
57
- * Next, the library is moved to the new canonical name within the temporary folder, and then the canonical folder is moved into the destination library path.
58
- * If the destination folder already exist, there are three possible actions that can be specified via `-e` flag that will happen:
86
+ Let's break down what you see in the above screenshot:
87
+
88
+ * Arli reads the list of `dependencies`, and for each library without the `url` field, it performs a search by the library `name` and optionally `version`, and then it prints the found library name in blue.
89
+
90
+ * The `version` that either was specified in the `Arlifile` or is the latest for this particular library is printed next, in green.
91
+
92
+ * Then Arli downloads the library sources either using the URL provided, or the URL attribute of the search result. Note, that **Arli always downloads libraries into a temporary folder first.**.
93
+
94
+ * Arli then scans the files inside each folder, and cleverly determines the [**canonical directory name**](#folder-detection) for each library based on the most appropriate C/C++ header file found within it. This is the name printed to the right in green.
95
+
96
+ * Next, the library is moved to the new canonical name within the temporary folder, and then the canonical folder is moved into the destination library path.
97
+
98
+ * If the destination folder already exists, three possible actions can happen, and are controlled with the `-e` flag:
59
99
 
60
- * the silent default action is to simply **overwrite the existing library folder**.
61
- * by using `-e [ abort | backup ]` you can optionally either abort the installation, or create a backup of each existing folder.
100
+ * the default action is to simply **overwrite the existing library folder**.
101
+ * by using `-e [ abort | backup ]` you can optionally either abort the installation, or create a backup of the existing folder.
62
102
 
63
103
  #### Arlifile "Lock" File
64
104
 
@@ -72,19 +112,17 @@ $ arli bundle -f [ yaml | json | cmake ]
72
112
 
73
113
  Will create `Arlifile.yaml` or `Arlifile.cmake` with the set of resolved libraries.
74
114
 
75
-
76
-
77
115
  <a name="folder-detection"></a>
78
116
 
79
- #### Automatic Folder Name Correction
117
+ ### Automatic Folder Name Correction
80
118
 
81
119
  Arli understands that the folder where the library is installed must be named correctly: in other words, **folder name must match the header file inside of the folder** for the library to be found.
82
120
 
83
- When Arli downloads libraries in ZIP format, they are unpacked into folder that are named differently. Arli will then search that folder for the source and header files. The name of the directory is then compared to the files found, and in some cases Arli will automatically **rename the library folder to match the main header file.**.
121
+ When Arli downloads libraries in ZIP format, they are unpacked into a folder that would not resolve as an Arduino library folder without having to be renamed. Arli provides an algorithm that searches the contents of the folder for the source and header files. The name of the directory is then compared to the files found, and in most cases Arli will automatically **rename the library folder to match the main header file **
84
122
 
85
123
  > For example, 'Adafruit GFX Library' is the proper name of a corresponding library, and it's ZIP archive will unpack into a folder named `Adafruit_GFX_Library-1.4.3`. Arli will then detect that the header file inside the folder is `Adafruit_GFX.h`. In this case Arli will rename the top-level folder to `Adafruit_GFX`, and make the library valid, and its folder easily found.
86
124
 
87
- <a name="command-generate"></a>
125
+ <a name="generate-command"></a>
88
126
 
89
127
  ## Command Generate
90
128
 
@@ -112,8 +150,7 @@ There is an additional `example` folder that shows the complete example that use
112
150
 
113
151
  > **IMPORTANT**: Please do not forget to run `bin/setup` script. It downloads `arduino-cmake` dependency, without which the project will not build.
114
152
 
115
-
116
- <a name="command-bundle"></a>
153
+ <a name="bundle-command"></a>
117
154
 
118
155
  ## Command Bundle
119
156
 
@@ -168,10 +205,19 @@ Each format produces a file `Arlifile.<format>`: YAML and JSON will simply inclu
168
205
 
169
206
  The CMake format is now fully supported, in tandem with `arduino-cmake` project.
170
207
 
208
+ Below is the resulting `Arlifile.cmake` after running `arli bundle` on the above mentioned file.
209
+
210
+ ![](docs/arlifile-cmake.png)
211
+
171
212
  See the `generate` command, which creates a new project with CMake enabled.
172
213
 
214
+ If you create `build` folder and run `cmake ..` here is what you'll see:
215
+
216
+ ![](docs/arli-cmake-build.png)
173
217
 
174
- <a name="command-install"></a>
218
+ Just run `make` or `make upload` right after build and upload your firmware.
219
+
220
+ <a name="install-command"></a>
175
221
 
176
222
  ## Command `install`
177
223
 
@@ -184,7 +230,7 @@ Eg:
184
230
  ❯ arli install 'https://github.com/jfturcot/SimpleTimer'
185
231
  ```
186
232
 
187
- <a name="command-search"></a>
233
+ <a name="search-command"></a>
188
234
 
189
235
  ## Command `search`
190
236
 
@@ -217,28 +263,7 @@ The search argument can also be a ruby-syntaxed expression, that (if you know ru
217
263
 
218
264
  You can also use regular expressions, and set maximum number of results printed by the `-m MAX` flag.
219
265
 
220
- ```
221
- ❯ arli search 'name: /adafruit/i'
222
-
223
- --------------------------------------------------------------------------------
224
- Arli (0.8.4), Command: search
225
- Library Path: ~/Documents/Arduino/Libraries
226
- --------------------------------------------------------------------------------
227
-
228
- Adafruit ADS1X15 (1.0.0) ( 1 total versions )
229
- Adafruit ADXL345 (1.0.0) ( 1 total versions )
230
- Adafruit AHRS (1.1.3) ( 5 total versions )
231
- Adafruit AM2315 (1.0.1) ( 2 total versions )
232
- Adafruit AMG88xx Library (1.0.0) ( 1 total versions )
233
- ......
234
- Adafruit WS2801 Library (1.0.0) ( 1 total versions )
235
- Adafruit microbit Library (1.0.0) ( 1 total versions )
236
- Adafruit nRF8001 (1.1.1) ( 2 total versions )
237
- ———————————————————————
238
- Total Versions : 355
239
- Unique Libraries : 116
240
- ———————————————————————
241
- ```
266
+ ![search](docs/arli-search.png)
242
267
 
243
268
  #### Search Output Format
244
269
 
@@ -281,9 +306,10 @@ Arli is both an *Arduino Library Manager* and a project generator. If you are us
281
306
  * Well, for one, Arli can "bundle" libraries not just from the official Arduino database, but also from individual Github URLs. There are thousands of libraries of high quality, that for one reason or another did not make it into the official database.
282
307
 
283
308
  * Arduino still haven't come up with a way to automatically document project's dependencies on a set of libraries. I believe the best you've got is having to list libraries in comments, and then install each manually. With Arli you can automate this entire process.
309
+
284
310
  * [Not everyone likes using Arduino IDE](https://kig.re/2014/08/02/arduino-ide-alternatives.html). So this tool is, perhaps, aimed more at the professional programmers, wanting to build applications that tend to be on a complex side, and rely on multiple third party libraries. Boards like Teensy have a lot more RAM than Arduino UNO and clones, and so it can support much larger projects with dozens of libraries linked in with the firmware.
285
- * One of Arli's design goals is to provide a bridge between the [arduino-cmake](https://github.com/arduino-cmake/arduino-cmake) project, which provides an alternative build system, and is compatible with numerous IDEs such as [Atom](https://atom.io), [JetBrains CLion](https://www.jetbrains.com/clion/), [Visual Studio Code](https://code.visualstudio.com/), or even [Eclipse](https://eclipse.org).
286
311
 
312
+ * One of Arli's design goals is to provide a bridge between the [arduino-cmake](https://github.com/arduino-cmake/arduino-cmake) project, which provides an alternative build system, and is compatible with numerous IDEs such as [Atom](https://atom.io), [JetBrains CLion](https://www.jetbrains.com/clion/), [Visual Studio Code](https://code.visualstudio.com/), or even [Eclipse](https://eclipse.org).
287
313
 
288
314
 
289
315
  ## Development
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ def shell(*args)
8
8
  end
9
9
 
10
10
  task :clean do
11
- shell('rm -rf pkg/ tmp/ coverage/' )
11
+ shell('rm -rf pkg/ tmp/ coverage/ doc/ spec/fixtures/file5/libraries' )
12
12
  end
13
13
 
14
14
  task :permissions => [ :clean ] do
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -31,89 +31,178 @@ module Arli
31
31
 
32
32
  def run
33
33
  Dir.chdir(workspace) do
34
- run_system_command "git clone -v #{template_repo} #{project_name} 2>&1"
34
+ run_with_info(
35
+ "grabbing the template from\n • #{template_repo.bold.green}...",
36
+ "git clone -v #{template_repo} #{project_name} 2>&1"
37
+ )
35
38
  Dir.chdir(project_name) do
36
39
  FileUtils.rm_rf('.git')
37
- run_system_command 'git init .'
38
- run_system_command 'bin/setup'
39
- configure_template!
40
+ FileUtils.rm_rf('example')
41
+ run_with_info(
42
+ "configuring the new project #{project_name.bold.yellow}",
43
+ 'git init .'
44
+ )
45
+ run_with_info('customizing your README and other files...')
40
46
  rename_files!
47
+ configure_template!
48
+ run_with_info(
49
+ 'running bin/build — to setup and build the project',
50
+ )
51
+ system('bin/build setup')
52
+ puts '[OK]'.bold.green
41
53
  end
42
54
  end
43
55
  end
44
56
 
57
+ def run_with_info(message, command = nil)
58
+ info("\n" + message.cyan)
59
+ return unless command
60
+ o, e, s = run_system_command(command)
61
+ ok_indent = ' ✔ '.green
62
+ err_indent = ' x '.red
63
+ info(ok_indent + o.chomp.gsub(/\n/, "\n#{ok_indent}").blue) if o && o.chomp != ''
64
+ warn(err_indent + +e.chomp.gsub(/\n/, "\n#{err_indent}").red) if e && e.chomp != ''
65
+ end
66
+
45
67
  def additional_info
46
- "Generating project #{project_name.bold.green} into #{workspace.bold.yellow}..."
68
+ "\nGenerating project #{project_name.bold.green}\nDestination: #{workspace.bold.yellow}\n"
47
69
  end
48
70
 
49
71
  private
50
72
 
51
73
  def rename_files!
74
+ FileUtils.mv('README.md', 'README-Arli-CMake.md')
52
75
  Dir.chdir('src') do
53
76
  FileUtils.mv('MyProject.cpp', "#{project_name}.cpp")
54
77
  run_system_command "sed -i 's/MyProject/#{project_name}/g' CMakeLists.txt"
55
78
  end
79
+ run_system_command "sed -i 's/MyProject/#{project_name}/g' CMakeLists.txt"
56
80
  end
57
81
 
58
82
  def configure_template!
59
83
  File.open('README.md', 'w') do |f|
60
84
  f.write <<-EOF
85
+
86
+
87
+ > This project has been auto-generated using:
88
+ >
89
+ > * [arli](https://github.com/kigster/arli) Arduino toolkit, and using the `generate` command. Thank you for using Arli!
90
+ >
91
+ > * [arli-cmake](https://github.com/kigster/arli-cmake) is the template project that was used as a source for this one.
92
+ >
93
+ > * [arduino-cmake](https://github.com/arduino-cmake/arduino-cmake) is the CMake-based build system for Arduino projects.
94
+ >
95
+ > There is a discussion board for Arli/CMake-based projects. Please join if you have any questions or suggestions!
96
+ > [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/arduino-cmake-arli/)
97
+
61
98
 
62
99
  # #{project_name}
63
100
 
64
- Please refer to the README for the template project, available here:
65
- [arli-cmake](#{template_repo}).
101
+ **TODO: Please update this README to reflect information about you project. :)**
102
+
103
+ ## Prerequisites
104
+
105
+ * On a Mac, you always need to run `xcode-select --install` before you can do any development. You must have `git` installed;
106
+
107
+ * Requires [CMake](https://cmake.org/download/)
66
108
 
67
- ## Usage
109
+ * Requires [Arduino IDE](https://www.arduino.cc/en/Main/Software) or an SDK, either for [Mac](https://downloads.arduino.cc/arduino-1.8.5-macosx.zip) or [Linux](https://downloads.arduino.cc/arduino-1.8.5-linux.zip) installed;
68
110
 
69
- Let's cd into the project folder:
111
+ * Requires ruby, 2.3 or 2.4+ installed. On a Mac's Terminal, run `ruby --version`. If for some reason you don't have it installed, the `bin/setup` script will prompt you to install it.
112
+
113
+ ## Building #{project_name}
114
+
115
+ ### Using the BASH Helper `bin/build`
116
+
117
+ This project contains a BASH script that can automate your setup and build process. The following script takes care of most dependencies, including a missing Ruby.
70
118
 
71
119
  ```bash
72
- cd #{project_name}
120
+ $ cd ~/workspace/#{project_name}
121
+ $ bin/build [ setup | clean | make-flags ]
73
122
  ```
74
123
 
75
- The directory structure should look as follows:
124
+ You should see a bunch of output, and upon completion, run `arli` without arguments to see if the command got installed and shows you proper help message. If you get `command not found`, please `[sudo] gem install arli --no-ri --no-rdoc`. Add sudo if your ruby installation is the system one, ie, `which ruby` returns `/usr/bin/ruby`.
125
+
126
+
127
+ ### Manual Build
128
+
129
+ If you prefer to have more control over the build, you can of course build manually,
130
+ and manage `CMakeLists.txt` however you want.
76
131
 
132
+ Once you've run the setup, the manual build is:
133
+
134
+ ```bash
135
+ $ cd ~/workspace/#{project_name}
136
+ $ rm -rf build && mkdir -p build && cd build
137
+ $ cmake ..
138
+ $ make # this builds the image
139
+ $ make upload # this uploads it to the device
140
+ $ # this next command opens a serial port monitor inside a screen session
141
+ $ make #{project_name}-serial
77
142
  ```
78
- #{project_name}
79
- |
80
- |__ bin/
81
- | |___ setup
82
- | |___ build
83
- |
84
- |__ cmake/
85
- | |___ Arli.cmake
86
- | |___ ArduinoToolchain.cmake <———— provided by arduino-cmake project
87
- | |___ Platform/ <———— provided by arduino-cmake project
88
- |
89
- |__ src/
90
- | |___ Arlifile
91
- | |___ CMakeLists.txt
92
- | |___ #{project_name}.cpp
93
- |
94
- |__ example/
95
- |___ Arlifile
96
- |___ CMakeLists.txt
97
- |___ Adafruit7SDisplay.cpp
143
+
144
+ #### Customizing the Build
145
+
146
+ You can use environment variables to set the board, CPU and the port. Simply prefix the following variables before you run `cmake ..`
147
+
148
+ ```bash
149
+ $ rm -rf build
150
+ $ mkdir -p build
151
+ $ cd build
152
+ $ BOARD_NAME=nano \\
153
+ BOARD_CPU=atmega328p \\
154
+ BOARD_DEVICE=/dev/tty.usbserial-DA00WXFY \\
155
+ cmake ..
98
156
  ```
99
157
 
100
- You might need to run `bin/setup` first to ensure you have all the dependencies.
158
+ ### Adding External Libraries
101
159
 
102
- Once you do that, you can build any of the source folders (i.e. either `src` or `example`) by
103
- running `bin/build src` or `bin/build example`.
160
+ Your repo contains `Arlifile` inside the `src` folder. Please [read the documentation](https://github.com/kigster/arli#command-bundle) about the format of `Arlifile`.
104
161
 
105
- ### Building Manually
162
+ Go ahead and edit that file, and under `dependencies:` you want to list all of your libraries by their exact name, and an optional version.
106
163
 
107
- The process to build and upload manually is super simple too:
164
+ The best way to do that is to **first search for the library** using the `arli search terms` command. Once you find the library you want, just copy it's name as is into `Arlifile`. If it contains spaces, put quotes around it.
108
165
 
109
- ```bash
110
- cd src
111
- rm -rf build && mkdir build && cd build
112
- cmake ..
113
- make
114
- make upload
166
+ If the library is not in the official database, just add it with a name and a url. Arli will use the url field to fetch it.
167
+
168
+ To verify that your Arlifile can resolve all libraries, please run `arli bundle` inside the `src` folder. If Arli suceeds, you've got it right, and the `libraries` folder inside `src` should contain all referenced libraries.
169
+
170
+ ### Adding Source Files
171
+
172
+ You will notice that inside `src/CMakeLists.txt` file, there is a line:
173
+
174
+ ```cmake
175
+ set(PROJECT_SOURCES #{project_name}.cpp)
176
+ ```
177
+
178
+ If you add any additional source files or headers, just add their names right after, separated by spaces or newlines. For example:
179
+
180
+ ```cmake
181
+ set(PROJECT_SOURCES
182
+ #{project_name}.cpp
183
+ #{project_name}.h
184
+ helpers/Loader.cpp
185
+ helpers/Loader.h
186
+ config/Configuration.h
187
+ )
115
188
  ```
116
189
 
190
+ The should be all you need to do add custom logic and to rebuild and upload the project.
191
+
192
+ ## Where to get Support?
193
+
194
+ Please feel free to file bug reports and submit pull requests on GitHub — [https://github.com/kigster/arli-cmake](https://github.com/kigster/arli-cmake) is the project URL, and this is the [issues](https://github.com/kigster/arli-cmake/issues) URL.
195
+
196
+ ## License
197
+
198
+ The original project is distributed as open source, under the terms of the [MIT License](http://opensource.org/licenses/MIT).
199
+
200
+ However, feel free to change the license of your project, as long as you provide the credit to the original.
201
+
202
+ Thanks!
203
+ Good luck!
204
+
205
+
117
206
  EOF
118
207
  end
119
208
  end
@@ -37,6 +37,7 @@ module Arli
37
37
  o, e, s = Open3.capture3(cmd)
38
38
  info("\n" + o) if o if Arli.debug?
39
39
  info("\n" + e.red) if e && Arli.debug?
40
+ return o, e, s
40
41
  rescue Exception => e
41
42
  error "Error running [#{args.join(' ')}]\n" +
42
43
  "Current folder is [#{Dir.pwd.yellow}]", e
@@ -3,9 +3,18 @@
3
3
  # © 2017 Konstantin Gredeskoul
4
4
  # Distributed under MIT license.
5
5
  #
6
- # This file is auto-generated by the Arli library manager
7
- # which works in tandem with another projects — "arduino-cmake",
8
- # and "arli-cmake".
6
+ # NOTE: This file has been auto-generated by the Arli library manager
7
+ # which integrates with another project `arduino-cmake`. If you are
8
+ # curious as to how you can build complex Arduino Projects using Arli,
9
+ # we suggest that you run the following commands to explore Arli:
10
+ #
11
+ # arli generate MyTestProject --workspace ~/workspace
12
+ # cd ~/workspace/MyTestProject
13
+ # bin/setup
14
+ # bin/build src
15
+ #
16
+ # And you should see a binary image built for the default board, or the
17
+ # board you specified in the Arlifile.
9
18
  #
10
19
  # For more info:
11
20
  # See https://github.com/kigster/arli
@@ -1,3 +1,3 @@
1
1
  module Arli
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-25 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino-library
@@ -256,7 +256,14 @@ files:
256
256
  - arli.gemspec
257
257
  - bin/console
258
258
  - bin/setup
259
+ - docs/arli-bundle.png
260
+ - docs/arli-cmake-build.png
261
+ - docs/arli-cmake-make-1.png
262
+ - docs/arli-cmake-make-2.png
263
+ - docs/arli-cmake-make-3.png
259
264
  - docs/arli-in-action.png
265
+ - docs/arli-search.png
266
+ - docs/arlifile-cmake.png
260
267
  - docs/arlifile.png
261
268
  - exe/arli
262
269
  - lib/arli.rb