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

Use with Sinatra or Padrino? #53

Open
pmackay opened this issue Feb 4, 2016 · 18 comments
Open

Use with Sinatra or Padrino? #53

pmackay opened this issue Feb 4, 2016 · 18 comments

Comments

@pmackay
Copy link

pmackay commented Feb 4, 2016

I dont think seedbank is currently supported for these. Has it ever been considered? Would you have a few tips on what it might require?

@james2m
Copy link
Owner

james2m commented Feb 4, 2016

Aside from the railtie and some use of rails root in default initialisation it's not dependent on rails. The tests show how to override the default path so you should be able to use it just by setting the seeds_path.

I'm away from keyboard right now so there is an iirc attached to this reply.

@james2m
Copy link
Owner

james2m commented Aug 17, 2016

There are a couple of places this is dependent on Rails.root, I've tiptoed towards removing them in master, but would happily take pull requests to finish the job.

@ivanovaleksey
Copy link
Contributor

@james2m I would try to make PR if you don't mind. But I don't know much about them gem internals so I need some time.

@james2m
Copy link
Owner

james2m commented Sep 1, 2016

Hey @ivanovaleksey master has some changes to make this easier. The main thing is get all references to Rails.root out of the code and just let the railtie.rb set the root.

@ivanovaleksey
Copy link
Contributor

Thank you James! I will try to make it.

@ivanovaleksey
Copy link
Contributor

James I have found in TODO.txt

Add generator for seeds directories

I know we can write Rails generator but if we make the gem framework agnostic (as you have wrote in TODO) would we still be able to make such generator for other frameworks?

@james2m
Copy link
Owner

james2m commented Sep 2, 2016

I wasn't really thinking about the rails generator as such, and the todo pre-dates generators moving into the rails command, I was just thinking of a simple rake task to create the directories probably db/seeds, db/seeds/development, db/seeds/test & db/seeds/production

@ivanovaleksey
Copy link
Contributor

ivanovaleksey commented Sep 2, 2016

I see. Yeah some thing for fast start would be nice.
If I solve this issue it would the next thing to do ☺️

@wiggly
Copy link

wiggly commented Feb 10, 2017

Just tried using it in a grape/rom app I am building and realised it was Rails specific.

Would love to have this Rails/AR agnostic.

Looking forward to Aleksey's PR getting merged.

@james2m
Copy link
Owner

james2m commented Feb 12, 2017

@wiggly @ivanovaleksey sorry I've been busy moving. I'm back on things this week. I'll finally get to look at the pull requests.

@james2m
Copy link
Owner

james2m commented Feb 12, 2017

@wiggly you should be able to use in your grape app now thanks to @ivanovaleksey, I don't have any non rails apps to test with, and we haven't got a stand alone environment in the test suite yet, so it would be good to hear how you get on with master.

@wiggly
Copy link

wiggly commented Feb 12, 2017

So, I have already started using @ivanovaleksey's PR code and it works for me.

I haven't yet played with different environments yet but the basics work and it doesn't trip up due to dependencies on Rails.

I will use master now instead and let you know if anything breaks but I don't expect it to.

I am using the http://rom-rb.org/ system for DB access, once I have tested it using correct seeds for different environments I could try and make a small example.

Right now all I am doing it extending the Seedbank::Runner class with a custome module that allows easy access to the ROM repositories I have set up.

@james2m
Copy link
Owner

james2m commented Feb 13, 2017

@wiggly @ivanovaleksey I've rolled this up into a 0.5.0.pre version.

@wiggly
Copy link

wiggly commented Feb 13, 2017

So, yeah, master also works fine as expected.

One question is whether you have thought about what to do about system enviornments. Since you can't rely on RAILS_ENV.

Right now I am building things from the ground up and I have my own env var to flag things that should be configured differently on an environment basis. Perhaps a Seedbank.env that could be set by users to choose the current environment? Then get the railtie to set this using Rails.env and allow others to set it in their own setup phases.

@james2m
Copy link
Owner

james2m commented Feb 14, 2017

That's an interesting point. I was thinking about pulling all the rails specific stuff out into its own module and letting that setup it's own prerequisites. I like the idea of Seedbank.env. @ivanovaleksey any thoughts on this?

@ivanovaleksey
Copy link
Contributor

Sorry for the delay. I can't really tell anything which about that 😞 The idea of Seedbank.env seems to be nice for me too.

As I understand now the gem doesn't include any environment task in override_dependency list because of this, does it?

@wiggly
Copy link

wiggly commented Feb 15, 2017

So, I submitted a PR to enhance the rake tasks to allow people to set up their specific DB layer before the seeds get run, I could also take a shot at adding a way for people to easily select environments that is system-agnostic.

@ivanovaleksey Yes, that is exactly what would stop this right now.

@james2m
Copy link
Owner

james2m commented Feb 17, 2017

@wiggly thanks, I'll give it a poke over the weekend

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 a pull request may close this issue.

4 participants