

Rails 4 startup template - dennybritz
https://github.com/dennybritz/rails_startup_template

======
ericb
Rather 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
Do 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.

~~~
ericb
There are a bunch out there, but here's one:

[https://github.com/klaustopher/hamlerbslim](https://github.com/klaustopher/hamlerbslim)

Also on a different note, Slim supports http streaming while Haml does not.

~~~
aswanson
Nice, thanks.

------
jph
Great! 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
Cool, thanks. I hadn't heard of suspenders. I'll check it out (and maybe steal
some of their stuff... ;))

------
DanielKehoe
I'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.

------
rschmitty
For 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
Ah, 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
I 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)

------
nileshtrivedi
I 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
Care to link back to the github repository?

~~~
veidr
I googled it: [https://github.com/nileshtrivedi/rails-starter-
app](https://github.com/nileshtrivedi/rails-starter-app)

~~~
nileshtrivedi
Oops, don't know how I missed that. Thanks :)

------
nahname
> 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?

~~~
dennybritz
Yeah, 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
That sounds like an issue with the gems and not using require_tree

~~~
dennybritz
Yeah, 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
You 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.

~~~
dennybritz
Yeah, maybe I should give the asset pipeline another try. I started the habit
of including files manually when it was first launched and was quite buggy.
Ryan Bates from Railscasts also seems to prefer including his assets manually,
he mentioned that in some of his screencasts. I kinda stole the habit from
him.

I'll give the asset pipeline another try the next time...

------
vysakh0
Nice 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.

------
fphilipe
I 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)

------
BrainScraps
So, 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
That'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
Absolutely!

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! :)

------
random42
Is something similar available for django projects?

~~~
amarsahinovic
There 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)

------
shadeless
No guard or similar? Do you run tests and reload pages manually or use
something else?

~~~
dennybritz
Yeah, I usually use guard. Indeed, I forgot to put that in there. Thanks for
noticing!

------
dylandrop
Why 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

------
sergiotapia
Why Haml instead of Slim?

~~~
nahname
Why Haml at all? You will be changing all of your html in a browser anyways.
Why not write html/erb?

~~~
dennybritz
I 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
Coffeescript 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.

------
thinkbohemian
Allow SECURE_TOKEN to be set via environment variable and it to be rotate-
able.

