List Info

Thread: DRY up mysql/postgres yaml generators




DRY up mysql/postgres yaml generators
country flaguser name
Germany
2007-11-04 13:32:57
Hey folks,

Not sure about you, but when setting up a rails project, I
get tired of
specifying username, login, etc 3 times, when it should only
be done
once, in the config/database.yml file.


To me, it makes more sense to use yaml and do the
following:

login: &login
  adapter: mysql
  encoding: utf8
  username: robert
  password: super_secret

development:
  database: cool_app_development
  <<: *login

test:
  database: cool_app_test
  <<: *login

production:
  database: cool_app_production
  <<: *login

So, I've written a patch for mysql and postgres generators
to follow the
above, instead of what we are used to. Links below, looking
for some
+1's 

link: http://dev.ru
byonrails.org/ticket/10069
-- 
Posted via http://www.ruby-forum.com
/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


DRY up mysql/postgres yaml generators
user name
2007-11-04 14:40:26
On Nov 4, 2007 8:32 PM, Robert Evans < ruby-forum-incomingandreas-s.net">ruby-forum-incomingandreas-s.net> wrote:

So, I've written a patch for mysql and postgres generators to follow the
above, instead of what we are used to. Links below, looking for some
+19;s

I use it, but have noticed that a significant number of coders don't like this YAML feature.

Please, express your opinions here.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

DRY up mysql/postgres yaml generators
country flaguser name
United States
2007-11-05 04:13:13
On Nov 4, 9:40 pm, "Mislav Marohnić"
<mislav.maroh...gmail.com>
wrote:
> On Nov 4, 2007 8:32 PM, Robert Evans
<ruby-forum-incom...andreas-s.net>
> wrote:
>
>
>
> > So, I've written a patch for mysql and postgres
generators to follow the
> > above, instead of what we are used to. Links
below, looking for some
> > +1's 
>
> I use it, but have noticed that a significant number of
coders don't like
> this YAML feature.
>
> Please, express your opinions here.

The syntax is too obscure and not many people know it. It
could
confuse people who use Rails for the first time, or people
who are not
intimately familiar with YAML. I think it's more important
that the
config file is easy to read, than saving 20 seconds at the
beginning
of a project.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


DRY up mysql/postgres yaml generators
user name
2007-11-05 07:35:42
On 11/5/07, Hongli Lai <honglilaigmail.com> wrote:
> The syntax is too obscure and not many people know it.
It could
> confuse people who use Rails for the first time, or
people who are not
> intimately familiar with YAML. I think it's more
important that the
> config file is easy to read, than saving 20 seconds at
the beginning
> of a project.

I agree.  Perhaps it could just be a link in the comments
of
database.yml which points to more info on the rails
rdoc/trac?

-- Chad

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


DRY up mysql/postgres yaml generators
country flaguser name
United States
2007-11-06 04:08:38
On Nov 5, 2:35 pm, "Chad Woolley"
<thewoolley...gmail.com> wrote:
> On 11/5/07, Hongli Lai <hongli...gmail.com> wrote:
> I agree.  Perhaps it could just be a link in the
comments of
> database.yml which points to more info on the rails
rdoc/trac?

Yes, that's a good compromise.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: DRY up mysql/postgres yaml generators
country flaguser name
United States
2007-11-06 08:52:51
How about keeping the structure I suggested, but adding
comments
explaining the structure for clarification? To me it makes
sense
because it DRY's up your code, something Rails advocates,
but doesn't
follow in this area.

On Nov 6, 5:08 am, Hongli Lai <hongli...gmail.com> wrote:
> On Nov 5, 2:35 pm, "Chad Woolley"
<thewoolley...gmail.com> wrote:
>
> > On 11/5/07, Hongli Lai <hongli...gmail.com> wrote:
> > I agree.  Perhaps it could just be a link in the
comments of
> > database.yml which points to more info on the
rails rdoc/trac?
>
> Yes, that's a good compromise.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: DRY up mysql/postgres yaml generators
country flaguser name
United States
2007-11-07 05:15:36
On Nov 6, 3:52 pm, revans <RobertREv...gmail.com> wrote:
> How about keeping the structure I suggested, but adding
comments
> explaining the structure for clarification? To me it
makes sense
> because it DRY's up your code, something Rails
advocates, but doesn't
> follow in this area.

Yes but Rails also advocates readability, and unfortunately
this YAML
syntax doesn't. I think readability is more important.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: DRY up mysql/postgres yaml generators
user name
2007-11-07 05:40:24
Agree. Too much DRY leads to perlism sometimes, this is
quite close to
that. And not much to gain from it either.

On 11/7/07, Hongli Lai <honglilaigmail.com> wrote:
>
> On Nov 6, 3:52 pm, revans <RobertREv...gmail.com> wrote:
> > How about keeping the structure I suggested, but
adding comments
> > explaining the structure for clarification? To me
it makes sense
> > because it DRY's up your code, something Rails
advocates, but doesn't
> > follow in this area.
>
> Yes but Rails also advocates readability, and
unfortunately this YAML
> syntax doesn't. I think readability is more important.
>
>
> >
>


-- 
Cheers!
- Pratik
http://m.onkey.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


DRY up mysql/postgres yaml generators
user name
2007-11-07 08:34:41
I rarely use the same username and password for my
production and
development databases, so not only does this obfuscate the
file a
little bit it also makes me have to do more work when I get
ready to
do production testing and deployment.

--Jeremy

On Nov 4, 2007 2:32 PM, Robert Evans
<ruby-forum-incomingandreas-s.net> wrote:
>
> Hey folks,
>
> Not sure about you, but when setting up a rails
project, I get tired of
> specifying username, login, etc 3 times, when it should
only be done
> once, in the config/database.yml file.
>
>
> To me, it makes more sense to use yaml and do the
following:
>
> login: &login
>   adapter: mysql
>   encoding: utf8
>   username: robert
>   password: super_secret
>
> development:
>   database: cool_app_development
>   <<: *login
>
> test:
>   database: cool_app_test
>   <<: *login
>
> production:
>   database: cool_app_production
>   <<: *login
>
> So, I've written a patch for mysql and postgres
generators to follow the
> above, instead of what we are used to. Links below,
looking for some
> +1's 
>
> link: http://dev.ru
byonrails.org/ticket/10069
> --
> Posted via http://www.ruby-forum.com
/.
>
> >
>



-- 
http://www.jeremymcana
lly.com/

My books:
Ruby in Practice
http://www.manning.c
om/mcanally/

My free Ruby e-book
http://www.humbl
elittlerubybook.com/

My blogs:
http://www.mrneighborly.
com/
http://www.rubyinpract
ice.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: DRY up mysql/postgres yaml generators
country flaguser name
United States
2007-11-07 08:59:56
I totally disagree with the "perlism" comparison
here. If it is a
taste thing, that's understandable, but saying the above
code snippet
is too hard to read or akin to perlism, I don't agree. But
whatever
the consensus is, is cool with me.

On Nov 7, 6:15 am, Hongli Lai <hongli...gmail.com> wrote:
> On Nov 6, 3:52 pm, revans <RobertREv...gmail.com> wrote:
>
> > How about keeping the structure I suggested, but
adding comments
> > explaining the structure for clarification? To me
it makes sense
> > because it DRY's up your code, something Rails
advocates, but doesn't
> > follow in this area.
>
> Yes but Rails also advocates readability, and
unfortunately this YAML
> syntax doesn't. I think readability is more important.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-10]

about | contact  Other archives ( Real Estate discussion Medical topics )