Skip to content

Commit 41e2b8e

Browse files
committed
Apply role-restructuring to Nmag and Magpar examples roles.
1 parent 9b038f6 commit 41e2b8e

File tree

12 files changed

+49
-95
lines changed

12 files changed

+49
-95
lines changed
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
dependencies:
3-
- { role: magpar }
3+
- { role: magpar }
4+
- { role: rst_to_html, BUILD_DIR: "{{ EXAMPLES_DOC_FOLDER }}", SOURCE_PATH: "{{ EXAMPLES_RST_FILE }}", BUILD_NAME: "{{ EXAMPLES_OUTPUT_NAME }}" }

roles/magpar_examples/tasks/build_documentation.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

roles/magpar_examples/tasks/magpar_examples.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

roles/magpar_examples/tasks/main.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,40 @@
22
# This Ansible role prepares Magpar examples and places some documentation on
33
# the Desktop.
44

5-
- include: magpar_examples.yml
6-
- include: build_documentation.yml
5+
- name: Download magpar examples tarball.
6+
get_url:
7+
url={{ MAGPAR_EXAMPLES_URL }}
8+
dest={{ EXAMPLES_FOLDER }}/{{ MAGPAR_EXAMPLES_TARBALL }}
9+
sudo: yes
10+
11+
- name: Extract magpar examples.
12+
unarchive:
13+
copy=no
14+
src={{ EXAMPLES_FOLDER }}/{{ MAGPAR_EXAMPLES_TARBALL }}
15+
dest={{ EXAMPLES_FOLDER }}
16+
creates={{ MAGPAR_EXAMPLES_FOLDER }}/sphere_demag/run
17+
sudo: yes
18+
19+
- name: Get the path for each magpar example.
20+
shell: ls {{ MAGPAR_EXAMPLES_FOLDER }}/* -d
21+
register: magpar_example_directories
22+
23+
- name: Alter the magpar examples to fit this environment.
24+
replace:
25+
dest={{ item }}/run
26+
regexp="prg=\$PWD/"
27+
replace="prg="
28+
with_items: magpar_example_directories.stdout_lines
29+
sudo: yes
30+
31+
- name: Move magpar-examples to the directory of extraction for clarity.
32+
command: mv {{ MAGPAR_EXAMPLES_FOLDER }} {{ EXAMPLES_FOLDER }}
33+
creates={{ EXAMPLES_FOLDER }}/magpar-examples
34+
removes={{ MAGPAR_EXAMPLES_FOLDER }}
35+
sudo: yes
36+
37+
- name: Remove the directory produced by extraction.
38+
file:
39+
path="{{ EXAMPLES_FOLDER }}/magpar-0.9"
40+
state=absent
41+
sudo: yes

roles/magpar_examples/vars/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ EXAMPLES_FOLDER: /etc/skel
99
MAGPAR_EXAMPLES_FOLDER: "{{ EXAMPLES_FOLDER }}/magpar-0.9/magpar-examples"
1010

1111
# Name of the RST template to generate HTML examples from.
12-
EXAMPLES_RST_FILE: magpar_examples.rst
12+
EXAMPLES_RST_FILE: /vagrant/extra_resources/magpar/magpar_examples.rst
13+
EXAMPLES_OUTPUT_NAME: Magpar_examples.html
1314

1415
# Location to place the HTML documentation.
1516
EXAMPLES_DOC_FOLDER: "{{ EXAMPLES_FOLDER }}/Desktop"

roles/nmag_examples/meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
dependencies:
33
- { role: nmag }
4+
- { role: rst_to_html, BUILD_DIR: "{{ EXAMPLES_DOC_FOLDER }}", SOURCE_PATH: "{{ EXAMPLES_RST_FILE }}", BUILD_NAME: "{{ EXAMPLES_OUTPUT_NAME }}" }

roles/nmag_examples/tasks/build_documentation.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

roles/nmag_examples/tasks/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This Ansible role prepares Nmag examples and places some documentation on the
33
# Desktop.
44

5-
- include: nmag_examples.yml
6-
- include: build_documentation.yml
5+
# This following task is not very robust, but I can't think of a better way of
6+
# doing this.
7+
- name: Copy nmag examples to a more accessible location.
8+
command: cp -r /opt/nmag/nmag-0.2.1/doc/html/_downloads {{ NMAG_EXAMPLES_FOLDER }}
9+
creates={{ NMAG_EXAMPLES_FOLDER }}
10+
sudo: yes

0 commit comments

Comments
 (0)