pxg 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/pxg +5 -4
  2. data/lib/pxg.rb +12 -2
  3. metadata +1 -1
data/bin/pxg CHANGED
@@ -18,10 +18,11 @@ puts
18
18
  puts <<eos
19
19
  Commands
20
20
  ------------------------------------------------------------------------------
21
- pxg version - current interface version
22
- pxg compile [<dir>] - reads pxg.json from directory and resolves it
23
- pxg reimage [<xml>] [new-urls.txt] - reads urls from new-urls.txt replaces all attachment
24
- images with urls in new urls
21
+ pxg version - current interface version
22
+ pxg compile [<dir>] - reads pxg.json from directory and resolves it
23
+ pxg reimage <xml> <mapping> [<ignore>] - reads urls from mapping file replaces all attachment
24
+ images with urls in new urls; you may add a ignore
25
+ list
25
26
  eos
26
27
 
27
28
  end#if
data/lib/pxg.rb CHANGED
@@ -8,11 +8,18 @@ require 'json'
8
8
 
9
9
  class Pxg
10
10
 
11
- VERSION = '1.1.4'
11
+ VERSION = '1.2.5'
12
12
 
13
13
  def reimage(argv)
14
14
  xml = argv[0]
15
15
  new_images = argv[1]
16
+
17
+ if argv.size == 3
18
+ ignorelist = File.read argv[2]
19
+ else # empty ignore list
20
+ ignorelist = []
21
+ end#if
22
+
16
23
  text = File.read new_images
17
24
  text.strip!
18
25
  image_urls = text.split "\n"
@@ -24,7 +31,10 @@ class Pxg
24
31
  targets = []
25
32
  rimages.each do |arr|
26
33
  match_data = arr[0].match /(http(s){0,1}:\/\/[^"<>]*\/)([0-9]{4}\/[0-9]{2}\/[^"<>]+\.(jpg|jpeg|png|tiff|gif|webp))/
27
- targets.push([match_data[0], match_data[1], arr[0].gsub(match_data[1], '')])
34
+ new_target = [match_data[0], match_data[1], arr[0].gsub(match_data[1], '')]
35
+ if ! ignorelist.include? new_target[0]
36
+ targets.push(new_target)
37
+ end#if
28
38
  end#each
29
39
 
30
40
  targets.each do |img|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pxg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: