skeptick 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f063a9fcc9653c7f7c10c975f1de9b5d7f1bfa85
4
+ data.tar.gz: bfe797cbb1dee5576f915765621ba3851bf949ed
5
+ SHA512:
6
+ metadata.gz: d44e20efd63cec1053b5f6e7f6fdfb91e28f53ffa00c80975f5fe187aaa8377be7f3825927bb64e9a357a0cff187f64fca07beae1f9152e8c72122963082bbdc
7
+ data.tar.gz: ec450c5a2a0ca862ca4e3ba04534f14d390e84e09e2e39bd6ff3da43dd216c9bf4abe9f8b911ccb50a55f6089e56cc9bbc37fe5acc66499fadc4a5f37f576014
@@ -0,0 +1,8 @@
1
+ v0.1.1
2
+
3
+ * Add Skeptick.timeout (seconds) for limiting runtime of convert operations
4
+ * Add ability to pass spawn options to `run` (e.g. override default timeout)
5
+
6
+ v0.1.0
7
+
8
+ * Initial release
data/README.md CHANGED
@@ -1,6 +1,19 @@
1
- # Skeptick
1
+ ### A note on project status
2
2
 
3
- Skeptick is an all-purpose DSL for building and running ImageMagic commands.
3
+ If looking at commits makes you think that this project is abandoned, it's not. Skeptick is being used in our production ever since its inception, and it's working great. The reason there is no new activity is as follows.
4
+
5
+ * It's really working great for us
6
+ * Nobody is submitting issues
7
+
8
+ So don't let the lack of git activity fool you. I have plans to blog about some interesting use cases for Skeptick and link to them from this README, stay tuned.
9
+
10
+ # Skeptick: Better ImageMagick for Ruby
11
+
12
+ [![Build Status](https://travis-ci.org/maxim/skeptick.png?branch=master)](https://travis-ci.org/maxim/skeptick)
13
+ [![Code Climate](https://codeclimate.com/github/maxim/skeptick.png)](https://codeclimate.com/github/maxim/skeptick)
14
+ [![Dependency Status](https://gemnasium.com/maxim/skeptick.png)](https://gemnasium.com/maxim/skeptick)
15
+
16
+ Skeptick is an all-purpose DSL for building and running ImageMagick commands.
4
17
  It helps you build any transformations, from trivial resizes to complex mask
5
18
  algorithms and free drawing. In a nutshell, Skeptick is nothing more than a
6
19
  string manipulator and a process spawner. That's all it's meant to be. However,
@@ -81,6 +94,11 @@ You can enable `debug_mode` to display every executed command in the log.
81
94
  Skeptick.debug_mode = true
82
95
  ```
83
96
 
97
+ ## Security Note
98
+
99
+ *Never* insert any user input into any of Skeptick's commands. This should be
100
+ obvious. Skeptick executes strings in your shell.
101
+
84
102
  ## DSL
85
103
 
86
104
  ![Skeptick Logo](https://raw.github.com/maxim/skeptick/master/logo.png)
@@ -380,7 +398,7 @@ Composition is sugar that adds `compose` shortcut to Skeptick's DSL.
380
398
 
381
399
  ```ruby
382
400
  command = compose(:multiply, 'a.png', 'b.png', to: 'out.png') do
383
- with '-resize', '200x200'
401
+ set :resize, '200x200'
384
402
  end
385
403
 
386
404
  # OUTPUT:
@@ -408,7 +426,7 @@ following command does the same thing.
408
426
  command = compose(:multiply, to: 'out.png') do
409
427
  image 'a.png'
410
428
  image 'b.png'
411
- with '-resize', '200x200'
429
+ set :resize, '200x200'
412
430
  end
413
431
  ```
414
432
 
@@ -421,7 +439,7 @@ command = convert('image1.png', to: 'result.png') do
421
439
  image 'image3.png[200x200]'
422
440
 
423
441
  convert 'image4.png' do
424
- with '-unsharp', '0x5'
442
+ set :unsharp, '0x5'
425
443
  end
426
444
 
427
445
  end
@@ -526,19 +544,20 @@ act as `+swap` - which swaps last two images.
526
544
 
527
545
  Sometimes you might want to take a look at an intermediate image that's being
528
546
  generated inside parentheses, nested somewhere in your command. You can do so
529
- with the help of `write('/path/to/img.png')`.
547
+ with the help of `save('/path/to/img.png')`, which is defined in
548
+ `skeptick/sugar/debugging.rb`.
530
549
 
531
550
  ```ruby
532
551
  command = convert(to: 'result.png') do
533
552
  compose(:multiply, 'a.png', 'b.png') do
534
- write('~/Desktop/debug.png')
553
+ save('~/Desktop/debug.png')
535
554
  end
536
555
 
537
556
  set '-resize', '200x200'
538
557
  end
539
558
  ```
540
559
 
541
- In this case the result of inner `compose` command will be written to desktop,
560
+ In this case the result of inner `compose` command will be saved to desktop
542
561
  without affecting anything else. Again, this is a feature that already exists
543
562
  in ImageMagick, as becomes apparent from the resulting command.
544
563
 
@@ -554,17 +573,17 @@ piped commands.
554
573
  ```ruby
555
574
  command = chain(to: 'result.png') do
556
575
  compose(:hardlight, 'a.png', 'b.png') do
557
- with '-brightness-contrast', '2x4'
576
+ set '-brightness-contrast', '2x4'
558
577
  end
559
578
 
560
579
  compose(:atop, 'c.png', :pipe)
561
580
  end
562
581
 
563
582
  # OUTPUT:
564
- convert
565
- a.png b.png -compose hardlight -brightness-contrast 2x4 -composite miff:- |
566
- convert
567
- c.png miff:- -compose atop -composite result.png
583
+ # convert
584
+ # a.png b.png -compose hardlight -brightness-contrast 2x4 -composite miff:- |
585
+ # convert
586
+ # c.png miff:- -compose atop -composite result.png
568
587
  ```
569
588
 
570
589
  Two things to note here. First of all, commands that are declared in the `chain`
@@ -25,9 +25,11 @@ module Skeptick
25
25
  end
26
26
  alias_method :to_s, :command
27
27
 
28
- def run
28
+ def run(spawn_options = {})
29
29
  opts = {}
30
- opts[:chdir] = Skeptick.cd_path.to_s if Skeptick.cd_path
30
+ opts[:chdir] = Skeptick.cd_path.to_s if Skeptick.cd_path
31
+ opts[:timeout] = Skeptick.timeout if Skeptick.timeout
32
+ opts.merge(spawn_options)
31
33
 
32
34
  if Skeptick.debug_mode?
33
35
  Skeptick.log("Skeptick Command: #{command}")
@@ -8,8 +8,9 @@ module Skeptick
8
8
  class << self
9
9
  attr_writer :debug_mode,
10
10
  :logger,
11
- :logger_method,
12
- :cd_path
11
+ :logger_method
12
+
13
+ attr_accessor :cd_path, :timeout
13
14
 
14
15
  def log(message)
15
16
  @logger ||= ::STDOUT
@@ -26,10 +27,6 @@ module Skeptick
26
27
  def debug_mode?
27
28
  @debug_mode
28
29
  end
29
-
30
- def cd_path
31
- @cd_path
32
- end
33
30
  end
34
31
 
35
32
  def convert(*args, &blk)
@@ -1,3 +1,3 @@
1
1
  module Skeptick
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
data/logo.rb CHANGED
@@ -32,7 +32,7 @@ curve = image do
32
32
  draw "fill none bezier #{bezier}"
33
33
  end
34
34
 
35
- result_path = "#{File.dirname(__FILE__)}/logo.png"
35
+ result_path = "#{File.dirname(__FILE__)}/logo2.png"
36
36
 
37
37
  torn = torn_paper_image(
38
38
  paper * (text + curve),
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency 'posix-spawn', '~> 0.3.6'
21
+ gem.add_development_dependency 'rake', '>= 0.9.2'
21
22
  end
@@ -71,7 +71,7 @@ class GeometryTest < Skeptick::TestCase
71
71
  geometry(width: 100, height: 200, expand_only: true)
72
72
  end
73
73
 
74
- def test_geometry_with_expand_only
74
+ def test_geometry_with_shrink_only
75
75
  assert_equal '100x200>',
76
76
  geometry(width: 100, height: 200, shrink_only: true)
77
77
  end
metadata CHANGED
@@ -1,32 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skeptick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Maxim Chernyak
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-03 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: posix-spawn
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.3.6
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.3.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.2
30
41
  description: Thin ImageMagick DSL with smart command composition
31
42
  email:
32
43
  - max@bitsonnet.com
@@ -34,12 +45,12 @@ executables: []
34
45
  extensions: []
35
46
  extra_rdoc_files: []
36
47
  files:
37
- - .gitignore
48
+ - ".gitignore"
49
+ - CHANGELOG
38
50
  - Gemfile
39
51
  - LICENSE.txt
40
52
  - README.md
41
53
  - Rakefile
42
- - foo.rb
43
54
  - lib/skeptick.rb
44
55
  - lib/skeptick/chain.rb
45
56
  - lib/skeptick/chain/dsl_context.rb
@@ -80,27 +91,26 @@ files:
80
91
  - test/test_helper.rb
81
92
  homepage: https://github.com/maxim/skeptick
82
93
  licenses: []
94
+ metadata: {}
83
95
  post_install_message:
84
96
  rdoc_options: []
85
97
  require_paths:
86
98
  - lib
87
99
  required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
100
  requirements:
90
- - - ! '>='
101
+ - - ">="
91
102
  - !ruby/object:Gem::Version
92
103
  version: '0'
93
104
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
105
  requirements:
96
- - - ! '>='
106
+ - - ">="
97
107
  - !ruby/object:Gem::Version
98
108
  version: '0'
99
109
  requirements: []
100
110
  rubyforge_project:
101
- rubygems_version: 1.8.25
111
+ rubygems_version: 2.2.2
102
112
  signing_key:
103
- specification_version: 3
113
+ specification_version: 4
104
114
  summary: Skeptick doesn't believe in Magick
105
115
  test_files:
106
116
  - test/chain_test.rb
@@ -115,3 +125,4 @@ test_files:
115
125
  - test/sugar/resizing_test.rb
116
126
  - test/sugar/sequence_manipulation_test.rb
117
127
  - test/test_helper.rb
128
+ has_rdoc:
data/foo.rb DELETED
@@ -1 +0,0 @@
1
- require 'minitest/autorun'; class FooTest < MiniTest::Unit::TestCase; def test_foo; assert_equal('0x0', '0x1') end end