motion-pixate 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ RubyMotion-Pixate
2
+ =================
3
+
4
+ Pixate gem for RubyMotion.
5
+
6
+
7
+ ## Requirements
8
+
9
+ - RubyMotion 1.0 or greater (see http://www.rubymotion.com).
10
+
11
+
12
+ ## Setup
13
+
14
+ 1. Download the Pixate Framework package from http://www.pixate.com/ and copy the `PXEngine.framework` folder into `vendor` directory. Create the `vendor` directory if it does not exist. You should have something like this.
15
+ ```
16
+ $ ls vendor/PXEngine.framework
17
+ /Headers/ PXEngine Resources/ Versions/
18
+ ```
19
+
20
+ 2. Edit the `Rakefile` of your RubyMotion project and add the following require lines.
21
+ ```ruby
22
+ require 'rubygems'
23
+ require 'motion-pixate'
24
+ ```
25
+
26
+ 3. Still in the `Rakefile`, set up the `user`, `key` and `framework` variables in your application configuration block.
27
+ ```ruby
28
+ Motion::Project::App.setup do |app|
29
+ # ...
30
+ app.pixate.user = 'USER ID'
31
+ app.pixate.key = 'KEY CODE'
32
+ app.pixate.framework = 'vendor/PXEngine.framework'
33
+ end
34
+ ```
35
+
36
+ 4. Create the `default.css` in `resources` directory.
37
+
38
+
39
+ ## Usage
40
+
41
+ Pixate gem supports [Sass](http://sass-lang.com/) to generate the stylesheet. Create the `sass` directory and `default.scss` with the `rake pixate:init` command. Then, `rake pixate:sass` command generates the stylesheet from `default.scss`.
42
+
43
+ You could specify the Sass output style through `style` environment variable. For example,
44
+ ```
45
+ $ rake pixate:sass style=compressed
46
+ ```
47
+
48
+ You could use `nested`, `expanded`, `compact` and `compressed` as output style.
49
+
50
+ Pixate gem provides "style" method in REPL. You could change the stylesheet at the moment in REPL. For example,
51
+ ```
52
+ (main)> style "button { color : blue; }"
53
+ (main)> style "button { background-color: red; border-radius: 20pt; }"
54
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ require "motion/project/pixate"
@@ -0,0 +1,99 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ class PixateConfig
6
+ attr_accessor :framework, :user, :key
7
+
8
+ def initialize(config)
9
+ @config = config
10
+ end
11
+
12
+ def framework=(path)
13
+ if @framework != path
14
+ @config.unvendor_project(@framework)
15
+ @framework = path
16
+ @config.vendor_project(path, :static, :products => ['PXEngine'], :headers_dir => 'Headers')
17
+ create_code
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def create_code
24
+ unless @user && @key
25
+ raise "Need to configure `app.pixate.user' and `app.pixate.key' variables"
26
+ end
27
+
28
+ code = <<EOF
29
+ # This file is automatically generated. Do not edit.
30
+
31
+ PXEngine.licenseKey('#{@key}', forUser:'#{@user}')
32
+
33
+ def style(str)
34
+ PXStylesheet.styleSheetFromSource(str, withOrigin:0)
35
+ PXStylesheet.applyStylesheets
36
+ end
37
+ EOF
38
+ pixate_file = './app/pixate_code.rb'
39
+ create_stub(pixate_file, code)
40
+ add_file(pixate_file)
41
+ end
42
+
43
+ def create_stub(path, code)
44
+ if !File.exist?(path) or File.read(path) != code
45
+ File.open(path, 'w') { |io| io.write(code) }
46
+ end
47
+ end
48
+
49
+ def add_file(path)
50
+ files = @config.files.flatten
51
+ @config.files << path unless files.find { |x| File.expand_path(x) == File.expand_path(path) }
52
+ end
53
+ end
54
+
55
+ module Motion; module Project; class Config
56
+
57
+ variable :pixate
58
+
59
+ def pixate
60
+ @pixate ||= PixateConfig.new(self)
61
+ end
62
+
63
+ end; end; end
64
+
65
+ namespace 'pixate' do
66
+ desc "Create initial stylesheet files"
67
+ task :init do
68
+ unless File.exist?("sass/default.scss")
69
+ mkdir_p "sass"
70
+ touch "sass/default.scss"
71
+ App.info 'Create', 'sass/default.scss'
72
+ end
73
+
74
+ unless File.exist?("resources/default.css")
75
+ mkdir_p "resources"
76
+ touch "resources/default.css"
77
+ App.info 'Create', 'resources/default.css'
78
+ end
79
+ end
80
+
81
+ desc "Compile SCSS file"
82
+ task :sass do
83
+ unless File.exist?("sass/default.scss")
84
+ warn "Not found `sass/default.scss'"
85
+ exit
86
+ end
87
+
88
+ unless File.exist?("resources")
89
+ mkdir_p "resources"
90
+ end
91
+
92
+ style = ""
93
+ if ENV['style'].to_s.length > 0
94
+ style = "--style #{ENV['style']}"
95
+ end
96
+ sh "sass sass/default.scss resources/default.css #{style}"
97
+ App.info 'Compile', 'sass/default.scss'
98
+ end
99
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Version = "1.0"
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "motion-pixate"
6
+ gem.version = Version
7
+ gem.authors = ['Paul Colton', 'Shizuo Fujita']
8
+ gem.email = ['paul@pixate.com', 'watson1978@gmail.com']
9
+ gem.description = 'Pixate integration for RubyMotion projects'
10
+ gem.summary = 'motion-pixate allows RubyMotion projects to easily embed the Pixate Framework.'
11
+ gem.homepage = 'https://github.com/Pixate/RubyMotion-Pixate'
12
+
13
+ gem.files = `git ls-files`.split($/)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.require_paths = ["lib"]
17
+
18
+ gem.add_dependency 'sass'
19
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-pixate
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paul Colton
9
+ - Shizuo Fujita
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-01-03 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sass
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: Pixate integration for RubyMotion projects
32
+ email:
33
+ - paul@pixate.com
34
+ - watson1978@gmail.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - .gitignore
40
+ - README.md
41
+ - Rakefile
42
+ - lib/motion-pixate.rb
43
+ - lib/motion/project/pixate.rb
44
+ - motion-pixate.gemspec
45
+ homepage: https://github.com/Pixate/RubyMotion-Pixate
46
+ licenses: []
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 1.8.24
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: motion-pixate allows RubyMotion projects to easily embed the Pixate Framework.
69
+ test_files: []