Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the high number of ways to "start" a CouchApp with couchapp #198

Closed
BigBlueHat opened this issue Nov 13, 2015 · 3 comments
Closed
Milestone

Comments

@BigBlueHat
Copy link
Member

Right now, you can us any of the following commands each with their own unique way of doing things...

couchapp init

Directory contents:

.couchappignore  .couchapprc
couchapp startapp

🐛 Fails with error 2015-11-13 10:41:58 [ERROR] couchapp error: Can't start an app, name or path is missing, but generates the same as couchapp init above.

couchapp startapp NAME

2015-11-13 10:44:30 [INFO] c:\Users\Benjamin\Documents\GitHub\anno-mail\temp\NAME created.
Creates a NAME directory who's contents are:

.couchappignore  .couchapprc  _attachments  _id  lists  shows  updates  views
couchapp startapp . NAME

🐛 This is supposed to support passing in a COUCHAPPDIR param before NAME, but . is unsupported...apparently.

Outputs 2015-11-13 10:46:51 [INFO] NAME created. with a NAME directory (which it shouldn't do) which matches the above contents.

couchapp generate NAME

🐛 This one seems to attempt to use the current directory (if one's unspecified) rather than auto-magically creating a directory for NAME in the way that startapp does.

Outputs 2015-11-13 10:48:56 [ERROR] couchapp error: Can't create a CouchApp in c:\current\directory: Cannot create a file when that file already exists

Trying couchapp generate . NAME checks . against the options lists (which makes sense given the param list. Outputs 2015-11-13 10:50:11 [ERROR] couchapp error: Can't generate . in your couchapp. generator is unknown

🐛 This also failed...again not doing what startapp did:

$ couchapp generate app NAME
2015-11-13 10:51:32 [ERROR] couchapp error: Can't create a CouchApp in c:\current\directory: Cannot create a file when that file already exists

This worked, however.

$ couchapp generate app NAME NAME
2015-11-13 10:51:54 [INFO] NAME generated.

But the directory contents are different than startapp's:

README.md  _attachments  _id  couchapp.json  language  lists  shows  updates  vendor  views

Proposal

  • deprecate startapp
  • "upgrade" init to replace startapp and generate app
    • have it use the generate app system with the --template option
  • (possibly) deprecate generate app -- keep it focused on generating the other things
  • simplify base template for initialized app, so it matches what startapp does now--so, no jquery, no vendor, no .js, .html, or .css
@BigBlueHat
Copy link
Member Author

Here's a comparison of the 3 varied outputs we have now.

|~generate-app/
| |~_attachments/
| | |~script/
| | | `-app.js
| | |~style/
| | | `-main.css
| | `-index.html
| |~lists/
| |~shows/
| |~updates/
| |~vendor/
| | `~couchapp/
| |   |~_attachments/
| |   | |-jquery.couch.app.js
| |   | |-jquery.couch.app.util.js
| |   | |-jquery.couchForm.js
| |   | |-jquery.couchLogin.js
| |   | |-jquery.couchProfile.js
| |   | |-jquery.mustache.js
| |   | `-md5.js
| |   `-metadata.json
| |~views/
| | `~recent-items/
| |   `-map.js
| |-_id
| |-couchapp.json
| |-language
| |-README.md
  • lots of "extra" stuff
  • lacks .couchapprc and .couchappignore
|~init/
  |~.couchappignore
  |~.couchapprc
  • has only the two things generate app is missing
`~startapp/
  |~.couchappignore
  |~.couchapprc
  |~_attachments/
  |~lists/
  |~shows/
  |~updates/
  |~views/
  `-_id
  • more "ideal" start point--just a stub of what you actually need to begin building a CouchApp

This last bit is what I think we should keep:

  • rename it to couchapp init (from startapp)
  • make it avoid existing files and directories with matching names
  • make it work on a subdirectory: couchpp init new-app currently fails with directory does not exist error

@iblislin
Copy link
Collaborator

Hmmm.. I think we should redefine the goal of generate app --template. I cannot determine the difference between clone.

If generate app means doing cloning really, I will agree to deprecate it, and extend the ability of clone.

@iblislin
Copy link
Collaborator

iblislin commented Feb 4, 2016

@BigBlueHat Hmm... I re-read your post again and dug into our codebase.

I think the original design is we provide different level of starting a couchapp.

original design says that:

  • init for creating the essential element for a couchapp
  • startapp: i need a skeleton (also, it's an alias of $ couchapp generate startapp)
  • generate app: i need a boilerplate! I'm familiar to work with my favorite (custom) vendor

So the stuff get more and more from init to gen app.

It's time to decide that do we need to support 3 level of init?
If yes, we can integrate them into init. Maybe make init accept more options.
if no, we can implement your proposal -- rename startapp to init and make it better.

iblislin added a commit to iblislin/couchapp that referenced this issue Mar 7, 2016
- add docstring
- setup app dir via `util.setup_dir`

ref couchapp#198
iblislin added a commit to iblislin/couchapp that referenced this issue Mar 7, 2016
- setup app dir via `util.setup_dir`

ref couchapp#198
iblislin added a commit to iblislin/couchapp that referenced this issue Mar 7, 2016
Different level of 'init':
1. default
2. empty
3. template

1. level 'default', this will invoke `couchapp.generator.init_basic`
  $ couchapp init dir
    dir/
      .couchapprc
      .couchappignore
      _attachments/
      lists/
      shows/
      updates/
      views/

2. level 'empty'
  $ couchapp init -e dir
    dir/
      .couchapprc
      .couchappignore

3. level 'template', invoke `couchapp.generator.init_template`
  $ couchapp init -t mytemplate dir
    dir/
      .couchapprc
      .couchappignore
      ...
      vendors
      ...

ref couchapp#198
iblislin added a commit to iblislin/couchapp that referenced this issue Apr 3, 2016
@iblislin iblislin added this to the 1.1.0 milestone Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants