ack_favicon_maker_rails 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3ed3e558db72552d0b8fdf2aac39c1fdcfdfe5a9
4
- data.tar.gz: 0f87193e27b96cef86df2baee9bf6a7c70ec93ba
2
+ SHA256:
3
+ metadata.gz: ec2ed3e8e20a8be7f9c2f38a255126df605834545758dd861e9c6321fd3b0834
4
+ data.tar.gz: f50e0a3e030d4b8cce9fa00d6dd1e4aa31eb8ca30213615659d25de5d2a0c995
5
5
  SHA512:
6
- metadata.gz: da6640c583ddf5e80a59fa01513685ba155395e97637b4cdd39fa9a3595296124d4428f605d26c3eb957318475d12c5ebe895d10aa54334b2b3a79537e249c58
7
- data.tar.gz: e5894843ef913ffbd90db89b624bdb1e0bd0b2b4b821171d08ce5e8f86423a78d0fe859c1d31665e557c4388777e29e8cbfbe77b775412e5bc897d70b288bbff
6
+ metadata.gz: b3fb047c4cee189729a4bdb5412b82f802a2d80dc0e8fa28b0888025eb50309569554455ba43993162ed5ba2d5855c02aeb335fc466a4ace4ab871a98c83e15d
7
+ data.tar.gz: 1983b9dada23a5a8f0bf4d286675ac85221e76fc3e4945bc99db753bfb84c6959e178cd389db0281a8f8d99a1571aa5b680564d7abf27548abeb0a7cb9dcf9ed
data/README.md CHANGED
@@ -14,8 +14,11 @@ Add the following line to your Gemfile:
14
14
  ## Usage
15
15
 
16
16
  1. Place your PNG favicon* in app/assets/images, calling it favicon.png.
17
- 2. Type `rake favicon` in your terminal.
18
- 3. Your generated favicons will be output into your public directory.
17
+ 2. Type `rake favicon` or `rake favicon:generate[%namespace%]` in your terminal.
18
+ %namespace% need if you want to place in public/%namespace%. So source path will be app/assets/images/%namespace%.
19
+ Also gem try get %namespace%::Engine.root. Rails.root as fallback.
20
+ You can use it for subdomains or whatever.
21
+ 3. Your generated favicons will be output into your public directory .
19
22
 
20
23
  *: The largest size used is 228x228 for Apple Retina displays, I recommend using an image this size or larger for best results.
21
24
 
@@ -5,18 +5,33 @@ def say(message)
5
5
  end
6
6
 
7
7
  namespace :favicon do
8
- task :generate do
8
+ task :generate, [:namespace] => :environment do |task, args|
9
+ namespace = (args.namespace || args[:namespace] || "").underscore
10
+ begin
11
+ root = if defined?(namespace.camelize.constantize) and defined?(engine = "#{namespace.camelize}::Engine".constantize)
12
+ "#{namespace.camelize}::Engine".constantize.root
13
+ else
14
+ Rails.root
15
+ end
16
+ rescue
17
+ root = Rails.root
18
+ end
19
+
9
20
  options = {
10
21
  versions: [:apple_114, :apple_57, :apple, :fav_png, :fav_ico],
11
- custom_versions: {apple_extreme_retina: {filename: "apple-touch-icon-228x228-precomposed.png", dimensions: "228x228", format: "png"}},
12
- root_dir: Rails.root,
13
- input_dir: File.join('app', 'assets', 'images'),
22
+ custom_versions: {
23
+ apple_extreme_retina: {
24
+ filename: "apple-touch-icon-228x228-precomposed.png", dimensions: "228x228", format: "png"
25
+ }
26
+ },
27
+ root_dir: root,
28
+ input_dir: File.join('app', 'assets', 'images', namespace),
14
29
  base_image: 'favicon.png',
15
- output_dir: 'public/favicons',
30
+ output_dir: "public#{namespace.blank? ? "/" : "/#{namespace}/"}favicons",
16
31
  copy: true
17
32
  }
18
33
 
19
- if File::exists?(File.join('app', 'assets', 'images', 'favicon.png'))
34
+ if File::exists?(File.join(root, options[:input_dir], 'favicon.png'))
20
35
  if Gem.loaded_specs['favicon_maker'].version < Gem::Version.new('1.0.0')
21
36
  FaviconMaker::Generator.create_versions(options) do |filepath|
22
37
  say "Created favicon: #{filepath}"
@@ -26,11 +41,11 @@ namespace :favicon do
26
41
 
27
42
  setup do
28
43
  template_dir options[:root_dir].join(options[:input_dir])
29
- output_dir options[:root_dir].join(options[:output_dir])
44
+ output_dir Rails.root.join(options[:output_dir])
30
45
  end
31
46
 
32
47
  unless Dir.exist?(output_dir)
33
- Dir.mkdir(output_dir)
48
+ FileUtils.mkdir_p(output_dir)
34
49
  end
35
50
 
36
51
  from 'favicon.png' do
@@ -79,10 +94,10 @@ namespace :favicon do
79
94
  end
80
95
  end
81
96
  else
82
- say 'No source favicon found, please create favicon.png in your app/assets/images directory.'
97
+ say "No source favicon found, please create favicon.png in your #{File.join(root, options[:input_dir])} directory."
83
98
  end
84
99
  end
85
100
  end
86
101
 
87
102
  desc 'Generate favicons from single favicon.png source'
88
- task favicon: "favicon:generate"
103
+ task favicon: "favicon:generate" # shortcut
@@ -1,3 +1,3 @@
1
1
  module FaviconMakerRails
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ack_favicon_maker_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2019-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: favicon_maker
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.4.8
82
+ rubygems_version: 2.7.8
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Simple rake task for generating favicons from a .png source.