skeleton-ui 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: e5058006d22b824cf0ee9c8301301d727ba7154d1bb9ddedb8bcb0de8499dd2d
4
- data.tar.gz: f90ceeb4bc70f85cb31985ea8624ef46b160f3c4ceaa23fcb7a264db61768c2b
3
+ metadata.gz: 5257b8d04043400f487c2b9a77bbf8047de5b21374283add68698b1785a6224a
4
+ data.tar.gz: 32556ec05afce6349e8404780158349c6b97eb15591f723ba820e9f926fa055c
5
5
  SHA512:
6
- metadata.gz: ddda2e82e23fea5f6fd934c1067277993ade7f4d76fccf4acf1fbb86aec41c6e6d99a09751b971c9a56a34424f691f0b10b05c777bf0f84f0f2e19479c9d56ec
7
- data.tar.gz: 30da30b97b76e1a9b4a652fb1803f983177d6a7faf87a5d53571bc0e611cabfd3122021b7adb6fd7284aeea4383ff64b97096c0bf25559f601262f6fa069d75f
6
+ metadata.gz: 701ae03bf7beb1e3a8384c8685050cf62cc70c3fb624a6f97d3246054cd06d5407e9986a8b91721648848ad71d5ec10bb583281ffeff0b7ab9c99ec021454f67
7
+ data.tar.gz: ef0aecdff8b5aebda6744c51deb2b872352511989b0731cfd481692bed34270d064930bc3f29a27523e9d9261f26299fef17969b6b161f1998a1bc06ad2dba98
data/README.md CHANGED
@@ -16,6 +16,7 @@ Prerequisites:
16
16
  #### iOS
17
17
  - Install [Xcode](https://developer.apple.com/xcode/download/).
18
18
  - Install [Xcode Command Line Tools](http://railsapps.github.io/xcode-command-line-tools.html).
19
+ - Install [ideviceinstaller](http://brewformulas.org/Ideviceinstaller)
19
20
 
20
21
  Installation:
21
22
  ------
data/bin/skeleton CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'commander/import'
4
4
  require_relative '../lib/skeleton'
5
+ require_relative '../lib/skeleton/root'
5
6
 
6
7
  module Skeleton
7
8
  program :version, VERSION
@@ -37,7 +38,7 @@ module Skeleton
37
38
  c.option '-p', '--port PORT', String, 'Set web-server port'
38
39
  c.action do |_args, options|
39
40
  options.default(port: 4567)
40
- system("cd ../html/ && ruby server.rb #{options.port}")
41
+ system("ruby #{Base::ROOT_DIR}/html/server.rb #{options.port}")
41
42
  end
42
43
  end
43
- end
44
+ end
data/html/server.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  require 'sinatra'
2
+ require_relative '../lib/skeleton/root'
2
3
 
3
4
  set :port, ARGV[0]
4
5
 
5
6
  get '/:file' do
6
- send_file params[:file]
7
+ send_file "#{Base::ROOT_DIR}/html/#{params[:file]}"
7
8
  end
8
9
 
9
10
  post '/:file' do
10
- send_file params[:file]
11
+ send_file "#{Base::ROOT_DIR}/html/#{params[:file]}"
11
12
  end
data/lib/skeleton.rb CHANGED
@@ -61,9 +61,9 @@ module Skeleton
61
61
  @elements_tree.gsub!('<', '&lt;')
62
62
  @elements_tree.gsub!('>', '&gt;')
63
63
  end
64
- template = File.read('../html/template.html.erb')
64
+ template = File.read("#{Base::ROOT_DIR}/html/template.html.erb")
65
65
  result = ERB.new(template).result(binding)
66
- File.open("../html/#{lang}.html", 'w+') { |f| f.write(result) }
66
+ File.open("#{Base::ROOT_DIR}/html/#{lang}.html", 'w+') { |f| f.write(result) }
67
67
  end
68
68
  end
69
69
 
@@ -71,7 +71,7 @@ module Skeleton
71
71
  screenshot = Dir["#{Base::ATTACHMENTS_FOLDER}/*.png"].first
72
72
  image = MiniMagick::Image.new(screenshot)
73
73
  image.rotate(90) if image.width > image.height
74
- FileUtils.cp_r(screenshot, '../html/screenshot.png')
74
+ FileUtils.cp_r(screenshot, "#{Base::ROOT_DIR}/html/screenshot.png")
75
75
  rescue MiniMagick::Error => e
76
76
  @driver.log.error(e)
77
77
  end
data/lib/skeleton/ios.rb CHANGED
@@ -28,6 +28,7 @@ class IOS < Base
28
28
  def skeletoner
29
29
  log.info('We starting to skeleton your screen 🚀')
30
30
  check_udid
31
+ check_bundle
31
32
  page_source
32
33
  create_page_objects
33
34
  save_screenshot
@@ -123,10 +124,9 @@ class IOS < Base
123
124
  @page_source.slice!(start_grep)
124
125
  @page_source.slice!(end_grep)
125
126
  if @page_source.empty?
126
- log.fatal("Something went wrong.\n" \
127
- "1. Try to sign Skeleton in #{XCODEPROJ_FOLDER}\n" \
128
- "2. Check in the iOS settings that Skeleton is trust developer.\n" \
129
- '3. Check your app bundle_id')
127
+ log.fatal("Try to sign Skeleton in #{XCODEPROJ_FOLDER}.\n" \
128
+ 'For more info read: https://github.com/forqa/skeleton/' \
129
+ 'blob/master/docs/real-ios-device-config.md')
130
130
  raise
131
131
  end
132
132
  log.info('Successfully getting Screen Source Tree 🔥')
@@ -144,6 +144,18 @@ class IOS < Base
144
144
  raise
145
145
  end
146
146
 
147
+ def check_bundle
148
+ if @simulator
149
+ return if `xcrun simctl appinfo #{@udid} #{@bundle_id}`
150
+ .include?("CFBundleName")
151
+ else
152
+ return if `ideviceinstaller -u #{@udid} -l`
153
+ .include?(@bundle_id)
154
+ end
155
+ log.fatal("No such apps with bundle_id: #{@bundle_id}")
156
+ raise
157
+ end
158
+
147
159
  def save_screenshot
148
160
  log.info('Saving screenshot 📷')
149
161
  png_path = "#{XCRESULTS_FOLDER}/Attachments/*.png"
data/lib/skeleton/root.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require_relative 'version'
2
+
1
3
  class Base
2
- ROOT_DIR = File.expand_path('..', Dir.pwd)
3
- #ROOT_DIR = "#{`gem environment gemdir`.strip}" \
4
- # "/gems/#{Skeleton::GEM_NAME}-#{Skeleton::VERSION}"
4
+ # ROOT_DIR = File.expand_path('..', Dir.pwd)
5
+ ROOT_DIR = "#{`gem environment gemdir`.strip}" \
6
+ "/gems/#{Skeleton::GEM_NAME}-#{Skeleton::VERSION}"
5
7
  end
@@ -1,4 +1,4 @@
1
1
  module Skeleton
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  GEM_NAME = 'skeleton-ui'
4
4
  end
data/skeleton.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "colorize", "~> 0.8.1"
31
31
  spec.add_dependency "mini_magick", "~> 4.8.0"
32
32
  spec.add_dependency "nokogiri", "~> 1.8.2"
33
+ spec.add_dependency "sinatra", "~> 2.0.3"
33
34
  spec.add_dependency "fileutils"
34
35
  spec.add_dependency "commander"
35
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skeleton-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - a.alterpesotskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-12 00:00:00.000000000 Z
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.8.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: sinatra
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.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: 2.0.3
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: fileutils
99
113
  requirement: !ruby/object:Gem::Requirement