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 +4 -4
- data/bin/frameit +46 -32
- data/lib/frameit.rb +0 -1
- data/lib/frameit/editor.rb +31 -25
- data/lib/frameit/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f90a9df99892760242b8b463f34f7d151f8d928f
|
4
|
+
data.tar.gz: 21eccedc746819ae0da351f3b0391828ba361e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
6
|
+
require 'commander'
|
7
7
|
|
8
8
|
HighLine.track_eof = false
|
9
9
|
|
10
|
+
class FrameItApplication
|
11
|
+
include Commander::Methods
|
10
12
|
|
11
|
-
|
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
|
-
|
27
|
-
|
27
|
+
command :black do |c|
|
28
|
+
c.syntax = 'frameit black'
|
29
|
+
c.description = "Adds a black frame around all screenshots."
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
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
|
data/lib/frameit/editor.rb
CHANGED
@@ -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}")
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
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
|
|
data/lib/frameit/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fastimage
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|