5 ms·
Rails 4 startup template
- jph 13y agoGreat! Also see Thoughtbot Suspenders, https://github.com/thoughtbot/suspenders https://github.com/thoughtbot/suspenders It also uses Bourbon, HAML, RSpec, etc. as well as many more gems. Overall I like and recommend what Thoughtbot creates.
- dennybritz 13y agoCool, thanks. I hadn't heard of suspenders. I'll check it out (and maybe steal some of their stuff... ;))
- BrainScraps 13y agoSo, I did something similar, and I found that one of my least favorite things was going into the browser to create and link the github repo. Using the octokit gem, I automated that part. Feel free to swipe some code from my gist: https://gist.github.com/BrainScraps/5952463 https://gist.github.com/BrainScraps/5952463 Rock on.
- dennybritz 13y agoThat's great, thanks! I hate creating the github repo as well (sometimes I skip that part and just use Heroku). If you don't mind I'll copy some of your code and make creating a github repo another optional prompt.
- BrainScraps 13y agoAbsolutely! I noticed that suspenders(thoughtbot) also had that option. They used hub, which I think is a bit more intrusive than just installing the octokit gem. I'm interested to see what you come up with! :)
- nileshtrivedi 13y agoI have a starter app based on Ruby 2.0, Rails 4.0, PostgreSQL, Bootstrap and OmniAuth. Deployable on Heroku. Here is what it looks like running live: http://frozen-savannah-6000.herokuapp.com/ http://frozen-savannah-6000.herokuapp.com/
- karasinski 13y agoCare to link back to the github repository?
- veidr 13y agoI googled it: https://github.com/nileshtrivedi/rails-starter-app https://github.com/nileshtrivedi/rails-starter-app
- nileshtrivedi 13y agoOops, don't know how I missed that. Thanks :)
- sergiotapia 13y agoWhy Haml instead of Slim?
- nahname 13y agoWhy Haml at all? You will be changing all of your html in a browser anyways. Why not write html/erb?
- dennybritz 13y agoI know this would become a debate, haha. HAML has definitely disadvantages, ERB is indeed nicer if you need to write a lot of nested tags, or stuff like strong, small, etc. Still I've found it's more pleasant to work with... But that's just personal taste and I should probably make it optional.
- nahname 13y agoCoffeescript is really nice, though it can sometimes be a pain to debug. Haml is more succinct than HTML and I like the forced tab alignment. The problem is I almost never write view code that does not need to immediately be debugged in the browser. So I have to pay a mental tax to transform it nearly every time I write it.
- aaronbrethorst 13y agoYou can mix them. %p Here is a Haml paragraph with a <strong>bold</strong> word.
- te_chris 13y agoPersonal preference, but I find haml infinitely more productive and easier to manage.
- fphilipe 13y agoIn my opinion Slim is superior to Haml. I used to love Haml, but Slim takes it to the next level. A syntax with less control characters and a higher performance [1] made me switch. I still haven't heard a single argument for writing pure HTML instead of Haml/Slim. Even for static HTML I use Slim. [1] https://travis-ci.org/slim-template/slim/jobs/9676072 https://travis-ci.org/slim-template/slim/jobs/9676072
- nahname 13y ago> Remove the require_tree directives from the sass and JS files. It's better design to import or require things manually. I'm sorry, what?
- beefsack 13y agoPersonal taste I guess, I'm always happy to specify my requires manually so I have a better idea and more control over what's going on, makes things more obvious for other developers reading your code too.
- nahname 13y agoYou know you can require another file at the top and the asset pipeline will ensure it is loaded first right?
- dennybritz 13y agoYeah, personal choice, but I've had a lot of problems with rails "require_tree" in the past. Some gems add files to your code that shouldn't be required. ActiveAdmin is an example of that (though I think they've fixed that lately). To clarify, this is not about the "require" directives, only the "require_tree"
- nahname 13y agoThat sounds like an issue with the gems and not using require_tree
- dennybritz 13y agoYeah, but IMHO it's a lot cleaner if you actually know what's included instead of having 30 files in a kind of random order in there.
- nahname 13y agoYou can view the files in the html script includes while in development mode. It just feels wrong to me to do this manually. I have written the infrastructure code to handle javascript minification and compression. Not having to manage a script order file is one of the best parts of the asset pipeline.
- shadeless 13y agoNo guard or similar? Do you run tests and reload pages manually or use something else?
- dennybritz 13y agoYeah, I usually use guard. Indeed, I forgot to put that in there. Thanks for noticing!
- random42 13y agoIs something similar available for django projects?
- amarsahinovic 13y agoThere are plenty of Django project templates: https://github.com/rdegges/django-skel https://github.com/rdegges/django-skel https://github.com/twoscoops/django-twoscoops-project https://github.com/twoscoops/django-twoscoops-project https://github.com/amarsahinovic/django-project-template https://github.com/amarsahinovic/django-project-template (my version, feedback welcome)
- vysakh0 13y agoNice template, looks like an opinionated one . I see you have used ".env" file. I read somewhere when opensourcing apps its better to have all the env variables in .env, instead of using gem like https://github.com/laserlemon/figaro https://github.com/laserlemon/figaro. Also there is rails_composer https://github.com/RailsApps/rails-composer/ https://github.com/RailsApps/rails-composer/ with many options to select css framework, servers, testing tools.
- rschmitty 13y agoFor development I have become cracked out on these for all of my apps group :development do gem 'better_errors' #literally what it says gem 'binding_of_caller' #adds REPL to better_errors gem 'quiet_assets' #prevent asset pipeline log doesnt go to console gem 'guard-livereload' #adds live reload gem 'rack-livereload' gem 'meta_request' #chrome rails panel extension end
- dennybritz 13y agoAh, I like better_errors as well. I will probably add that! I think quiet_assets is no longer necessary, you can just change that in the config file. I don't know the other, but will take a look at them! Thanks!
- ericb 13y agoI wrote a gem, exception_details, that captures variable values at exception time. It gets you some pry-ish type detail, but you can use it on background jobs, etc. Might be useful for your toolbox... https://github.com/ericbeland/exception_details https://github.com/ericbeland/exception_details
- rschmitty 13y agoOh cool thanks! Been in such a habit i never noticed: config.assets.logger = false
- fphilipe 13y agoI just love GitHub. Followed the link, noticed that certain links were highlighted as links but not working. Went to the README, edited the broken links, sent a pull request [1], and now it works as expected. Everything done without having to leave "browsing mode", i.e. no cloning, no terminal, no editor. [1] https://github.com/dennybritz/rails_startup_template/pull/3 https://github.com/dennybritz/rails_startup_template/pull/3
- ericb 13y agoRather than Haml, at this point, I'd use Slim. Slim is cleaner (I'd say nicer) and faster than haml. http://slim-lang.com/ http://slim-lang.com/
- aswanson 13y agoDo you have any side-by-side benchmark comparisons of haml and slim? Not saying you're mistaken, but I'd be interested in those metrics.
- dylandrop 13y agoWhy not make a switch gems, in case someone doesn't want them? In other words, something like: ENV['dont_include']='bourbon,analytics-ruby' rails new [app-name] -m template.rb
- DanielKehoe 13y agoI've added this to the list of application templates I track at http://railsapps.github.io/rails-application-templates.html http://railsapps.github.io/rails-application-templates.html. There's also a list of starter apps at http://railsapps.github.io/rails-examples-tutorials.html http://railsapps.github.io/rails-examples-tutorials.html. Most starter app projects end up as abandonware as Rails changes so it's good to see a new app template offered for Rails 4.0. Starter apps always produce a great discussion about must-have gems.
- thinkbohemian 13y agoAllow SECURE_TOKEN to be set via environment variable and it to be rotate-able.