frameit 0.2.3 → 1.0.0

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: 49a03a8ef47e7ef3631c01e475d5e5eed741113c
4
- data.tar.gz: 12b6e041a7c871ea67c308794cd3ecc3f4ed02ef
3
+ metadata.gz: f90a9df99892760242b8b463f34f7d151f8d928f
4
+ data.tar.gz: 21eccedc746819ae0da351f3b0391828ba361e07
5
5
  SHA512:
6
- metadata.gz: 22d624e77549aec6137d33b7f14b1af33dc953c3bdcb6d9711ff39e211c1f93e505f55860056a8ee0567a4cddf0fd15723e225b1e518b77d5dda7c10772681b9
7
- data.tar.gz: 4acba106ffbf3a2ba83ff9edaaaf031951bd965e54d1f2b77f47fc92986603f848b41041023d21580f7d3be205342671d0afb196b9bd4e5120bfb6eb2cfee953
6
+ metadata.gz: 64994d8e3fc450443af012e5a54c3df2d15914de4bbdecac77cb7ad2b9f865bcee6c275bcf2f92ab33106582d1884543290dcd27125fe090e12624d4bd84cc16
7
+ data.tar.gz: 685f8596d383c66a3a843e4f13d033d84a5d44d97870668d6d693408fc0906122244ba9cfae71009eb4b0a64fa502838023898dac257cd1c94e5b09dc788dad9
data/bin/frameit CHANGED
@@ -3,50 +3,64 @@
3
3
  $:.push File.expand_path("../../lib", __FILE__)
4
4
 
5
5
  require 'frameit'
6
- require 'commander/import'
6
+ require 'commander'
7
7
 
8
8
  HighLine.track_eof = false
9
9
 
10
+ class FrameItApplication
11
+ include Commander::Methods
10
12
 
11
- # Commander
12
- program :version, Frameit::VERSION
13
- program :description, 'Quickly put your screenshots into the right device frames'
14
- program :help, 'Author', 'Felix Krause <frameit@krausefx.com>'
15
- program :help, 'Website', 'https://fastlane.tools'
16
- program :help, 'GitHub', 'https://github.com/krausefx/frameit'
17
- program :help_formatter, :compact
13
+ def run
14
+ program :version, Frameit::VERSION
15
+ program :description, 'Quickly put your screenshots into the right device frames'
16
+ program :help, 'Author', 'Felix Krause <frameit@krausefx.com>'
17
+ program :help, 'Website', 'https://fastlane.tools'
18
+ program :help, 'GitHub', 'https://github.com/krausefx/frameit'
19
+ program :help_formatter, :compact
18
20
 
19
- always_trace!
21
+ always_trace!
20
22
 
21
23
 
22
- default_command :black
24
+ default_command :black
23
25
 
24
26
 
25
- command :black do |c|
26
- c.syntax = 'frameit black'
27
- c.description = "Adds a black frame around all screenshots."
27
+ command :black do |c|
28
+ c.syntax = 'frameit black'
29
+ c.description = "Adds a black frame around all screenshots."
28
30
 
29
- c.action do |args, options|
30
- Frameit::Editor.new.run('.', Frameit::Editor::Color::BLACK)
31
- end
32
- end
31
+ c.action do |args, options|
32
+ Frameit::Editor.new.run('.', Frameit::Editor::Color::BLACK)
33
+ end
34
+ end
33
35
 
34
- command :silver do |c|
35
- c.syntax = 'frameit silver'
36
- c.description = "Adds a silver frame around all screenshots."
37
-
38
- c.action do |args, options|
39
- Frameit::Editor.new.run('.', Frameit::Editor::Color::SILVER)
40
- end
41
- end
36
+ command :silver do |c|
37
+ c.syntax = 'frameit silver'
38
+ c.description = "Adds a silver frame around all screenshots."
39
+
40
+ c.action do |args, options|
41
+ Frameit::Editor.new.run('.', Frameit::Editor::Color::SILVER)
42
+ end
43
+ end
42
44
 
43
- command :setup do |c|
44
- c.syntax = 'frameit setup'
45
- c.description = "Helps you adding new frames."
46
-
47
- c.action do |args, options|
48
- Frameit::FrameConverter.new.run
45
+ command :setup do |c|
46
+ c.syntax = 'frameit setup'
47
+ c.description = "Helps you adding new frames."
48
+
49
+ c.action do |args, options|
50
+ Frameit::FrameConverter.new.run
51
+ end
52
+ end
53
+
54
+ alias_command :white, :silver
55
+
56
+ run!
49
57
  end
50
58
  end
51
59
 
52
- alias_command :white, :silver
60
+
61
+ begin
62
+ FastlaneCore::UpdateChecker.start_looking_for_update('frameit')
63
+ FrameItApplication.new.run
64
+ ensure
65
+ FastlaneCore::UpdateChecker.show_update_status('frameit', Frameit::VERSION)
66
+ end
data/lib/frameit.rb CHANGED
@@ -9,6 +9,5 @@ require 'fastlane_core'
9
9
  module Frameit
10
10
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
11
11
 
12
- FastlaneCore::UpdateChecker.verify_latest_version('frameit', Frameit::VERSION)
13
12
  Frameit::DependencyChecker.check_dependencies
14
13
  end
@@ -28,34 +28,40 @@ module Frameit
28
28
  def run(path, color = Color::BLACK)
29
29
  @color = color
30
30
 
31
- Dir.glob("#{path}/**/*.{png,PNG}").each do |screenshot|
32
- next if screenshot.include?"_framed.png"
33
- next if screenshot.include?".itmsp/" # a package file, we don't want to modify that
34
-
35
- begin
36
- template_path = get_template(screenshot)
37
- if template_path
38
- template = MiniMagick::Image.open(template_path)
39
- image = MiniMagick::Image.open(screenshot)
40
-
41
- offset_information = image_offset(screenshot)
42
- raise "Could not find offset_information for '#{screenshot}'" unless (offset_information and offset_information[:width])
43
- width = offset_information[:width]
44
- image.resize width
45
-
46
- result = template.composite(image) do |c|
47
- c.compose "Over"
48
- c.geometry offset_information[:offset]
31
+ screenshots = Dir.glob("#{path}/**/*.{png,PNG}")
32
+
33
+ if screenshots.count > 0
34
+ screenshots.each do |screenshot|
35
+ next if screenshot.include?"_framed.png"
36
+ next if screenshot.include?".itmsp/" # a package file, we don't want to modify that
37
+
38
+ begin
39
+ template_path = get_template(screenshot)
40
+ if template_path
41
+ template = MiniMagick::Image.open(template_path)
42
+ image = MiniMagick::Image.open(screenshot)
43
+
44
+ offset_information = image_offset(screenshot)
45
+ raise "Could not find offset_information for '#{screenshot}'" unless (offset_information and offset_information[:width])
46
+ width = offset_information[:width]
47
+ image.resize width
48
+
49
+ result = template.composite(image) do |c|
50
+ c.compose "Over"
51
+ c.geometry offset_information[:offset]
52
+ end
53
+
54
+ output_path = screenshot.gsub('.png', '_framed.png').gsub('.PNG', '_framed.png')
55
+ result.format "png"
56
+ result.write output_path
57
+ Helper.log.info "Added frame: '#{File.expand_path(output_path)}'".green
49
58
  end
50
-
51
- output_path = screenshot.gsub('.png', '_framed.png').gsub('.PNG', '_framed.png')
52
- result.format "png"
53
- result.write output_path
54
- Helper.log.info "Added frame: '#{File.expand_path(output_path)}'".green
59
+ rescue => ex
60
+ Helper.log.error ex
55
61
  end
56
- rescue => ex
57
- Helper.log.error ex
58
62
  end
63
+ else
64
+ Helper.log.error "Could not find screenshots"
59
65
  end
60
66
  end
61
67
 
@@ -1,3 +1,3 @@
1
1
  module Frameit
2
- VERSION = "0.2.3"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0
26
+ version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fastimage
29
29
  requirement: !ruby/object:Gem::Requirement