Skip to content

Commit d0bdf3d

Browse files
committed
Improve naming and add special README
1 parent 1de512e commit d0bdf3d

File tree

2 files changed

+79
-5
lines changed

2 files changed

+79
-5
lines changed

tools/README_new_add_on.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
Minimal add-on
3+
=================
4+
5+
### About
6+
7+
***This README has been automatically generated by the [create_new_add_on.py-script](https://github.com/OptimalBPM/angular-schema-form-add-ons/tree/master/tools)
8+
at [angular-schema-form-add-ons](https://github.com/OptimalBPM/angular-schema-form-add-ons), remove this row before publishing.***
9+
10+
This add-on presents a normal input field.
11+
12+
13+
### Installation
14+
To use the provided example, make sure npm is installed, enter the destination_folder folder, and run(Linux):
15+
16+
sudo npm install bower
17+
node_modules/bower/bin/bower install
18+
19+
This will first locally install bower, and then used that bower to install the project dependencies.
20+
21+
22+
### Running
23+
24+
You should now be able to open the example.html in the browser.
25+
26+
27+
### Building
28+
29+
First, install all build tools, in the destination_folder folder, run
30+
31+
sudo npm install
32+
33+
34+
The cycle for development is change and then build.
35+
If you want to make any changes, you should make them in the /src-files and then build, otherwise your changes
36+
will not be included in the example.
37+
38+
From the installation, gulp should be installed, so therefore, in the destination_folder folder, just run:
39+
40+
gulp default
41+
42+
This starts a build and generates destination_folder/angular-schema-form-minimal.js and destination_folder/angular-schema-form-minimal.min.js.
43+
To observe your changes, just refresh the example.html-page.

tools/create_new_add_on.py

+36-5
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,45 @@
3232

3333
_source_folder = os.path.join(script_dir, "..", "examples", "minimal")
3434

35+
36+
3537
# Copy to destination
3638
shutil.copytree(src=_source_folder, dst=_destination,
37-
ignore=ignore_patterns('bower_components', 'node_modules'))
39+
ignore=ignore_patterns('bower_components', 'node_modules', "README.md"))
40+
41+
# Add README
42+
shutil.copy(src=os.path.join(script_dir, "README_new_add_on.md"), dst=os.path.join(_destination,"README.md"))
43+
44+
# Create needed variations of the add-on name:
45+
46+
# First, the add-on name should only be word-separated by "-".
47+
_add_on_name = _add_on_name.replace(" ", "-").replace("_", "-")
48+
49+
# JS names should be camelCase:d and contain no "-"
50+
_cc_tmp = ''.join(x for x in _add_on_name.title() if x.isalpha())
51+
_camelCased_add_on_name = (_cc_tmp[0].lower() + _cc_tmp[1:]).replace("-", "")
52+
53+
# References cannot contain any "-"
54+
_references_add_on_name = _add_on_name.replace("_", "").replace("-", "")
55+
56+
# Actually replace the strings in all the files
57+
58+
# Replace all the capitalized Minimal mentions
59+
mass_replace(_destination, "Minimal", _add_on_name.capitalize())
60+
61+
# Replace all the minimalForm type references minimal mentions with camelCase:d _add_on_name
62+
mass_replace(_destination, "minimalForm", _camelCased_add_on_name + "Form")
63+
64+
# Replace all the html file references with lowercase _add_on_name
65+
mass_replace(_destination, "angular-schema-form-minimal", "angular-schema-form-" + _add_on_name.lower())
66+
67+
# Replace all the destination_folders references with lowercase _add_on_name
68+
mass_replace(_destination, "destination_folder", _add_on_name.lower())
69+
70+
71+
# Replace all the remaining lowercase(references) minimal mentions
72+
mass_replace(_destination, "minimal", _references_add_on_name.lower())
3873

39-
# Replace all the Minimal mentions
40-
mass_replace(_destination, "Minimal", _add_on_name.capitalize() )
41-
# Replace all the minimal mentions
42-
mass_replace(_destination, "minimal", _add_on_name.lower())
4374
# Replace all the Optimal BPM mentions
4475
mass_replace(_destination, "Optimal BPM", _add_on_author)
4576

0 commit comments

Comments
 (0)