frameit 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +98 -0
- data/bin/frameit +51 -0
- data/lib/frameit.rb +14 -0
- data/lib/frameit/dependency_checker.rb +29 -0
- data/lib/frameit/editor.rb +155 -0
- data/lib/frameit/frame_converter.rb +77 -0
- data/lib/frameit/helper.rb +51 -0
- data/lib/frameit/update_checker.rb +45 -0
- data/lib/frameit/version.rb +3 -0
- metadata +29 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 282b80c6a1c36585b03f673281420a00cb2a6199
|
4
|
+
data.tar.gz: c6a680cb4695176fa45a502de590910d4b375756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24064baaba326038de4a40f1013b7a8af47e8591ec8538f1abb4bed5b911335232f799a70a90304a3f5323fc120650a6c14ab69334f2855efcf8084a3f6a09b9
|
7
|
+
data.tar.gz: 15fbdbcbca9d926b69ae115ff955139bcfbe78cdeef5d2fe179f5fa59ad285227d288de235f4da6f5115d96dd04c8ae50ad6d08c33e1de99a37b3d51e27cc315
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Felix Krause
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://github.com/KrauseFx/deliver">Deliver</a> •
|
3
|
+
<a href="https://github.com/KrauseFx/snapshot">Snapshot</a> •
|
4
|
+
<b>FrameIt</b>
|
5
|
+
</p>
|
6
|
+
-------
|
7
|
+
|
8
|
+
<p align="center">
|
9
|
+
<img src="assets/frameit.png">
|
10
|
+
</p>
|
11
|
+
|
12
|
+
FrameIt - Add gorgeous device frames around your screenshots
|
13
|
+
============
|
14
|
+
|
15
|
+
[![Twitter: @KauseFx](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
|
16
|
+
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/KrauseFx/frameit/blob/master/LICENSE)
|
17
|
+
[![Gem](https://img.shields.io/gem/v/frameit.svg?style=flat)](http://rubygems.org/gems/frameit)
|
18
|
+
|
19
|
+
Want a device frame around your screenshot? Do it in an instant!
|
20
|
+
|
21
|
+
Follow the developer on Twitter: [@KrauseFx](https://twitter.com/KrauseFx)
|
22
|
+
|
23
|
+
|
24
|
+
-------
|
25
|
+
[Features](#features) •
|
26
|
+
[Installation](#installation) •
|
27
|
+
[Usage](#usage) •
|
28
|
+
[Tips](#tips) •
|
29
|
+
[Need help?](#need-help)
|
30
|
+
|
31
|
+
-------
|
32
|
+
|
33
|
+
|
34
|
+
# Features
|
35
|
+
|
36
|
+
Put a gorgeous device frame around your iOS screenshots just by running one simple command. Support for:
|
37
|
+
- iPhone 6 Plus, iPhone 6, iPhone 5s and iPad Air
|
38
|
+
- Portrait and Landscape
|
39
|
+
- Black and Silver devices
|
40
|
+
|
41
|
+
Here is a nice gif, that shows ```frameit``` in action:
|
42
|
+
|
43
|
+
![assets/FrameitGit.gif](assets/FrameitGit.gif)
|
44
|
+
|
45
|
+
Here is how the result can look like
|
46
|
+
![assets/Overview.png](assets/Overview.png)
|
47
|
+
|
48
|
+
# Installation
|
49
|
+
|
50
|
+
Install the gem
|
51
|
+
|
52
|
+
sudo gem install frameit
|
53
|
+
|
54
|
+
Because of legal reasons, I can not pre-package the device frames with ```FrameIt```.
|
55
|
+
|
56
|
+
The process of adding is really easy, just run ```frameit``` and the guide will help you set it up.
|
57
|
+
You only have to do this once per computer.
|
58
|
+
|
59
|
+
- Run ```frameit```
|
60
|
+
- Press ```Enter```. The [Apple page](https://developer.apple.com/app-store/marketing/guidelines/#images) to download the images should open in your browser.
|
61
|
+
- Download the devices you want to use
|
62
|
+
- Press ```Enter```
|
63
|
+
- Unzip and move the content of the zip files to ```~/.frameit/device_frames```
|
64
|
+
- Press ```Enter```
|
65
|
+
|
66
|
+
# Usage
|
67
|
+
|
68
|
+
Why should you have to use Photoshop, just to add a frame around your screenshots?
|
69
|
+
|
70
|
+
Just navigate to your folder of screenshots and try the following:
|
71
|
+
|
72
|
+
- ```frameit```
|
73
|
+
- ```frameit silver```
|
74
|
+
|
75
|
+
# Tips
|
76
|
+
|
77
|
+
## Use a clean status bar
|
78
|
+
You can use [SimulatorStatusMagic](https://github.com/shinydevelopment/SimulatorStatusMagic) to clean up the status bar.
|
79
|
+
|
80
|
+
## Uninstall
|
81
|
+
- ```sudo gem uninstall frameit```
|
82
|
+
- ```rm -rf ~/.frameit```
|
83
|
+
|
84
|
+
# Need help?
|
85
|
+
- If there is a technical problem with ```FrameIt```, submit an issue. Run ```frameit --trace``` to get the stacktrace.
|
86
|
+
- I'm available for contract work - drop me an email: frameit@felixkrause.at
|
87
|
+
|
88
|
+
# License
|
89
|
+
This project is licensed under the terms of the MIT license. See the LICENSE file.
|
90
|
+
|
91
|
+
# Contributing
|
92
|
+
|
93
|
+
1. Create an issue to discuss about your idea
|
94
|
+
2. Fork it (https://github.com/KrauseFx/frameit/fork)
|
95
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
96
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
97
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
98
|
+
6. Create a new Pull Request
|
data/bin/frameit
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
4
|
+
|
5
|
+
require 'frameit'
|
6
|
+
require 'commander/import'
|
7
|
+
require 'frameit/update_checker'
|
8
|
+
require 'frameit/dependency_checker'
|
9
|
+
|
10
|
+
HighLine.track_eof = false
|
11
|
+
|
12
|
+
|
13
|
+
# Commander
|
14
|
+
program :version, Frameit::VERSION
|
15
|
+
program :description, 'Find all screenshots in current folder and put a nice frame around it. This will duplicate the images.'
|
16
|
+
program :help, 'Author', 'Felix Krause <krausefx@gmail.com>'
|
17
|
+
program :help, 'Website', 'http://felixkrause.at'
|
18
|
+
program :help, 'GitHub', 'https://github.com/krausefx/frameit'
|
19
|
+
program :help_formatter, :compact
|
20
|
+
|
21
|
+
global_option('--verbose') { $verbose = true }
|
22
|
+
|
23
|
+
|
24
|
+
Frameit::UpdateChecker.verify_latest_version
|
25
|
+
|
26
|
+
default_command :black
|
27
|
+
|
28
|
+
|
29
|
+
command :black do |c|
|
30
|
+
c.syntax = 'frameit black'
|
31
|
+
|
32
|
+
c.action do |args, options|
|
33
|
+
Frameit::DependencyChecker.check_dependencies
|
34
|
+
Frameit::Editor.new.run('.', Frameit::Editor::Color::BLACK)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
command :silver do |c|
|
39
|
+
c.syntax = 'frameit silver'
|
40
|
+
|
41
|
+
c.action do |args, options|
|
42
|
+
Frameit::DependencyChecker.check_dependencies
|
43
|
+
Frameit::Editor.new.run('.', Frameit::Editor::Color::SILVER)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
alias_command :white, :silver
|
48
|
+
|
49
|
+
def shared_run(c)
|
50
|
+
c.description = 'Find all screenshots in current folder and put a nice frame around it. This will duplicate the images.'
|
51
|
+
end
|
data/lib/frameit.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Frameit
|
2
|
+
class DependencyChecker
|
3
|
+
def self.check_dependencies
|
4
|
+
self.check_image_magick
|
5
|
+
# self.check_xctool
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.check_image_magick
|
9
|
+
unless `which convert`.include?"convert"
|
10
|
+
Helper.log.fatal '#############################################################'
|
11
|
+
Helper.log.fatal "# You have to install the ImageMagick to use FrameIt"
|
12
|
+
Helper.log.fatal "# Install it using 'brew update && brew install imagemagick'"
|
13
|
+
Helper.log.fatal "# If you don't have homebrew: http://brew.sh"
|
14
|
+
Helper.log.fatal '#############################################################'
|
15
|
+
raise "Install ImageMagick and start frameit again!"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# def self.check_xctool
|
20
|
+
# if not self.xctool_installed?
|
21
|
+
# Helper.log.error '#############################################################'
|
22
|
+
# Helper.log.error "# xctool is recommended to build the apps"
|
23
|
+
# Helper.log.error "# Install it using 'brew install xctool'"
|
24
|
+
# Helper.log.error "# Falling back to xcode build instead "
|
25
|
+
# Helper.log.error '#############################################################'
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'fastimage'
|
2
|
+
|
3
|
+
module Frameit
|
4
|
+
class Editor
|
5
|
+
module Color
|
6
|
+
BLACK = "SpaceGray"
|
7
|
+
SILVER = "Slvr"
|
8
|
+
end
|
9
|
+
|
10
|
+
module Orientation
|
11
|
+
PORTRAIT = "Vert"
|
12
|
+
LANDSCAPE = "Horz"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
FrameConverter.new.run
|
18
|
+
end
|
19
|
+
|
20
|
+
def run(path, color = Color::BLACK)
|
21
|
+
@color = color
|
22
|
+
|
23
|
+
Dir["#{path}/**/*.png"].each do |screenshot|
|
24
|
+
next if screenshot.include?"_framed.png"
|
25
|
+
begin
|
26
|
+
template_path = get_template(screenshot)
|
27
|
+
if template_path
|
28
|
+
template = MiniMagick::Image.open(template_path)
|
29
|
+
image = MiniMagick::Image.open(screenshot)
|
30
|
+
|
31
|
+
offset_information = image_offset(screenshot)
|
32
|
+
raise "Could not find offset_information for '#{screenshot}'" unless (offset_information and offset_information[:width])
|
33
|
+
width = offset_information[:width]
|
34
|
+
image.resize width
|
35
|
+
|
36
|
+
result = template.composite(image) do |c|
|
37
|
+
c.compose "Over"
|
38
|
+
c.geometry offset_information[:offset]
|
39
|
+
end
|
40
|
+
|
41
|
+
output_path = screenshot.gsub('.png', '_framed.png')
|
42
|
+
result.write output_path
|
43
|
+
Helper.log.info "Successfully framed screenshots at path '#{output_path}'".green
|
44
|
+
end
|
45
|
+
rescue Exception => ex
|
46
|
+
Helper.log.error ex
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# This will detect the screen size and choose the correct template
|
52
|
+
def get_template(path)
|
53
|
+
parts = [
|
54
|
+
device_name(screen_size(path)),
|
55
|
+
orientation_name(path),
|
56
|
+
@color
|
57
|
+
]
|
58
|
+
|
59
|
+
templates_path = [ENV['HOME'], FrameConverter::FRAME_PATH].join('/')
|
60
|
+
templates = Dir["#{templates_path}/**/#{parts.join('_')}*.png"]
|
61
|
+
|
62
|
+
if templates.count == 0
|
63
|
+
if screen_size(path) == Deliver::AppScreenshot::ScreenSize::IOS_35
|
64
|
+
Helper.log.warn "Unfortunately 3.5\" device frames were discontinued. Skipping screen '#{path}'".yellow
|
65
|
+
else
|
66
|
+
Helper.log.error "Could not find a valid template for screenshot '#{path}'".red
|
67
|
+
Helper.log.error "You can download new templates from '#{FrameConverter::DOWNLOAD_URL}'"
|
68
|
+
Helper.log.error "and store them in '#{templates_path}'"
|
69
|
+
Helper.log.error "Missing file: '#{parts.join('_')}.psd'".red
|
70
|
+
end
|
71
|
+
return nil
|
72
|
+
else
|
73
|
+
# Helper.log.debug "Found template '#{templates.first}' for screenshot '#{path}'"
|
74
|
+
return templates.first.gsub(" ", "\ ")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
def screen_size(path)
|
80
|
+
Deliver::AppScreenshot.calculate_screen_size(path)
|
81
|
+
end
|
82
|
+
|
83
|
+
def device_name(screen_size)
|
84
|
+
size = Deliver::AppScreenshot::ScreenSize
|
85
|
+
case screen_size
|
86
|
+
when size::IOS_55
|
87
|
+
return 'iPhone_6_Plus'
|
88
|
+
when size::IOS_47
|
89
|
+
return 'iPhone_6'
|
90
|
+
when size::IOS_40
|
91
|
+
return 'iPhone_5s'
|
92
|
+
when size::IOS_IPAD
|
93
|
+
return 'iPad_Air'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def orientation_name(path)
|
98
|
+
size = FastImage.size(path)
|
99
|
+
return Orientation::PORTRAIT if size[0] < size[1]
|
100
|
+
return Orientation::LANDSCAPE
|
101
|
+
end
|
102
|
+
|
103
|
+
def image_offset(path)
|
104
|
+
size = Deliver::AppScreenshot::ScreenSize
|
105
|
+
case orientation_name(path)
|
106
|
+
when Orientation::PORTRAIT
|
107
|
+
case screen_size(path)
|
108
|
+
when size::IOS_55
|
109
|
+
return {
|
110
|
+
offset: '+42+147',
|
111
|
+
width: 539
|
112
|
+
}
|
113
|
+
when size::IOS_47
|
114
|
+
return {
|
115
|
+
offset: '+41+154',
|
116
|
+
width: 530
|
117
|
+
}
|
118
|
+
when size::IOS_40
|
119
|
+
return {
|
120
|
+
offset: "+54+197",
|
121
|
+
width: 543
|
122
|
+
}
|
123
|
+
when size::IOS_IPAD
|
124
|
+
return {
|
125
|
+
offset: '+57+112',
|
126
|
+
width: 765
|
127
|
+
}
|
128
|
+
end
|
129
|
+
when Orientation::LANDSCAPE
|
130
|
+
case screen_size(path)
|
131
|
+
when size::IOS_55
|
132
|
+
return {
|
133
|
+
offset: "+146+41",
|
134
|
+
width: 960
|
135
|
+
}
|
136
|
+
when size::IOS_47
|
137
|
+
return {
|
138
|
+
offset: "+153+41",
|
139
|
+
width: 946
|
140
|
+
}
|
141
|
+
when size::IOS_40
|
142
|
+
return {
|
143
|
+
offset: "+201+48",
|
144
|
+
width: 970
|
145
|
+
}
|
146
|
+
when size::IOS_IPAD
|
147
|
+
return {
|
148
|
+
offset: '+113+57',
|
149
|
+
width: 1024
|
150
|
+
}
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Frameit
|
2
|
+
class FrameConverter
|
3
|
+
DOWNLOAD_URL = 'https://developer.apple.com/app-store/marketing/guidelines/#images'
|
4
|
+
FRAME_PATH = '.frameit/devices_frames'
|
5
|
+
|
6
|
+
def run
|
7
|
+
@templates_path = "#{ENV['HOME']}/#{FRAME_PATH}"
|
8
|
+
|
9
|
+
self.setup_frames
|
10
|
+
end
|
11
|
+
|
12
|
+
def templates_path
|
13
|
+
@templates_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup_frames
|
17
|
+
unless frames_exist?
|
18
|
+
puts "----------------------------------------------------".green
|
19
|
+
puts "Looks like you have no device templates installed".green
|
20
|
+
puts "The images can not be pre-installed due to licensing".green
|
21
|
+
puts "Press Enter to get started".green
|
22
|
+
puts "----------------------------------------------------".green
|
23
|
+
STDIN.gets
|
24
|
+
|
25
|
+
system("open '#{DOWNLOAD_URL}'")
|
26
|
+
puts "----------------------------------------------------".green
|
27
|
+
puts "Download the zip files for the following devices".green
|
28
|
+
puts "iPhone 6, iPhone 6 Plus, iPhone 5s and iPad Air".green
|
29
|
+
puts "You only need to download the devices you want to use".green
|
30
|
+
puts "Press Enter when you downloaded the zip files".green
|
31
|
+
puts "----------------------------------------------------".green
|
32
|
+
STDIN.gets
|
33
|
+
|
34
|
+
while not frames_exist?
|
35
|
+
system("mkdir -p '#{@templates_path}' && open '#{@templates_path}'")
|
36
|
+
puts "----------------------------------------------------".green
|
37
|
+
puts "Extract the downloaded files into the folder".green
|
38
|
+
puts "'#{@templates_path}', which should be open in your Finder'".green
|
39
|
+
puts "You can just copy the whole content into it.'".green
|
40
|
+
puts "The structure doesn't matter.".green
|
41
|
+
puts "Press Enter when you downloaded the zip files".green
|
42
|
+
puts "----------------------------------------------------".green
|
43
|
+
STDIN.gets
|
44
|
+
|
45
|
+
if not frames_exist?
|
46
|
+
puts "Sorry, I can't find the PSD files. Make sure you unzipped them into '#{@templates_path}'".red
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
convert_frames
|
52
|
+
end
|
53
|
+
|
54
|
+
def frames_exist?
|
55
|
+
Dir["#{@templates_path}/**/*.psd"].count > 0
|
56
|
+
end
|
57
|
+
|
58
|
+
# Converts all the PSD files to trimmed PNG files
|
59
|
+
def convert_frames
|
60
|
+
Dir["#{@templates_path}/**/*.psd"].each do |psd|
|
61
|
+
resulting_path = psd.gsub('.psd', '.png')
|
62
|
+
unless File.exists?resulting_path
|
63
|
+
Helper.log.debug "Converting PSD file '#{psd}'".yellow
|
64
|
+
image = MiniMagick::Image.open(psd)
|
65
|
+
if image
|
66
|
+
image.format 'png'
|
67
|
+
image.trim
|
68
|
+
|
69
|
+
image.write(resulting_path)
|
70
|
+
else
|
71
|
+
Helper.log.error "Could not parse PSD file at path '#{psd}'"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Frameit
|
4
|
+
class Helper
|
5
|
+
|
6
|
+
|
7
|
+
# Logging happens using this method
|
8
|
+
def self.log
|
9
|
+
if is_test?
|
10
|
+
@@log ||= Logger.new(STDOUT) # don't show any logs when running tests
|
11
|
+
else
|
12
|
+
@@log ||= Logger.new(STDOUT)
|
13
|
+
end
|
14
|
+
|
15
|
+
@@log.formatter = proc do |severity, datetime, progname, msg|
|
16
|
+
string = "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: "
|
17
|
+
second = "#{msg}\n"
|
18
|
+
|
19
|
+
if severity == "DEBUG"
|
20
|
+
string = string.magenta
|
21
|
+
elsif severity == "INFO"
|
22
|
+
string = string.white
|
23
|
+
elsif severity == "WARN"
|
24
|
+
string = string.yellow
|
25
|
+
elsif severity == "ERROR"
|
26
|
+
string = string.red
|
27
|
+
elsif severity == "FATAL"
|
28
|
+
string = string.red.bold
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
[string, second].join("")
|
33
|
+
end
|
34
|
+
|
35
|
+
@@log
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return true if the currently running program is a unit test
|
39
|
+
def self.is_test?
|
40
|
+
defined?SpecHelper
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return the full path to the Xcode developer tools of the currently
|
44
|
+
# running system
|
45
|
+
def self.xcode_path
|
46
|
+
return "" if self.is_test? and not OS.mac?
|
47
|
+
`xcode-select -p`.gsub("\n", '') + "/"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Frameit
|
4
|
+
# Verifies, the user runs the latest version of this gem
|
5
|
+
class UpdateChecker
|
6
|
+
# This method will check if the latest version is installed and show a warning if that's not the case
|
7
|
+
def self.verify_latest_version
|
8
|
+
if self.update_available?
|
9
|
+
v = fetch_latest
|
10
|
+
puts '#######################################################################'.green
|
11
|
+
puts "# FrameIt #{v} is available.".green
|
12
|
+
puts "# It is recommended to use the latest version.".green
|
13
|
+
puts "# Update using '(sudo) gem update frameit'.".green
|
14
|
+
puts "# To see what's new, open https://github.com/KrauseFx/frameit/releases.".green
|
15
|
+
puts '#######################################################################'.green
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
# Is a new official release available (this does not include pre-releases)
|
22
|
+
def self.update_available?
|
23
|
+
begin
|
24
|
+
latest = fetch_latest
|
25
|
+
if latest and Gem::Version.new(latest) > Gem::Version.new(current_version)
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
rescue Exception => ex
|
29
|
+
Helper.log.debug(ex)
|
30
|
+
Helper.log.error("Could not check if 'frameit' is up to date.")
|
31
|
+
end
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
|
35
|
+
# The currently used version of this gem
|
36
|
+
def self.current_version
|
37
|
+
Frameit::VERSION
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def self.fetch_latest
|
42
|
+
JSON.parse(open("http://rubygems.org/api/v1/gems/frameit.json").read)["version"]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
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.0
|
4
|
+
version: 0.1.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: 2014-11-
|
11
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.8.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: deliver
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.3'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.3'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,10 +196,21 @@ description: Take the pain out of using Photoshop, just to add a device around y
|
|
182
196
|
screenshot.
|
183
197
|
email:
|
184
198
|
- krausefx@gmail.com
|
185
|
-
executables:
|
199
|
+
executables:
|
200
|
+
- frameit
|
186
201
|
extensions: []
|
187
202
|
extra_rdoc_files: []
|
188
|
-
files:
|
203
|
+
files:
|
204
|
+
- LICENSE
|
205
|
+
- README.md
|
206
|
+
- bin/frameit
|
207
|
+
- lib/frameit.rb
|
208
|
+
- lib/frameit/dependency_checker.rb
|
209
|
+
- lib/frameit/editor.rb
|
210
|
+
- lib/frameit/frame_converter.rb
|
211
|
+
- lib/frameit/helper.rb
|
212
|
+
- lib/frameit/update_checker.rb
|
213
|
+
- lib/frameit/version.rb
|
189
214
|
homepage: http://felixkrause.at
|
190
215
|
licenses:
|
191
216
|
- MIT
|