Skip to content

Commit

Permalink
Merge pull request #106 from USGS-WiM/staging
Browse files Browse the repository at this point in the history
Update readme, remove rest of bower references
  • Loading branch information
marsmith authored Mar 3, 2017
2 parents 2c09233 + cddde02 commit bae4469
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 70 deletions.
91 changes: 43 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,66 @@
# generator-wim

> [Yeoman](http://yeoman.io) generator for scaffolding html5/javascript web mappinng apps. Allows for use of [ESRI](https://developers.arcgis.com/javascript/) or [Leaflet](http://leafletjs.com/) as the mapping API. It uses bower for dependency injection and gulp as its task runner.
> [Yeoman](http://yeoman.io) generator for scaffolding html5/javascript web mappinng apps. Allows for use of [ESRI](https://developers.arcgis.com/javascript/) or [Leaflet](http://leafletjs.com/) as the mapping API. It uses npm for dependency injection and gulp as its task runner.

## Getting Started

##### 1. Fork this repo to your personal github account

##### 2. Clone the repo from your personal github account to your computer

## Generator Setup
## Generator installation

#### 1. Install required software (see Getting Started above before proceeding)
[node.js](http://nodejs.org)
[github for windows](https://windows.github.com/) (only required if GUI is preferred, otherwise can use command line)
[git](https://windows.github.com/)

#### 2. Install generator global dependencies
This will install the following packages to your "C:\Users\%user%\AppData\Roaming\npm\node_modules" folder. This can be done from any command prompt
#### 2. Install yeoman
This will install the following packages globally (to your "C:\Users\%user%\AppData\Roaming\npm\node_modules" folder.) This can be done from any command prompt

```bash
npm install -g yo bower gulp
npm install -g yo
```

If you receive this error: 'npm' is not recognized as internal or external command, operable program or batch file, consult [this article](http://stackoverflow.com/questions/20992723/npm-is-not-recognized-as-internal-or-external-command-operable-program-or-bat).
#### 3. Clone 'generator-wim' repo
Create a local copy of the generator

The suggestion in the article to remove the trailing slash from the PATH for node.js has worked before.
```bash
git clone https://github.com/USGS-WiM/generator-wim.git
```

#### 3. Create symbolic link for generator-wim inside the generator-wim folder
#### 4. Create symbolic link for generator-wim inside the generator-wim folder
This 'tricks' node into thinking your generator-wim is a globally installed node module in this location: "C:\Users\%user%\AppData\Roaming\npm\node_modules"

```bash
cd generator-wim
npm link
```

#### 4. Run the generator
#### 5. Run the generator to create a new app
Create a new folder for the generated app and run the generator

```bash
md generator-wim-dev
cd generator-wim-dev
yo wim
```

## Updating the generator source and dependencies

#### 1. Get latest code from github
```bash
cd generator-wim
git pull origin master
```
#### 2. Update dependencies
```bash
npm update
```

---
## Editing the generator itself
The process described below is for making edits to the actual generator code, i.e. the source from which all generated apps will be generated. Exercise caution, as these edits will affect all future generations.

###1. Ensure that your local repo of generator-wim is up-to-date
run a pull from the upstream at your local repo directory to retrieve latest from the org repo at [USGS-WiM/generator-wim](https://github.com/USGS-WiM/generator-wim).
```bash
git pull upstream master
cd generator-wim
git pull origin master
```

If you have conflicts after you pull the latest code, it is recommended to install and configure a windows mergetool for git. [p4merge](http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools) seems to work OK. [Here is some help](http://www.perforce.com/perforce/doc.current/manuals/p4v/merging_files.html) on using it to compare diffs from git. The commands to set it up with git:
Expand All @@ -73,11 +84,10 @@ in your generator dev directory, run the yeoman command with the alias for the w
```bash
yo wim
```
follow the prompts, and eventually you will have app code in your dev directory, whose contents now look like this:
follow the prompts, and eventually you will have app code in your dev directory, whose contents should now contain the follwoing files:
```bash
bower.json gulpfile.js node_modules package.json src
node_modules src .gitignore .jshintrc gulpfile.js package.json
```
(plus a few other tiny 1kb config files).

###3. Develop
**You can now make edits and do development on the files in the src directory.** When ready to test, run the gulp watch command to view the app in the browser using a lightweight node-js webserver environment.
Expand All @@ -93,33 +103,18 @@ gulp
```
This will create a build folder including minified and combined dependency libraries. Open the app from the build folder as a final test of your changes.

###5. Copy your changes back to the generator-wim repo
Copy content from your edited files into their counterparts in the local generator-wim repo. Files are located at `generator-wim/app/templates` and can be identified by the leading underscore in their names. E.g. "_index.html", "_core.js" and "_main.css"

###6. Commit changes, push to personal repo, submit pull request to USGS-WiM repo, and merge changes

---







## Some links for learning more about generator
####*please add more here as found*

**yeoman**
http://yeoman.io/authoring/
http://yeoman.io/codelab.html
this is the original post i read that got me thinking: https://csessig.wordpress.com/category/yeoman/

**gulp**
http://danhulton.com/2014/03/gulp-js-an-amazing-build-system/
http://ericlbarnes.com/setting-gulp-bower-bootstrap-sass-fontawesome/
###5. Create a new branch in 'generator-wim'
Create a new branch of the cloned repo that will contain your changes
```bash
git checkout -b 'branch-name'
```

**npm**
http://browsenpm.org/package.json
###6. Copy changes from test instance back to the generator-wim repo
Copy content from your edited files into their counterparts in the local generator-wim repo. Files are located at `generator-wim/app/templates` and can be identified by the leading underscore in their names. E.g. "_index.html", "_core.js" and "_main.css"

**bower**
http://bower.io/docs/creating-packages/
###7. Submit new branch back to USGS-WiM 'generator-wim' repo
```bash
git add .
git commit -m 'message describing your updates'
git push origin 'new_branch_name'
```
9 changes: 4 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ var WiMGenerator = class extends yeoman {
else {
this.appName = this.options.appName;
this.mappingAPI = this.options.mappingAPI;
this.log(chalk.blue('You chose the application name:'), chalk.red(this.appName));
this.log(chalk.blue('You chose the mapping API:'), chalk.red(this.mappingAPI));
}

this.log(chalk.blue('You chose the application name:'), chalk.red(this.appName));
this.log(chalk.blue('You chose the mapping API:'), chalk.red(this.mappingAPI));
}

writing() {
Expand All @@ -102,8 +101,8 @@ var WiMGenerator = class extends yeoman {
//just copy these files over and rename
this.fs.copy(this.templatePath('_main.css'), this.destinationPath('src/styles/main.css'));
this.fs.copy(this.templatePath('images/'), this.destinationPath('src/images/'));
this.fs.copy(this.templatePath('gitignore'), this.destinationPath('.gitignore'));
this.fs.copy(this.templatePath('jshintrc'), this.destinationPath('.jshintrc'));
this.fs.copy(this.templatePath('_.gitignore'), this.destinationPath('.gitignore'));
this.fs.copy(this.templatePath('_.jshintrc'), this.destinationPath('.jshintrc'));

//copyTpl is used for copying files with template variables passed in
this.fs.copyTpl(this.templatePath('_index.html'), this.destinationPath('src/index.html'), this.appConfig);
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions app/templates/bowerrc

This file was deleted.

13 changes: 0 additions & 13 deletions app/templates/editorconfig

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"mocha": "*",
"underscore.string": "^3.3.4"
},
"readme": "# generator-wim [![Build Status] \n\n [Yeoman](http://yeoman.io) generator\n\n\n## Getting Started\n\n### What is Yeoman?\n\nTrick question. It's not a thing. It's this guy:\n\n![](http://i.imgur.com/JHaAlBJ.png)\n\nBasically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.\n\nNot every new computer comes with a Yeoman pre-installed. He lives in the [npm](https://npmjs.org) package repository. You only have to ask for him once, then he packs up and moves into your hard drive. *Make sure you clean up, he likes new and shiny things.*\n\n```bash\nnpm install -g yo\n```\n\n### Yeoman Generators\n\nYeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.\n\nTo install generator-wim from npm, run:\n\n```bash\nnpm install -g generator-wim\n```\n\nFinally, initiate the generator:\n\n```bash\nyo wim\n```\n\n### Getting To Know Yeoman\n\nYeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.\n\nIf you'd like to get to know Yeoman better and meet some of his friends, [Grunt](http://gruntjs.com) and [Bower](http://bower.io), check out the complete [Getting Started Guide](https://github.com/yeoman/yeoman/wiki/Getting-Started).\n\n\n## License\n\nMIT\n",
"readmeFilename": "README.md",
"gitHead": "d956bb50b852112ade66cf0b0afe5a1112ef0b66",
"bugs": {
Expand Down

0 comments on commit bae4469

Please sign in to comment.