Add non rails support #24

Merged
merged 4 commits into from Jan 9, 2013

2 participants

@danthompson

I hit a couple snags getting this to work in a non Rails app. Here are the changes I made to have it work in either. Also, a slight readme update. What do you think? :bowtie:

@danthompson

Any thoughts on this? 👍 👎 Not a concern? Wrong approach? 🎱

@juliamae

@josh
GitHub member

I think its a good idea to support non-rails apps.

@josh josh and 1 other commented on an outdated diff Jan 9, 2013
lib/tasks/emoji.rake
@@ -1,8 +1,12 @@
+task :environment
@josh
GitHub member
josh added a note Jan 9, 2013

Stubbing environment might cause problems.

I couldn't find anything saying it was. Seemed like the only course if :environment was still a dep. I'll drop it from this and the task then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@josh josh and 1 other commented on an outdated diff Jan 9, 2013
lib/tasks/emoji.rake
desc "Copy emoji to the Rails `public/images/emoji` directory"
task :emoji => :environment do
require 'emoji'
- target = "#{Rails.root}/public/images/emoji"
+ root = defined?(Rails) ? Rails.root : Rake.original_dir
@josh
GitHub member
josh added a note Jan 9, 2013

Maybe we can just use Rake.original_dir all the time. I think we can kill the :environment dep.

@josh
GitHub member
josh added a note Jan 9, 2013

Is Rake.original_dir basically Dir.pwd?

Yeah, I wasn't really sure why :environment dep was needed in this context.

Rake.original_dir is actually Dir.pwd. I can surely swap it out. It just holds on to the dir where rake was invoked from incase of dir traversal.

@josh
GitHub member
josh added a note Jan 9, 2013

Lets just do Rake.original_dir and skip the Rails.root reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@danthompson

I removed the :environment task, and updated the target path to use Rake.original_dir. :feelsgood:

@josh
GitHub member

🆒

@josh josh merged commit ece49a0 into github:master Jan 9, 2013
@danthompson danthompson deleted the danthompson:non_rails_support branch Jan 10, 2013
@danthompson

Not to be a 🐛 but what are the chances we could get this 💎 cut soonish?

@josh
GitHub member

Done.

@danthompson

❤️ Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment