From 8781d47ddbe05fb06a963aca13ee6e518224fbdd Mon Sep 17 00:00:00 2001 From: Dan Thompson Date: Mon, 7 Jan 2013 09:19:11 -0500 Subject: [PATCH 1/4] add environment task appends to or creates when not already present (no-op) --- lib/tasks/emoji.rake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tasks/emoji.rake b/lib/tasks/emoji.rake index c33d3fd..df1d4d8 100644 --- a/lib/tasks/emoji.rake +++ b/lib/tasks/emoji.rake @@ -1,3 +1,5 @@ +task :environment + desc "Copy emoji to the Rails `public/images/emoji` directory" task :emoji => :environment do require 'emoji' From 8441803d176b915b9c5132a9f89d3d82e4a2f6fe Mon Sep 17 00:00:00 2001 From: Dan Thompson Date: Mon, 7 Jan 2013 09:57:37 -0500 Subject: [PATCH 2/4] Update target path to not rely on Rails constant --- lib/tasks/emoji.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/emoji.rake b/lib/tasks/emoji.rake index df1d4d8..bc5dfd0 100644 --- a/lib/tasks/emoji.rake +++ b/lib/tasks/emoji.rake @@ -4,7 +4,9 @@ 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 + + target = "#{root}/public/images/emoji" mkdir_p "#{target}" Dir["#{Emoji.images_path}/emoji/*.png"].each do |src| From 808cb099dea2b2062b605d3e80eb48f5011109e7 Mon Sep 17 00:00:00 2001 From: Dan Thompson Date: Mon, 7 Jan 2013 10:03:43 -0500 Subject: [PATCH 3/4] Remove 'Rails' as rake task no longer requires it --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c64b1c..387d225 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ gem 'gemoji' **Sync images** -Images can be copied to your public directory with `rake emoji` in your Rails app. This is the recommended approach since the images will be available at a consistent location. This works best with cached formatted user content generated by tools like [html-pipeline](https://github.com/jch/html-pipeline). +Images can be copied to your public directory with `rake emoji` in your app. This is the recommended approach since the images will be available at a consistent location. This works best with cached formatted user content generated by tools like [html-pipeline](https://github.com/jch/html-pipeline). ``` ruby # Rakefile From 27e6ef7bc0e16abbb595bd135ad929383ee5fb0a Mon Sep 17 00:00:00 2001 From: Dan Thompson Date: Wed, 9 Jan 2013 16:23:30 -0500 Subject: [PATCH 4/4] Remove external dependencies --- lib/tasks/emoji.rake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/tasks/emoji.rake b/lib/tasks/emoji.rake index bc5dfd0..48bf944 100644 --- a/lib/tasks/emoji.rake +++ b/lib/tasks/emoji.rake @@ -1,12 +1,8 @@ -task :environment - desc "Copy emoji to the Rails `public/images/emoji` directory" -task :emoji => :environment do +task :emoji do require 'emoji' - root = defined?(Rails) ? Rails.root : Rake.original_dir - - target = "#{root}/public/images/emoji" + target = "#{Rake.original_dir}/public/images/emoji" mkdir_p "#{target}" Dir["#{Emoji.images_path}/emoji/*.png"].each do |src|