redpotion 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -6
- data/bin/potion +6 -4
- data/lib/project/ext/ui_image_view.rb +12 -0
- data/lib/project/ruby_motion_query/stylers/ui_image_view.rb +1 -6
- data/lib/project/version.rb +1 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d21e4e6f969c24f37a4353f71e9eee37ec2eb46f
|
4
|
+
data.tar.gz: 7e13e159041370cb4356f2d8d6b1f005e340fbf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab585f17e01afda7512152fc28e73c9390e1994291c9d6af386c69e9543179f7a36a160e71924d8fdb95dc43b67ad3ff85918d967ec55698a7ecf10c8f515710
|
7
|
+
data.tar.gz: 4ad4a47811f1c80f25db4bac1da5d6faf25b944ec3ebfa739a8d8dff2bb3d0a5ca3f8096ffe8796f21f1bfe3ede8bb7dbfbc53599bd57b413de1120e2e343680
|
data/README.md
CHANGED
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
# RedPotion
|
4
4
|
|
5
|
-
[![Dependency Status](https://gemnasium.com/infinitered/redpotion.png)](https://gemnasium.com/infinitered/redpotion)
|
6
|
-
[![Build Status](https://travis-ci.org/infinitered/redpotion.png?branch=master)](https://travis-ci.org/infinitered/redpotion)
|
7
|
-
[![Gem Version](https://badge.fury.io/rb/redpotion.png)](http://badge.fury.io/rb/redpotion)
|
8
|
-
[![Code Quality](https://codeclimate.com/github/infinitered/redpotion/badges/gpa.svg)](https://codeclimate.com/github/infinitered/redpotion)
|
9
|
-
|
10
5
|
We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called **RedPotion**
|
11
6
|
|
12
7
|
RedPotion combines [RMQ](http://rubymotionquery.com/), [ProMotion](https://github.com/clearsightstudio/ProMotion), [CDQ](https://github.com/infinitered/cdq), [AFMotion](https://github.com/clayallsopp/afmotion), [MotionPrint](https://github.com/OTGApps/motion_print) and [MORE!](#full-listing-of-gems-and-pods-for-redpotion). It also adds new features to better integrate RMQ with ProMotion. The goal is simply to choose standard libraries and promote best practices, allowing you to develop iOS apps in record time.
|
@@ -51,7 +46,97 @@ add it to your `Gemfile`:
|
|
51
46
|
|
52
47
|
- `gem 'redpotion'`
|
53
48
|
|
54
|
-
|
49
|
+
|
50
|
+
## Let's build something
|
51
|
+
|
52
|
+
Let's start by creating our app, do this:
|
53
|
+
|
54
|
+
```
|
55
|
+
> potion create myapp
|
56
|
+
> cd myapp
|
57
|
+
> bundle
|
58
|
+
> rake pod:install
|
59
|
+
> rake
|
60
|
+
```
|
61
|
+
|
62
|
+
Your app should be running now. Type `exit` in console to stop your app.
|
63
|
+
|
64
|
+
Let's add a text field, a button, and an image to the main screen:
|
65
|
+
|
66
|
+
Open the `home_screen.rb` file, then add this
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
@image_url = append!(UITextField, :image_url)
|
70
|
+
|
71
|
+
append UIButton, :go_button
|
72
|
+
|
73
|
+
@sample_image = append UIImageView, :sample_image
|
74
|
+
```
|
75
|
+
|
76
|
+
Delete this line:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
@hello_world = append!(UILabel, :hello_world)
|
80
|
+
```
|
81
|
+
|
82
|
+
Now we need to style them so you can see them on your screen.
|
83
|
+
|
84
|
+
Open up `home_screen_stylesheet.rb`, then add this:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
def image_url(st)
|
88
|
+
st.frame = {left: 20, from_right: 20, top: 80, height: 30}
|
89
|
+
st.background_color = color.light_gray
|
90
|
+
end
|
91
|
+
|
92
|
+
def go_button(st)
|
93
|
+
st.frame = {below_prev: 10, from_right: 20, width: 40, height: 30}
|
94
|
+
st.text = "go"
|
95
|
+
st.background_color = color.blue
|
96
|
+
st.color = color.white
|
97
|
+
end
|
98
|
+
|
99
|
+
def sample_image(st)
|
100
|
+
st.frame = {left: 20, below_prev: 10, from_right: 20, from_bottom: 20}
|
101
|
+
st.background_color = color.gray
|
102
|
+
end
|
103
|
+
```
|
104
|
+
|
105
|
+
Now let's add the logic. When the user enters a URL to an image in the text field, then tap **Go**, it shows the picture in the image view below.
|
106
|
+
|
107
|
+
Let's add the event to the go_button:
|
108
|
+
|
109
|
+
Replace this:
|
110
|
+
```ruby
|
111
|
+
append UIButton, :go_button
|
112
|
+
```
|
113
|
+
|
114
|
+
With this:
|
115
|
+
```ruby
|
116
|
+
append(UIButton, :go_button).on(:touch) do
|
117
|
+
@sample_image.remote_image = @image_url.text
|
118
|
+
end
|
119
|
+
```
|
120
|
+
|
121
|
+
You should end up with this `on_load` method:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
def on_load
|
125
|
+
set_nav_bar_button :left, system_item: :camera, action: :nav_left_button
|
126
|
+
set_nav_bar_button :right, title: "Right", action: :nav_right_button
|
127
|
+
|
128
|
+
@image_url = append!(UITextField, :image_url)
|
129
|
+
|
130
|
+
append(UIButton, :go_button).on(:touch) do
|
131
|
+
@sample_image.remote_image = @image_url.text
|
132
|
+
end
|
133
|
+
|
134
|
+
@sample_image = append UIImageView, :sample_image
|
135
|
+
end
|
136
|
+
```
|
137
|
+
|
138
|
+
Now paste this URL in and hit **Go**
|
139
|
+
`http://bit.ly/1M3UEZL`
|
55
140
|
|
56
141
|
|
57
142
|
## New generators to integrate RMQ & ProMotion nicely ##
|
data/bin/potion
CHANGED
@@ -32,12 +32,14 @@ class PotionCommandLine
|
|
32
32
|
> potion remove cdq
|
33
33
|
> potion remove afmotion
|
34
34
|
|
35
|
+
Misc
|
35
36
|
> potion -h, --help
|
36
37
|
> potion -v, --version
|
37
|
-
|
38
|
-
|
39
|
-
>
|
40
|
-
>
|
38
|
+
|
39
|
+
Documentation
|
40
|
+
> rmq docs
|
41
|
+
> rmq docs query
|
42
|
+
> rmq docs "background image" }
|
41
43
|
|
42
44
|
class << self
|
43
45
|
SKIP_FLAGS = [ "--skip-cdq", "--skip-afmotion" ]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class UIImageView
|
2
|
+
|
3
|
+
def remote_image=(value)
|
4
|
+
if self.respond_to?("setImageWithURL:placeholder:")
|
5
|
+
value = NSURL.URLWithString(value) unless value.is_a?(NSURL)
|
6
|
+
self.setImageWithURL(value, placeholder:self.image)
|
7
|
+
else
|
8
|
+
puts "\n[RedPotion ERROR] tried to set remote_image without JMImageCache cocoapod. Please add this to your Rakefile: \n\napp.pods do\n pod \"JMImageCache\"\nend\n"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -4,12 +4,7 @@ module RubyMotionQuery
|
|
4
4
|
class UIImageViewStyler < UIViewStyler
|
5
5
|
|
6
6
|
def remote_image=(value)
|
7
|
-
|
8
|
-
value = NSURL.URLWithString(value) unless value.is_a?(NSURL)
|
9
|
-
@view.setImageWithURL(value, placeholder:@view.image)
|
10
|
-
else
|
11
|
-
puts "\n[RedPotion ERROR] tried to set remote_image without JMImageCache cocoapod. Please add this to your Rakefile: \n\napp.pods do\n pod \"JMImageCache\"\nend\n"
|
12
|
-
end
|
7
|
+
@view.remote_image = value
|
13
8
|
end
|
14
9
|
|
15
10
|
# This is the same functionality as image=
|
data/lib/project/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redpotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfiniteRed
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 2.2.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 2.2.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: motion_print
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,20 +95,6 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: newclear
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
98
|
description: RedPotion - The best combination of RubyMotion tools and libraries
|
113
99
|
email:
|
114
100
|
- hello@infinitered.com
|
@@ -122,6 +108,7 @@ files:
|
|
122
108
|
- bin/potion
|
123
109
|
- lib/project/ext/object.rb
|
124
110
|
- lib/project/ext/ui_color.rb
|
111
|
+
- lib/project/ext/ui_image_view.rb
|
125
112
|
- lib/project/ext/ui_view.rb
|
126
113
|
- lib/project/ext/ui_view_controller.rb
|
127
114
|
- lib/project/pro_motion/data_table_screen.rb
|