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

Create a generator #53

Closed
gdurelle opened this issue Nov 4, 2014 · 6 comments
Closed

Create a generator #53

gdurelle opened this issue Nov 4, 2014 · 6 comments

Comments

@gdurelle
Copy link

gdurelle commented Nov 4, 2014

Create a simple generator with basics configurations, default ones commented.

cuba new <projectName>

Creates:

  • A config.ru
  • The main cuba file with
    • 1 method and its route to show the simple text renderer.
    • 1 method, its view and route to show the view renderer.

That's it.

It keeps it small and speed up the dev process when using cuba for most use cases.

@djanowski
Copy link
Collaborator

You may be interested in https://github.com/lucasefe/gn by @lucasefe.

@gdurelle
Copy link
Author

gdurelle commented Nov 4, 2014

Seems cool but would add dependencies to mote and clap into cuba.
I'd prefer one in pure ruby like:

#!/usr/bin/env ruby

def cuba_setup
  <<-EOF
    class #{ARGV[1].capitalize}
        # a lot more stuff...
    end
  EOF
end

if ARGV.length == 2 && ARGV[0] == 'new'
  File.open("#{ARGV[1]}.rb", 'w+') do |file|
    file.write cuba_setup
  end
else
  puts "cuba new <projectName>"
end

Can I make a Pull request with something like that ? (with the class filed with classic cuba setup)

@soveran
Copy link
Owner

soveran commented Nov 4, 2014

Hey @gdurelle, indeed I would like to encourage you to build that tool, but as Cuba is just a library, I think it's better if it remains just that, without any code generators. But what you want could be a good and useful tool for a lot of people, and the naming could be some play with the Cuba/Rum theme. Then we could promote it independently.

@gdurelle
Copy link
Author

gdurelle commented Nov 4, 2014

I'll do that then !

@soveran
Copy link
Owner

soveran commented Nov 4, 2014

Excellent. A long time ago, in 2009, @djanowski and I wrote a similar tool for creating Sinatra apps, it was called monk, and I wouldn't write it like that today, but I'm linking to it just in case you find something interesting in those ideas :-)

@gdurelle
Copy link
Author

gdurelle commented Nov 5, 2014

Here we go :
https://github.com/gdurelle/cuba-libre
https://rubygems.org/gems/cuba-libre

My first gem ! :)
(Still have to write tests & think about Thor, but it works ;))

@frodsan frodsan closed this as completed Apr 29, 2015
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

4 participants