Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Commit b29e16a

Browse files
author
David Dooling
committed
Remove last templates
AddRugGenerator now uses an actual generator as the origin for creating a generator. Clean up variable names a bit.
1 parent 5f5589d commit b29e16a

10 files changed

+50
-43
lines changed

.atomist/editors/AddRugExecutor.rug

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ param description: @any
4040
@validInput "free text"
4141
param bot_intent: @any
4242

43-
let executor_filename = { ".atomist/executors/" + executor_name + ".ts" }
43+
let executor_path = { ".atomist/executors/" + executor_name + ".ts" }
4444
let default_executor_name = "DefaultExecutor"
45-
let default_executor_filename = { ".atomist/executors/" + default_executor_name + ".ts" }
45+
let default_executor_path = { ".atomist/executors/" + default_executor_name + ".ts" }
4646
let default_executor_function_name = "defaultExecutor"
4747
let executor_function_name = { executor_name.charAt(0).toLowerCase() + executor_name.slice(1) }
4848
let default_bot_intent = { "tags: [\"atomist/intent=do something\"]" }
@@ -52,8 +52,8 @@ let full_description = { "description: \"" + description + "\"" }
5252

5353
with Project
5454
begin
55-
do copyEditorBackingFileOrFail default_executor_filename executor_filename
56-
with File when name = { executor_name + ".ts" }
55+
do copyEditorBackingFileOrFail default_executor_path executor_path
56+
with File when path = executor_path
5757
begin
5858
do replace default_executor_name executor_name
5959
do replace default_executor_function_name executor_function_name

.atomist/editors/AddRugGenerator.rug

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@ precondition IsRugArchive
2323

2424
@displayName "Generator Name"
2525
@description "name of the generator"
26-
@validInput "a valid Rug Editor name starting with a capital letter and containing only alphanumberic characters from one to 100 characters long"
26+
@validInput "a valid Rug Generator name starting with a capital letter and containing only alphanumeric characters, 1-100 characters"
2727
@minLength 1
2828
@maxLength 100
2929
param generator_name: ^[A-Z][A-Za-z0-9]*$
3030

31-
let sampleGeneratorTemplate = "samplegenerator.vm"
32-
let sampleGeneratorTestTemplate = "samplegeneratortest.vm"
31+
let default_generator_name = "SampleGenerator"
3332

34-
let generatorFilename = { ".atomist/editors/" + generator_name + ".rug" }
35-
let generatorTestFilename = { ".atomist/tests/" + generator_name + ".rt" }
33+
let sample_generator_path = { ".atomist/editors/" + default_generator_name + ".rug" }
34+
let sample_generator_test_path = { ".atomist/tests/" + default_generator_name + ".rt" }
3635

37-
with Project p
36+
let generator_path = { ".atomist/editors/" + generator_name + ".rug" }
37+
let generator_test_path = { ".atomist/tests/" + generator_name + ".rt" }
38+
39+
with Project
3840
begin
39-
do merge sampleGeneratorTemplate to generatorFilename
40-
do merge sampleGeneratorTestTemplate to generatorTestFilename
41+
do copyEditorBackingFileOrFail sample_generator_path generator_path
42+
do copyEditorBackingFileOrFail sample_generator_test_path generator_test_path
43+
with File when path = generator_path
44+
do replace default_generator_name generator_name
45+
with File when path = generator_test_path
46+
do replace default_generator_name generator_name
4147
end

.atomist/templates/samplegenerator.vm renamed to .atomist/editors/SampleGenerator.rug

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
@description "generate a copy of this project"
22
@tag "rug"
3-
@generator
4-
editor $generator_name
3+
generator SampleGenerator
54

65
@displayName "Project Name"
76
@description "name of your new project"
8-
@validInput "a valid GitHub repo name containing only alphanumeric, ., -, and _ characters and 21 characters or less to avoid Slack truncating the name when creating a channel for the repo"
7+
@validInput "a valid GitHub repo name containing only alphanumeric, ., -, and _ characters"
98
@minLength 1
10-
@maxLength 21
9+
@maxLength 100
1110
param project_name: @project_name
1211

1312
with Project

.atomist/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group: atomist-rugs
22
artifact: rug-editors
3-
version: "0.7.0"
3+
version: "0.8.0"
44
requires: "[0.11.0,1.0.0)"
55
dependencies:
66
- "atomist-rugs:rug-archive:0.11.0"

.atomist/templates/samplegeneratortest.vm

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

.atomist/templates/sampletemplatetemplate.vm

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

.atomist/tests/AddRugGenerator.rt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ when
3333

3434
then
3535
fileExists ".atomist/editors/MyNewGenerator.rug"
36-
and fileContains ".atomist/editors/MyNewGenerator.rug" "param project_name: @project_name"
37-
and fileContains ".atomist/editors/MyNewGenerator.rug" "editor MyNewGenerator"
36+
and fileContains ".atomist/editors/MyNewGenerator.rug" "generator MyNewGenerator"
37+
and { !result.fileContains(".atomist/editors/MyNewGenerator.rug", "SampleGenerator") }
3838
and fileExists ".atomist/tests/MyNewGenerator.rt"
3939
and fileContains ".atomist/tests/MyNewGenerator.rt" "scenario MyNewGenerator"
40+
and { !result.fileContains(".atomist/tests/MyNewGenerator.rt", "SampleGenerator") }
4041

4142

4243
scenario AddRugGenerator should fail if not a Rug Archive project

.atomist/tests/ConvertExistingProjectToRugArchiveWithGenerator.rt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ then
3434
and fileContains ".atomist/manifest.yml" "0.0.1"
3535
and fileExists ".atomist/editors/DefaultGenerator.rug"
3636
and fileContains ".atomist/editors/DefaultGenerator.rug" "param project_name: @project_name"
37-
and fileContains ".atomist/editors/DefaultGenerator.rug" "editor DefaultGenerator"
37+
and fileContains ".atomist/editors/DefaultGenerator.rug" "generator DefaultGenerator"
3838
and fileExists ".atomist/tests/DefaultGenerator.rt"
3939
and fileContains ".atomist/tests/DefaultGenerator.rt" "scenario DefaultGenerator"
4040

@@ -59,7 +59,7 @@ then
5959
and fileContains ".atomist/manifest.yml" "0.0.1"
6060
and fileContains ".atomist/editors/NewSpringCloudConfigServer.rug" "param project_name: @project_name"
6161
and fileExists ".atomist/editors/NewSpringCloudConfigServer.rug"
62-
and fileContains ".atomist/editors/NewSpringCloudConfigServer.rug" "editor NewSpringCloudConfigServer"
62+
and fileContains ".atomist/editors/NewSpringCloudConfigServer.rug" "generator NewSpringCloudConfigServer"
6363
and fileExists ".atomist/tests/NewSpringCloudConfigServer.rt"
6464
and fileContains ".atomist/tests/NewSpringCloudConfigServer.rt" "scenario NewSpringCloudConfigServer"
6565

.atomist/tests/SampleGenerator.rt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
scenario SampleGenerator should create a new project based on this archive
2+
3+
let project_name = "my-project-name"
4+
5+
given
6+
Empty
7+
8+
when
9+
SampleGenerator
10+
11+
then
12+
fileExists ".atomist.yml"

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
[Unreleased]: https://github.com/atomist-rugs/rug-editors/compare/0.7.0...HEAD
10+
[Unreleased]: https://github.com/atomist-rugs/rug-editors/compare/0.8.0...HEAD
11+
12+
## [0.8.0]
13+
14+
[0.8.0]: https://github.com/atomist-rugs/rug-editors/compare/0.7.0...0.8.0
15+
16+
Templates are bad, mkay release
17+
18+
### Changed
19+
20+
- Use real generator as basis for AddRugGenerator
1121

1222
## [0.7.0]
1323

0 commit comments

Comments
 (0)