frameit 2.6.2 → 2.7.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: ae5b2a61b61d15ef95e284805becd33d3065083a
4
- data.tar.gz: 3fbf7039b8199813d8a6ee553eb87d3759ced1d6
3
+ metadata.gz: 473c89d064c18c60ed9e3f220c5b7fa990a800ef
4
+ data.tar.gz: de0abe10f92581d5853559d30b076f731590610c
5
5
  SHA512:
6
- metadata.gz: d75de50c72ad4ae38c93897140d1f334c567c25a585f1f82ec2ed44fc370d6f046a3da0a8c03aa578917f4934a66493776fe98fc011169af98d0201038f7f686
7
- data.tar.gz: cd98080626e3d436cc3e916fd585f1928d25d2d00b35a57291ec58816b483dd1d0334686ae8d4a2cc41c79ce94f1f644b26e7dc0dae6461930dfe64012baf30a
6
+ metadata.gz: a872266a0ea54cbb28ffed9fb4bc8da10bce63d4b86fe75562ba6ac56d3d8b8c3867049c497e8b1de2299e469cdfac5e548d5b5bd6f0494e3959ac8fa65577e1
7
+ data.tar.gz: b54f1413b1f8177a8e73a9d3e37480d79ab69cf72118f2c6ed4fe651aa6c6538a8f79c70307f3905273b3935b96e424c59cd02d4e6e287caefe4e71196b5e2c4
data/README.md CHANGED
@@ -141,7 +141,8 @@ Use it to define the general information:
141
141
  "color": "#545454"
142
142
  },
143
143
  "background": "./background.jpg",
144
- "padding": 50
144
+ "padding": 50,
145
+ "show_complete_frame": false
145
146
  },
146
147
 
147
148
  "data": [
@@ -172,6 +173,7 @@ Use it to define the general information:
172
173
  ]
173
174
  }
174
175
  ```
176
+ The `show_complete_frame` value specifies whether frameit should shrink the device and frame so that they show in full in the framed screenshot. If it is false, then they can hang over the bottom of the screenshot.
175
177
 
176
178
  The `filter` value is a part of the screenshot named for which the given option should be used. If a screenshot is named `iPhone5_Brainstorming.png` the first entry in the `data` array will be used.
177
179
 
@@ -3,73 +3,5 @@
3
3
  $:.push File.expand_path("../../lib", __FILE__)
4
4
 
5
5
  require 'frameit'
6
- require 'commander'
7
-
8
- HighLine.track_eof = false
9
-
10
- class FrameItApplication
11
- include Commander::Methods
12
-
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/fastlane/frameit'
19
- program :help_formatter, :compact
20
-
21
- global_option('--verbose') { $verbose = true }
22
- FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options)
23
-
24
- default_command :run
25
-
26
- command :run do |c|
27
- c.syntax = 'frameit black'
28
- c.description = "Adds a black frame around all screenshots."
29
-
30
- c.action do |args, options|
31
- load_config(options)
32
- Frameit::Runner.new.run('.', nil)
33
- end
34
- end
35
-
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
- load_config(options)
42
- Frameit::Runner.new.run('.', Frameit::Color::SILVER)
43
- end
44
- end
45
-
46
- command :setup do |c|
47
- c.syntax = 'frameit setup'
48
- c.description = "Helps you adding new frames."
49
-
50
- c.action do |args, options|
51
- Frameit::FrameConverter.new.run
52
- end
53
- end
54
-
55
- alias_command :white, :silver
56
-
57
- run!
58
- end
59
-
60
- private
61
-
62
- def load_config(options)
63
- o = options.__hash__.dup
64
- o.delete(:verbose)
65
- Frameit.config = FastlaneCore::Configuration.create(Frameit::Options.available_options, o)
66
- end
67
- end
68
-
69
- begin
70
- FastlaneCore::UpdateChecker.start_looking_for_update('frameit')
71
- Frameit::DependencyChecker.check_dependencies
72
- FrameItApplication.new.run
73
- ensure
74
- FastlaneCore::UpdateChecker.show_update_status('frameit', Frameit::VERSION)
75
- end
6
+ require 'frameit/commands_generator'
7
+ Frameit::CommandsGenerator.start
@@ -0,0 +1,72 @@
1
+ require 'commander'
2
+
3
+ HighLine.track_eof = false
4
+
5
+ module Frameit
6
+ class CommandsGenerator
7
+ include Commander::Methods
8
+
9
+ def self.start
10
+ FastlaneCore::UpdateChecker.start_looking_for_update('frameit')
11
+ Frameit::DependencyChecker.check_dependencies
12
+ self.new.run
13
+ ensure
14
+ FastlaneCore::UpdateChecker.show_update_status('frameit', Frameit::VERSION)
15
+ end
16
+
17
+ def run
18
+ program :version, Frameit::VERSION
19
+ program :description, 'Quickly put your screenshots into the right device frames'
20
+ program :help, 'Author', 'Felix Krause <frameit@krausefx.com>'
21
+ program :help, 'Website', 'https://fastlane.tools'
22
+ program :help, 'GitHub', 'https://github.com/fastlane/frameit'
23
+ program :help_formatter, :compact
24
+
25
+ global_option('--verbose') { $verbose = true }
26
+ FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options)
27
+
28
+ default_command :run
29
+
30
+ command :run do |c|
31
+ c.syntax = 'frameit black'
32
+ c.description = "Adds a black frame around all screenshots."
33
+
34
+ c.action do |args, options|
35
+ load_config(options)
36
+ Frameit::Runner.new.run('.', nil)
37
+ end
38
+ end
39
+
40
+ command :silver do |c|
41
+ c.syntax = 'frameit silver'
42
+ c.description = "Adds a silver frame around all screenshots."
43
+
44
+ c.action do |args, options|
45
+ load_config(options)
46
+ Frameit::Runner.new.run('.', Frameit::Color::SILVER)
47
+ end
48
+ end
49
+
50
+ command :setup do |c|
51
+ c.syntax = 'frameit setup'
52
+ c.description = "Helps you adding new frames."
53
+
54
+ c.action do |args, options|
55
+ Frameit::FrameConverter.new.run
56
+ end
57
+ end
58
+
59
+ alias_command :white, :silver
60
+
61
+ run!
62
+ end
63
+
64
+ private
65
+
66
+ def load_config(options)
67
+ o = options.__hash__.dup
68
+ o.delete(:verbose)
69
+ Frameit.config = FastlaneCore::Configuration.create(Frameit::Options.available_options, o)
70
+ end
71
+ end
72
+ end
@@ -2,7 +2,7 @@ module Frameit
2
2
  class ConfigParser
3
3
  def load(path)
4
4
  return nil unless File.exist?(path) # we are okay with no config at all
5
- UI.message "Parsing config file '#{path}'" if $verbose
5
+ UI.verbose("Parsing config file '#{path}'")
6
6
  @path = path
7
7
  self.parse(File.read(path))
8
8
  end
@@ -59,33 +59,35 @@ module Frameit
59
59
  # Make sure the paths/colors are valid
60
60
  def validate_values(values)
61
61
  values.each do |key, value|
62
- if value.kind_of? Hash
62
+ if value.kind_of?(Hash)
63
63
  validate_values(value) # recursive call
64
64
  else
65
65
  if key == 'font'
66
- UI.user_error! "Could not find font at path '#{File.expand_path(value)}'" unless File.exist? value
66
+ UI.user_error!("Could not find font at path '#{File.expand_path(value)}'") unless File.exist?(value)
67
67
  end
68
68
 
69
69
  if key == 'fonts'
70
- UI.user_error! "`fonts` must be an array" unless value.kind_of? Array
70
+ UI.user_error!("`fonts` must be an array") unless value.kind_of?(Array)
71
71
 
72
72
  value.each do |current|
73
- UI.user_error! "You must specify a font path" if current.fetch('font', '').length == 0
74
- UI.user_error! "Could not find font at path '#{File.expand_path(current.fetch('font'))}'" unless File.exist? current.fetch('font')
75
- UI.user_error! "`supported` must be an array" unless current.fetch('supported', []).kind_of? Array
73
+ UI.user_error!("You must specify a font path") if current.fetch('font', '').length == 0
74
+ UI.user_error!("Could not find font at path '#{File.expand_path(current.fetch('font'))}'") unless File.exist?(current.fetch('font'))
75
+ UI.user_error!("`supported` must be an array") unless current.fetch('supported', []).kind_of? Array
76
76
  end
77
77
  end
78
78
 
79
79
  if key == 'background'
80
- UI.user_error! "Could not find background image at path '#{File.expand_path(value)}'" unless File.exist? value
80
+ UI.user_error!("Could not find background image at path '#{File.expand_path(value)}'") unless File.exist? value
81
81
  end
82
82
 
83
83
  if key == 'color'
84
- UI.user_error! "Invalid color '#{value}'. Must be valid Hex #123123" unless value.include? "#"
84
+ UI.user_error!("Invalid color '#{value}'. Must be valid Hex #123123") unless value.include?("#")
85
85
  end
86
86
 
87
87
  if key == 'padding'
88
- UI.user_error! "padding must be type integer or pair of integers of format 'AxB'" unless value.kind_of?(Integer) || value.split('x').length == 2
88
+ unless value.kind_of?(Integer) || value.split('x').length == 2
89
+ UI.user_error!("padding must be type integer or pair of integers of format 'AxB'")
90
+ end
89
91
  end
90
92
  end
91
93
  end
@@ -142,6 +142,12 @@ module Frameit
142
142
  end
143
143
 
144
144
  def put_device_into_background(background)
145
+ show_complete_frame = fetch_config['show_complete_frame']
146
+ if show_complete_frame
147
+ max_height = background.height - top_space_above_device
148
+ image.resize "x#{max_height}>"
149
+ end
150
+
145
151
  left_space = (background.width / 2.0 - image.width / 2.0).round
146
152
 
147
153
  @image = background.composite(image, "png") do |c|
@@ -179,7 +185,7 @@ module Frameit
179
185
  # too large - resizing now
180
186
  smaller = (1.0 / ratio)
181
187
 
182
- UI.message "Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}" if $verbose
188
+ UI.verbose("Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}")
183
189
 
184
190
  title.resize "#{(smaller * title.width).round}x"
185
191
  keyword.resize "#{(smaller * keyword.width).round}x" if keyword
@@ -235,8 +241,8 @@ module Frameit
235
241
 
236
242
  current_font = font(key)
237
243
  text = fetch_text(key)
238
- UI.message "Using #{current_font} as font the #{key} of #{screenshot.path}" if $verbose and current_font
239
- UI.message "Adding text '#{text}'" if $verbose
244
+ UI.verbose("Using #{current_font} as font the #{key} of #{screenshot.path}") if current_font
245
+ UI.verbose("Adding text '#{text}'")
240
246
 
241
247
  text.gsub! '\n', "\n"
242
248
 
@@ -281,7 +287,7 @@ module Frameit
281
287
 
282
288
  # No string files, fallback to Framefile config
283
289
  result = fetch_config[type.to_s]['text'] if fetch_config[type.to_s]
284
- UI.message "Falling back to default text as there was nothing specified in the .strings file" if $verbose
290
+ UI.verbose("Falling back to default text as there was nothing specified in the .strings file")
285
291
 
286
292
  if type == :title and !result
287
293
  # title is mandatory
@@ -307,13 +313,13 @@ module Frameit
307
313
  end
308
314
  else
309
315
  # No `supported` array, this will always be true
310
- UI.message "Found a font with no list of supported languages, using this now" if $verbose
316
+ UI.verbose("Found a font with no list of supported languages, using this now")
311
317
  return font["font"]
312
318
  end
313
319
  end
314
320
  end
315
321
 
316
- UI.message "No custom font specified for #{screenshot}, using the default one" if $verbose
322
+ UI.verbose("No custom font specified for #{screenshot}, using the default one")
317
323
  return nil
318
324
  end
319
325
  end
@@ -1,3 +1,3 @@
1
1
  module Frameit
2
- VERSION = "2.6.2".freeze
2
+ VERSION = "2.7.0".freeze
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: 2.6.2
4
+ version: 2.7.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: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -225,6 +225,7 @@ files:
225
225
  - bin/frameit
226
226
  - lib/assets/empty.png
227
227
  - lib/frameit.rb
228
+ - lib/frameit/commands_generator.rb
228
229
  - lib/frameit/config_parser.rb
229
230
  - lib/frameit/dependency_checker.rb
230
231
  - lib/frameit/device_types.rb
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
259
  version: '0'
259
260
  requirements: []
260
261
  rubyforge_project:
261
- rubygems_version: 2.6.2
262
+ rubygems_version: 2.4.8
262
263
  signing_key:
263
264
  specification_version: 4
264
265
  summary: Quickly put your screenshots into the right device frames