Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Birk authored and arnaudbirk committed Dec 12, 2022
1 parent 1217cb6 commit 2e584e5
Showing 1 changed file with 40 additions and 26 deletions.
66 changes: 40 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,56 @@ Vous pouvez la télécharger depuis les dépôts officiels de [PyPI](https://pyp

## Exemple d'utilisation

from gpao.builder import Builder
from gpao.project import Project
from gpao.job import Job
``` python
from gpao.builder import Builder
from gpao.project import Project
from gpao.job import Job

job1 = Job("job1", "touch file", tags=["tag1", "tag2"])
job2 = Job("job2", "touch file")
job3 = Job("job3", "touch file", job1, tags=["tag1", "tag2"])
job3.add_dependency(job2)
job1 = Job("job1", "touch file", tags=["tag1", "tag2"])
job2 = Job("job2", "touch file")
job3 = Job("job3", "touch file", job1, tags=["tag1", "tag2"])
job3.add_dependency(job2)

# print(job1.to_json())
# print(job2.to_json())
# print(job3.to_json())
# print(job1.to_json())
# print(job2.to_json())
# print(job3.to_json())

project1 = Project("project1", [job1, job2, job3])
# print(project1.to_json())
project1 = Project("project1", [job1, job2, job3])
# print(project1.to_json())

job4 = Job("job4", "touch file")
job5 = Job("job5", "touch file")
job5.add_dependency(job4)
job4 = Job("job4", "touch file")
job5 = Job("job5", "touch file")
job5.add_dependency(job4)

project2 = Project("project2", [job4, job5])
project2 = Project("project2", [job4, job5])

#print(project2.to_json())
# print(project2.to_json())

job6 = Job("job6", "touch file")
job7 = Job("job7", "touch file", job6)
project3 = Project("project3", [job6, job7], [project1, project2])
job6 = Job("job6", "touch file")
job7 = Job("job7", "touch file", job6)
project3 = Project("project3", [job6, job7], [project1, project2])

#print(project3.to_json())
# print(project3.to_json())

builder = Builder([project1, project2])
builder.add_project(project3)
builder = Builder([project1, project2])
builder.add_project(project3)

builder.save_as_json("project.json")
builder.save_as_json("project.json")


job8 = Job("job8", "touch file")
job8bis = Job("job8bis", "touch file", job8)
project4 = Project("project4", [job8, job8bis])

job9 = Job("job9", "touch file")
project5 = Project("project5", [job9], [project4])

builder = Builder([project4, project5])

builder.send_project_to_api("http://localhost:8080")
```

Cet exemple sauvegarde un fichier `project.json` avec le contenu suivant :
Cet exemple sauvegarde un fichier `project.json` avec le contenu suivant :

```
{
Expand Down Expand Up @@ -134,7 +148,7 @@ Cet exemple sauvegarde un fichier `project.json` avec le contenu suivant :
]
}
```

### Licence

Ce projet est sous licence CECILL-B (voir [LICENSE.md](https://github.com/ign-gpao/.github/blob/main/LICENSE.md)).
Expand Down

0 comments on commit 2e584e5

Please sign in to comment.