softcover 1.1.23 → 1.1.27

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
2
  SHA1:
3
- metadata.gz: 0525db14fac2a0c8d3e36fe1730e11aadea0f260
4
- data.tar.gz: 6ac3cade0c04ae7cb4c970a4fe13012d4fb70b29
3
+ metadata.gz: 1a5dbd74f8e322cdad06c5c45fe351ea5601abf0
4
+ data.tar.gz: 7c03531a20b8bc23ba38e9b7d7fbbcecd48933c1
5
5
  SHA512:
6
- metadata.gz: c575083b8d00e0262bec7b18d37d9d7d079618409a20bd745081c922bf2fdaef6a402cfc4b0bac1085869be71e665e60fad265c34fb5e56f7680fd4d2d01d247
7
- data.tar.gz: c0aa8dc1442c3f738fba7aa99534a7701f146dfd0c538c38a9363fc8aa7bbe305072414620bd4c5cb1b2619367082645845bb342bb2890f18df9403f1c116732
6
+ metadata.gz: aec06635901ec87431a6b762ef8a2957858dd71581615d60bd7e42ddaa122e689d6a9d9a085cd0f837ba7896fed3033f8870a8b3d9cf0414c5b757cc87dc8d2b
7
+ data.tar.gz: f6cea38508fbbd35086dbf1b400685bd4f27b5c75588507602ca44452a0ba3bbebae34d5c1282df48db27885e3771ae2bc0d683c4e0f4efc8b60008abbbf0f6a
@@ -5,19 +5,11 @@ require 'optparse'
5
5
  # Renames a screenshot.
6
6
  # This is intended for use with Shift-Cmd-4 on Mac OS X.
7
7
  # 1. Use Shift-Cmd-4 to take a screenshot
8
- # 2. Run `rename_screenshot figure_name` to create a full-size figure
9
- # called `figure_name.png` in the `full_size_figures` directory.
10
- # A corresponding smaller resized figure is automagically created
11
- # in the `images/figures` directory. The idea is to keep the full-size figures
12
- # in case they're ever needed, but to resize them so they're not too big
13
- # for inclusion in the document.
8
+ # 2. Run `rename_screenshot figure_name` to create a figure
9
+ # called `figure_name.png` in the `images/figures/` directory.
14
10
  # The method is to look for the most recently modified PNG file on the desktop
15
- # and move it (while renaming it) to the `full_size_figures` directory. Then
16
- # a normal-size figure is generated using the `make_figures` script.
11
+ # and move it (while renaming it) to the `images/figures` directory.
17
12
 
18
- def figure(name)
19
- "images/figures/#{name}.png"
20
- end
21
13
 
22
14
  def rm(filename)
23
15
  FileUtils.rm(filename) if File.exist?(filename)
@@ -31,9 +23,6 @@ OptionParser.new do |opts|
31
23
  options[:force] = true
32
24
  end
33
25
 
34
- opts.on("-i", "Invert a renaming by removing the relevant images") do
35
- options[:invert] = true
36
- end
37
26
  end.parse!
38
27
 
39
28
  name = ARGV.shift
@@ -41,14 +30,14 @@ if name.nil?
41
30
  puts "usage: rename_screenshot filename [options]"
42
31
  exit 1
43
32
  end
44
- FileUtils.mkdir("full_size_figures") unless File.exist?("full_size_figures")
45
- target = "full_size_figures/#{name}.png"
46
33
 
47
- if options[:invert]
48
- rm(target) if File.exist?(target)
49
- rm(figure(name))
34
+ unless File.directory?('images/figures')
35
+ $stderr.puts "ERROR: 'images/figures' doesn't exist. Create and re-run."
36
+ exit 1
50
37
  end
51
38
 
39
+ target = "images/figures/#{name}.png"
40
+
52
41
  most_recent = Dir["#{ENV['HOME']}/Desktop/*.png"].sort_by do |a|
53
42
  File.stat(a).mtime
54
43
  end.reverse.first
@@ -59,7 +48,5 @@ if File.exist?(target) && !options[:force]
59
48
  end
60
49
  unless response.downcase == 'n'
61
50
  FileUtils.mv(most_recent, target)
62
- rm(figure(name))
63
- system "make_figures"
64
- system "git add -A"
51
+ system "git add #{target}"
65
52
  end
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "1.1.23"
2
+ VERSION = "1.1.27"
3
3
  end
data/softcover.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency 'polytexnic', '~> 1.1.12'
21
+ gem.add_dependency 'polytexnic', '~> 1.1.14'
22
22
  gem.add_dependency 'msgpack', '~> 0.4.2'
23
23
  gem.add_dependency 'nokogiri', '~> 1.6.0'
24
24
  gem.add_dependency 'thor', '~> 0.18.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softcover
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.23
4
+ version: 1.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-03 00:00:00.000000000 Z
12
+ date: 2016-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: polytexnic
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.1.12
20
+ version: 1.1.14
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.1.12
27
+ version: 1.1.14
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: msgpack
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -295,7 +295,6 @@ description: Command-line interface for softcover.io
295
295
  email:
296
296
  - michael@softcover.io
297
297
  executables:
298
- - make_figures
299
298
  - rename_screenshot
300
299
  - sc
301
300
  - softcover
@@ -407,7 +406,6 @@ files:
407
406
  - LICENSE.txt
408
407
  - README.md
409
408
  - Rakefile
410
- - bin/make_figures
411
409
  - bin/rename_screenshot
412
410
  - bin/sc
413
411
  - bin/softcover
data/bin/make_figures DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'optparse'
3
-
4
- # Makes display figures based on the full-size figures.
5
- # The idea is to avoid throwing away data by storing full-size figures,
6
- # but resize them to a size appropriate for use in the document.
7
-
8
- options = {}
9
- OptionParser.new do |opts|
10
- opts.banner = "Usage: rename_screenshot [options]"
11
-
12
- opts.on("-a", "Regenerate all figures from full-size images") do
13
- options[:all] = true
14
- end
15
-
16
- opts.on("-w", "Resize to given width (in pixels)") do |width|
17
- options[:width] = width
18
- end
19
- end.parse!
20
-
21
- width = (options[:width] || "700") + '\>'
22
- target_dir = "images/figures"
23
- Dir.glob('full_size_figures/*').each do |full_size_filename|
24
- if full_size_filename =~ /(\w+)-full\.(.*)/
25
- # Needed for backwards compatibility.
26
- filename = "#{target_dir}/#{$1}.#{$2}"
27
- else
28
- filename = "#{target_dir}/#{File.basename(full_size_filename)}"
29
- end
30
- unless File.exist?(filename) && !options[:all]
31
- cmd = "convert #{full_size_filename} -resize #{width} #{filename}"
32
- system cmd
33
- end
34
- end
35
- system "git add -A"