url_to_image_path 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd582154aa9f5cdb63de778cf279fc46d5c5bf59
4
- data.tar.gz: b3bc2604671a17e56e74038e8080e6e6fdaa7d03
3
+ metadata.gz: ed41572d7bcd3a15507e1efefdd11fa0317b356f
4
+ data.tar.gz: 14a8e728023fdf0c1f1f8646d0b7ca1914b32d1b
5
5
  SHA512:
6
- metadata.gz: 7bb099900120ba39d9da1a7cfedc518a5ef329698381242f89a8db4d219a4b7654257e9abc8b301c35a3a9ce116265a9f679600bfaadcfdda50bf8c181aebafc
7
- data.tar.gz: 0e05cb36d1ad2050853534251215bb23dbcb0a2d6d9cc8068e5e88e7fb267edf33d9a8060c11a76cb7392c455e73a2c0d6b7a4dae03fc2883c07eac8aeacd417
6
+ metadata.gz: ffb1aa10db77979d93f814f33b33ab9143c40d2759bf24b05f6fa55e9af882100e6d4a10ffc320b6d46f1bb31133babf4cb3be6befef1c98f8d7ff907b7aeb00
7
+ data.tar.gz: a5fb225357e1b947b12b8586c6003b5d83f4ea813c27849d59676922e42ef72367a446bbbcb321fee46ec461cd74733427633801d52c1c21c59fe3d4230472c0
@@ -1,3 +1,3 @@
1
1
  module UrlToImagePath
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  require "url_to_image_path/version"
2
2
 
3
3
  module UrlToImagePath
4
- def self.hello
5
- puts "Hello World"
6
- "Hello World"
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ load '../tasks/convert_urls.rake'
7
+ end
7
8
  end
8
9
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_to_image_path
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neven Rakonić
@@ -70,11 +70,11 @@ files:
70
70
  - Rakefile
71
71
  - bin/console
72
72
  - bin/setup
73
- - lib/convert_urls.rake
74
73
  - lib/url_to_image_path.rb
75
74
  - lib/url_to_image_path/version.rb
76
75
  - tasks/convert_urls.rake
77
76
  - tasks/rspec.rake
77
+ - url_to_image_path-0.1.1.gem
78
78
  - url_to_image_path.gemspec
79
79
  homepage: https://github.com/nevenRakonic/url_to_image_path
80
80
  licenses:
@@ -1,39 +0,0 @@
1
- require 'rake'
2
- require 'tempfile'
3
-
4
- desc "receives a css file and returns an scss file with url links changed to
5
- asset pipeline helpers"
6
-
7
- task :urlify, [:filename] do |title, args|
8
- file_name = args[:filename]
9
- assets_path = Rails.root.join('app/assets/stylesheets/')
10
-
11
- # looks for either end of parenthesis and the slash sign
12
- split_pattern = /[\(\)\/]/
13
- image_extension = /(\.png)|(\.jpg)|(\.gif)/
14
-
15
- #we create a temporary file
16
- tmp = Tempfile.new("tmp")
17
-
18
- css = File.open(assets_path + file_name, "r+")
19
- css.each do |line|
20
- # find lines with css url property
21
- if /url/.match(line)
22
- matches = line.split(split_pattern)
23
- matches.each do |part|
24
- # extract art of the line that contains image name with extension
25
- if image_extension.match(part)
26
- part.gsub!(/[^0-9a-z_\-\.]/i, '')
27
- line.gsub!(/url\(.*\)/, "url(image_path(\"#{part}\"))")
28
- end
29
- end
30
- end
31
- tmp << line
32
- end
33
-
34
- tmp.close
35
- css.close
36
-
37
- # we move the temporary file to the assets directory
38
- mv(tmp.path, assets_path.join(file_name + ".scss"))
39
- end