motion-blow 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2I5YzUzMjcxMzA2MmVjMDAzNmQ0ZGVhZDhhNTFkOGY1YWZhMjlhNw==
5
+ data.tar.gz: !binary |-
6
+ YmQ2NjEzNmIwN2ZmYzk4MTQ4ZTdkODk5NDQzYmIwNGI0OWJiY2I2Mw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Y2UzOTY4YzJlMzk5OThhOWJjMDg0NjY1ODg3NDVhOWJjNDA4MTBhOTgxZTFm
10
+ ODFiNzVhYTFhYTQ5ZWQzOTAzMDY0YTA4ZWYxMTdmYWM4YTY5ZDg5OGU1YTNl
11
+ YmZlYWQyNTQxYTY5MThkMGY3ZmZkMzUyMTEzZGUwNGQyNzhhNWY=
12
+ data.tar.gz: !binary |-
13
+ MDBiMWY0YjAxODRhY2Q4ZTBlN2NkODM0YzNkYjdjZTgyMTAxNGM5YjQwMGQz
14
+ ZDc5Y2YzYzQwOTI1NGQ3NjFjYmQ4NjNjMmU3OTJlYzk1ZDJjZjA0MzAzYmFj
15
+ ZjY2MDYxOWU4ZGQ4NWYxZTVkZTI2MzgzNmU1NDNmN2I2Y2U4NDc=
@@ -0,0 +1,4 @@
1
+ build
2
+ env.sh
3
+ *.psd
4
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'sugarcube'
5
+ gem 'motion-map'
6
+ gem 'motion-awesome'
7
+
8
+ group :development do
9
+ end
10
+
11
+ group :spec do
12
+ gem "motion-stump"
13
+ end
@@ -0,0 +1,19 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ motion-awesome (0.0.4)
5
+ motion-map
6
+ motion-map (0.0.4)
7
+ motion-stump (0.2.1)
8
+ rake (10.0.4)
9
+ sugarcube (0.20.20)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ motion-awesome
16
+ motion-map
17
+ motion-stump
18
+ rake
19
+ sugarcube
@@ -0,0 +1,83 @@
1
+ # MotionBlow - High-fiber formula for your RubyMotion dumps!
2
+
3
+ Tired of generating your screen dumps by hand for your appstore submissions?
4
+ MotionBlow makes it easy to get all the hi-res screen dumps for your app across all
5
+ your supported devices.
6
+
7
+ ## For the star-gizzards ;-)
8
+
9
+ ```
10
+ > git clone https://github.com/derailed/motion-blow.git
11
+ > cd motion-blow
12
+ > bundle
13
+ > rake motion:blow
14
+ ```
15
+
16
+ ## Installation
17
+
18
+ ```
19
+ gem install motion-blow
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ MotionBlow leverages MacBacon to exercise your app legs and makes it a snap to
25
+ capture the essence of your various screens.
26
+
27
+ ### Create a test runner
28
+
29
+ Make a directory spec/snapshot and add your screen driving spec.
30
+
31
+ NOTE: The naming must be just right so MotionBlow can pick up your spec runner!
32
+
33
+ ```ruby
34
+ # spec/snapshot/blow.rb
35
+ describe 'ColonBlow' do
36
+ include MotionBlow
37
+
38
+ tests MyTopLevelViewController
39
+
40
+ it "dumps all my screens correctly" do
41
+ # Take the snapshot
42
+ snap!
43
+
44
+ # Nav somewhere else
45
+ tap( 'chain' )
46
+
47
+ # Take a new snapshot
48
+ snap!
49
+ ...
50
+ # Done bail out of the simulator
51
+ flush!
52
+ end
53
+ end
54
+ ```
55
+
56
+ ### Run it!
57
+
58
+ ```
59
+ > rake motion:blow
60
+ ```
61
+
62
+ MotionBlow creates a spec/snapshot/pngs/device_xxx directory containing all
63
+ the screen shots per the specification of your snap! calls.
64
+
65
+ You can then upload your favorite app snapshots and you're done!
66
+
67
+ ## Contact
68
+
69
+ Fernand Galiana
70
+
71
+ - http://github.com/derailed
72
+ - http://twitter.com/kitesurfer
73
+ - <fernand.galiana@gmail.com>
74
+
75
+
76
+ ## License
77
+
78
+ MotionBlow is released under the [MIT](http://opensource.org/licenses/MIT) license.
79
+
80
+
81
+ ## History
82
+ + 0.0.1:
83
+ + Initial drop
@@ -0,0 +1,18 @@
1
+ $:.unshift('/Library/RubyMotion/lib')
2
+ require 'motion/project'
3
+ require './lib/motion-blow'
4
+ require 'sugarcube-gestures'
5
+
6
+ require 'bundler'
7
+ Bundler.require
8
+ Bundler::GemHelper.install_tasks
9
+
10
+ Motion::Project::App.setup do |app|
11
+ app.name = 'ColonBlow!'
12
+ app.device_family = [:iphone, :ipad]
13
+
14
+ app.development do
15
+ app.codesign_certificate = ENV['dev_mb_certificate']
16
+ app.provisioning_profile = ENV['dev_mb_profile']
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ include SugarCube::Adjust
2
+
3
+ class AppDelegate
4
+ attr_reader :samples
5
+
6
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
7
+ return true if RUBYMOTION_ENV == 'test' and !MotionBlow.dump?
8
+
9
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
10
+ @window.rootViewController = (nav = ContainerController.new)
11
+ @window.rootViewController.wantsFullScreenLayout = true
12
+
13
+ @window.makeKeyAndVisible
14
+
15
+ nav.setNavigationBarHidden( true, animated:true )
16
+
17
+ setup_appearance
18
+
19
+ @samples = %w(A B C D E)
20
+
21
+ true
22
+ end
23
+
24
+ def alert( message )
25
+ UIAlertView.alert( message )
26
+ end
27
+
28
+ private
29
+
30
+ def setup_appearance
31
+ UILabel.appearance.setBackgroundColor( UIColor.clearColor )
32
+ end
33
+ end
@@ -0,0 +1,13 @@
1
+ class A < Z
2
+ def viewDidLoad
3
+ @comp = label( :flag, size: 200 ) do |label|
4
+ label.color = 0x04B0FB.uicolor
5
+ label.accessibilityLabel = "label_a"
6
+ label.backgroundColor = UIColor.clearColor
7
+ label.frame = CGRectMake( 0, 0, 200, 200 )
8
+ label.center = center
9
+ self.view.addSubview(label)
10
+ end
11
+ super
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ class B < Z
2
+ def viewDidLoad
3
+ @comp = label( :volume_up, text:"Simply Awesome!" ) do |label|
4
+ label.color = UIColor.redColor
5
+ label.accessibilityLabel = "label_b"
6
+ label.backgroundColor = UIColor.clearColor
7
+ label.font = UIFont.fontWithName( 'AmericanTypewriter', size:30 )
8
+ label.textAlignment = NSTextAlignmentCenter
9
+ label.frame = CGRectMake( 0, 0, 300, 50 )
10
+ label.center = center
11
+ self.view.addSubview(label)
12
+ end
13
+ super
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class C < Z
2
+ def viewDidLoad
3
+ @comp = label( :wrench, text:"Yes please!", color: 0xB0FB03.uicolor ) do |label|
4
+ label.color = 0x539FFB.uicolor
5
+ label.accessibilityLabel = "label_c"
6
+ label.backgroundColor = UIColor.clearColor
7
+ label.font = UIFont.fontWithName( 'copperplate', size:40 )
8
+ label.textAlignment = NSTextAlignmentCenter
9
+ label.frame = CGRectMake( 0, 0, 300, 50 )
10
+ label.center = center
11
+ self.view.addSubview(label)
12
+ end
13
+ super
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ class ContainerController < UINavigationController
2
+ def init
3
+ super.tap do
4
+ controller = A.new
5
+ controller.navigationItem.title = "A"
6
+ self.setViewControllers( [controller], animated: false )
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ class D < Z
2
+ def viewDidLoad
3
+ @comp = button( :legal, size: 40, text:%q{Hit me!} ) do |button|
4
+ button.titleLabel.textColor = 0xFB3223.uicolor
5
+ button.titleLabel.font = UIFont.fontWithName( 'GillSans', size:30 )
6
+ button.setBackgroundImage( UIImage.imageNamed( 'button-bg.png'), forState: UIControlStateNormal )
7
+ button.layer.cornerRadius = 10
8
+ button.layer.masksToBounds = true
9
+
10
+ button.frame = CGRectMake( 0, 0, 180, 60 )
11
+ button.center = center
12
+ button.addTarget( self,
13
+ action: "callback:",
14
+ forControlEvents: UIControlEventTouchUpInside )
15
+ self.view.addSubview( button )
16
+ end
17
+ super
18
+ end
19
+
20
+ private
21
+
22
+ def callback( button )
23
+ UIApplication.sharedApplication.delegate.alert "You're a good citizen..."
24
+ end
25
+
26
+ end
@@ -0,0 +1,27 @@
1
+ class E < Z
2
+ def viewDidLoad
3
+ @comp = button( :github, size:35, text:%q{Fork it!}, color:0xD6FF18.uicolor, type: :custom ) do |button|
4
+ button.titleLabel.textColor = 0x2D31CE.uicolor
5
+ button.titleLabel.font = UIFont.fontWithName( "Vermin Vibes Out Of Ink", size:55 )
6
+
7
+ button.setBackgroundImage( UIImage.imageNamed( 'button-bg.png'), forState: UIControlStateNormal )
8
+ button.layer.cornerRadius = 5
9
+ button.layer.masksToBounds = true
10
+
11
+ button.frame = CGRectMake( 0, 0, 300, 70 )
12
+ button.center = center
13
+ button.contentEdgeInsets = UIEdgeInsetsMake( 0, 0, 0, 0 )
14
+ button.addTarget( self,
15
+ action: "callback:",
16
+ forControlEvents: UIControlEventTouchUpInside )
17
+ self.view.addSubview( button )
18
+ end
19
+ super
20
+ end
21
+
22
+ private
23
+
24
+ def callback( button )
25
+ UIApplication.sharedApplication.delegate.alert "github.com/derailed/motion-blow"
26
+ end
27
+ end
@@ -0,0 +1,58 @@
1
+ class Z < UIViewController
2
+ include MotionAwesome
3
+
4
+ attr_accessor :comp
5
+
6
+ def initialize
7
+ @comp = nil
8
+ end
9
+
10
+ def viewDidLoad
11
+ view.setBackgroundColor( 0x000000.uicolor )
12
+ view.accessibilityLabel = "Main"
13
+ view.on_tap do
14
+ next_ctrl
15
+ end
16
+ view.on_swipe( :left ) do
17
+ next_ctrl
18
+ end
19
+ view.on_swipe( :right ) do
20
+ prev_ctrl
21
+ end
22
+ end
23
+
24
+ def viewWillAppear( animated )
25
+ refresh_layout
26
+ navigationController.setNavigationBarHidden( true, animated:false )
27
+ end
28
+
29
+ def didRotateFromInterfaceOrientation( orientation )
30
+ refresh_layout
31
+ end
32
+
33
+ private
34
+
35
+ def refresh_layout
36
+ comp.center = center
37
+ end
38
+
39
+ def center
40
+ [self.view.frame.size.width/2, self.view.frame.size.height/2]
41
+ end
42
+
43
+ def samples
44
+ UIApplication.sharedApplication.delegate.samples
45
+ end
46
+
47
+ def prev_ctrl
48
+ current_index = samples.index(self.class.name)
49
+ clazz = Object.const_get( samples[(current_index-1) % samples.size] )
50
+ self.navigationController.pushViewController( clazz.new, animated: true )
51
+ end
52
+
53
+ def next_ctrl
54
+ current_index = samples.index(self.class.name)
55
+ clazz = Object.const_get( samples[(current_index+1) % samples.size] )
56
+ self.navigationController.pushViewController( clazz.new, animated: true )
57
+ end
58
+ end
Binary file
Binary file
@@ -0,0 +1,54 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "motion-blow must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ ENV['MOTION_BLOW_ENV'] = "on"
6
+
7
+ MB_LIB_DIR = File.dirname(__FILE__)
8
+ Motion::Project::App.setup do |app|
9
+ Dir.glob(File.join( MB_LIB_DIR, %w(motion-blow ** *.rb))).each do |file|
10
+ app.files.unshift(file)
11
+ end
12
+ end
13
+
14
+ namespace 'motion' do
15
+ desc 'Dumps screen snapshots for all supported devices'
16
+ task :blow do
17
+ base_dir = File.join( App.config.project_dir, %w(spec snapshot) )
18
+ bowel_file = File.join( base_dir, "blow.rb" )
19
+ png_dir = File.join( base_dir, "pngs" )
20
+
21
+ raise "Meow! You need to set up a `snapshot directory in your spec directory" unless File.exists?( base_dir )
22
+ raise "Meow! You must define your script in spec/snapshot/bowels.rb" unless File.exists?( bowel_file )
23
+ raise "Hoy! Unable to find `osascript exec in PATH #{%x[which osascript].inspect}" if %x[which osascript].empty?
24
+
25
+ FileUtils.rm_r( png_dir ) if File.exists?( png_dir )
26
+ FileUtils.mkdir_p( png_dir )
27
+
28
+ target = ENV['target'] || App.config.sdk_version
29
+
30
+ App.config.device_family.each do |family|
31
+ retina = ENV['retina'] || family == :ipad ? %w[true] : %w[3.5 4]
32
+ retina.each do |retina|
33
+ dir_name = App.config.device_family_string( family, target, retina )
34
+
35
+ puts "-"*100
36
+ puts "Generating screens for device: #{dir_name}"
37
+ puts "-"*100
38
+
39
+ ENV['target'] = target
40
+ ENV['device-family'] = family.to_s
41
+ ENV['retina'] = retina
42
+
43
+ %x[rake spec files=#{bowel_file} target=#{target} device_family=#{family} retina=#{retina}]
44
+ snapshots = Dir.glob(File.join(ENV['HOME'], 'Desktop', 'iOS Simulator Screen shot *.png' ) )
45
+ dump_dir = File.join( png_dir, dir_name )
46
+ FileUtils.rm_r dump_dir if File.exists?( dump_dir )
47
+ FileUtils.mkdir_p( dump_dir )
48
+ snapshots.each do |snap|
49
+ FileUtils.mv( snap, dump_dir )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,21 @@
1
+ module MotionBlow
2
+ module_function
3
+
4
+ def dump?
5
+ ENV['MOTION_BLOW_ENV'] == 'on'
6
+ end
7
+
8
+ def snap!
9
+ run( 'dumper.scpt' )
10
+ end
11
+
12
+ def flush!
13
+ run( 'sim_quit.scpt' )
14
+ end
15
+
16
+ private
17
+
18
+ def run( script_file )
19
+ %x[osascript #{File.join( File.dirname(__FILE__), %W[.. assets #{script_file}] )}]
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module MotionBlow
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/motion-blow/version.rb', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'motion-blow'
6
+ gem.version = MotionBlow::VERSION
7
+ gem.authors = ['Fernand Galiana']
8
+ gem.email = ['fernand.galiana@gmail.com']
9
+ gem.summary = %{High-fiber formula for your Rubymotion dumps.}
10
+ gem.description = "AppStore submissions got you down?" +
11
+ "MotionBlow allows you to dump all you screens in hi-res accross a range of devices"
12
+ "Write a test script - run it - upload screen dumps - Done!"
13
+ gem.homepage = 'http://derailed.github.com/motion-blow'
14
+ gem.files = `git ls-files`.split($\)
15
+ gem.test_files = gem.files.grep(%r{^spec/})
16
+ gem.require_paths = ['lib']
17
+ end
Binary file
@@ -0,0 +1,29 @@
1
+ describe "ColonBlow!" do
2
+ extend MotionBlow
3
+
4
+ tests ContainerController
5
+
6
+ it "takes snapshots correctly" do
7
+ snap!
8
+
9
+ %w[a b c].each do |l|
10
+ visit_me( "Main", l )
11
+ end
12
+
13
+ %w[a].each do |l|
14
+ visit_me( "Main", l )
15
+ end
16
+
17
+ # BOZO!! Guess need an assert somewhere. Gak!
18
+ true.should == true
19
+
20
+ sleep( 2 )
21
+ flush!
22
+ end
23
+ end
24
+
25
+ def visit_me( view, widget )
26
+ flick view, to: :left
27
+ sleep( 0.5 )
28
+ snap!
29
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-blow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fernand Galiana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: AppStore submissions got you down?MotionBlow allows you to dump all you
14
+ screens in hi-res accross a range of devices
15
+ email:
16
+ - fernand.galiana@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - README.md
25
+ - Rakefile
26
+ - app/app_delegate.rb
27
+ - app/controllers/a.rb
28
+ - app/controllers/b.rb
29
+ - app/controllers/c.rb
30
+ - app/controllers/container_controller.rb
31
+ - app/controllers/d.rb
32
+ - app/controllers/e.rb
33
+ - app/controllers/z.rb
34
+ - lib/assets/dumper.scpt
35
+ - lib/assets/sim_quit.scpt
36
+ - lib/motion-blow.rb
37
+ - lib/motion-blow/snapshot.rb
38
+ - lib/motion-blow/version.rb
39
+ - motion-blow.gemspec
40
+ - resources/button-bg.png
41
+ - resources/button-bg@2x.png
42
+ - resources/vermin_vibes_out_of_ink.ttf
43
+ - spec/snapshot/blow.rb
44
+ homepage: http://derailed.github.com/motion-blow
45
+ licenses: []
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.0.3
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: High-fiber formula for your Rubymotion dumps.
67
+ test_files:
68
+ - spec/snapshot/blow.rb