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

[cli] generate command to create scaffolding #682

Merged
merged 3 commits into from
May 9, 2018
Merged

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Apr 26, 2018

The idea is to replace the need to copy-paste with scaffolding.

$ bin/apicast generate policy somename -f
source: /Users/mikz/Developer/3scale/apicast/examples/scaffold/policy
destination: /Users/mikz/Developer/3scale/apicast

created: spec
created: spec/policy
created: spec/policy/somename
created: spec/policy/somename/somename_spec.lua
created: t
created: t/apicast-policy-somename.t
created: gateway
created: gateway/src
created: gateway/src/apicast
created: gateway/src/apicast/policy
created: gateway/src/apicast/policy/somename
created: gateway/src/apicast/policy/somename/apicast-policy.json
created: gateway/src/apicast/policy/somename/init.lua
created: gateway/src/apicast/policy/somename/somename.lua

@mikz mikz force-pushed the policy-scaffolding branch 2 times, most recently from 75403a1 to db335a5 Compare May 1, 2018 11:18
-- This is a {{ policy.name }} description.

local policy = require('apicast.policy')
local _M = policy.new('{{ policy.summary }}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be policy.name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. It should be some human name.

@@ -1,4 +1,4 @@
argparse 0.5.0-1||production
argparse 0.6.0-1||production
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the new version for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No good reason. rover is not so smart about releasing locked versions.


local directory = function(dir) if pl.path.dir(dir) then return pl.path.abspath(dir) end end

return function(parser)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the option for summary is missing.


function _M.copy(source, destination, env, force)
print('source: ', source)
print('destinatioon: ', destination)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@davidor
Copy link
Contributor

davidor commented May 7, 2018

Looks good 👍
We needed something like this.

Can you mention this option somewhere in the policies.md doc?

@mikz mikz force-pushed the policy-scaffolding branch from db335a5 to 897dd9d Compare May 9, 2018 07:42
@mikz mikz changed the title [wip] [cli] generate command to create scaffolding [cli] generate command to create scaffolding May 9, 2018
@mikz mikz force-pushed the policy-scaffolding branch from 897dd9d to e69c93d Compare May 9, 2018 07:55
@mikz mikz requested a review from davidor May 9, 2018 07:57
@mikz mikz force-pushed the policy-scaffolding branch from e69c93d to bf4dca3 Compare May 9, 2018 08:05
mikz added 2 commits May 9, 2018 13:34
* create templated files and directories to make it easier
  to create new policies, cli commands, etc.
@mikz mikz force-pushed the policy-scaffolding branch from bf4dca3 to 83e3db4 Compare May 9, 2018 11:34
@davidor davidor merged commit e7318a3 into master May 9, 2018
@davidor davidor deleted the policy-scaffolding branch May 9, 2018 14:43
@davidor davidor added this to the 3.3 milestone Jun 1, 2018
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

Successfully merging this pull request may close these issues.

2 participants