RubyMotion projects can be extended through the use of RubyGems, the Ruby de-facto packaging system. This article will cover how to write RubyMotion-specific gems.
This article was inspired by Create gems for RubyMotion, by Francis Chong.
# From the tty_ioctl man page in Linux. | |
# | |
# TIOCGWINSZ struct winsize *argp | |
# Get window size. | |
# | |
# TIOCSWINSZ const struct winsize *argp | |
# Set window size. | |
# | |
# The struct used by these ioctls is defined as | |
# |
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project/template/osx' | |
Motion::Project::App.setup do |app| | |
# Use `rake config' to see complete project settings. | |
app.name = 'MenubarApp' | |
app.info_plist['NSUIElement'] = 1 | |
end |
org_posts_dir = "org_posts" # directory under source | |
# From http://www.ewal.net/2012/09/08/octopress-customizations/ | |
# Modified to have default flag of true to include drafts | |
desc "Rename files in the posts directory if the filename does not match the post date in the YAML front matter" | |
task :rename_posts do | |
rename_posts_in_dir "#{source_dir}/#{posts_dir}", "markdown" | |
# remove next line if you're you're not using org-mode | |
rename_posts_in_dir "#{source_dir}/#{org_posts_dir}", "org" |
##Userable | |
module Userable | |
def self.included(base) | |
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true | |
base.validate :user_must_be_valid | |
base.alias_method_chain :user, :autobuild | |
base.extend ClassMethods | |
base.define_user_accessors | |
end | |
RubyMotion projects can be extended through the use of RubyGems, the Ruby de-facto packaging system. This article will cover how to write RubyMotion-specific gems.
This article was inspired by Create gems for RubyMotion, by Francis Chong.
# 1) Use VCR.use_cassette in your let block. This will use | |
# the cassette just for requests made by creating bar, not | |
# for anything else in your test. | |
let(:foo) { VCR.use_cassette("foo") { create(:bar) } } | |
it "uses foo" do | |
foo | |
end | |
# 2) Wrap the it block that uses #foo in VCR.use_cassette. |
Submitting to the App Store
First, install Developer certs from Apple's Developer portal
To Build the Application:
# Credit http://stackoverflow.com/a/2514279 | |
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
Failure/Error: Unable to find matching line from backtrace | |
ActiveRecord::StatementInvalid: | |
PGError: ERROR: syntax error at or near "IDENTITY" | |
LINE 1: TRUNCATE TABLE RESTART IDENTITY CASCADE; | |
^ | |
: TRUNCATE TABLE RESTART IDENTITY CASCADE; |
/* | |
This overlay provides a 'liquid' mode to the excellent CodeMirror editor (http://codemirror.net/). | |
Add something like this to your CSS: | |
.cm-liquid-tag { | |
color: #32273f; | |
background: #ead9ff; | |
} | |
.cm-liquid-variable { |