redpotion 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/bin/potion +201 -0
- data/lib/project/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb03398985a0332c5dad7504fda2dc5b4dbcaa23
|
4
|
+
data.tar.gz: 610227da65e2617d7df7cca5d694cfec7b7aa8a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edd653ab74017815a1c5406ec9ad585b632efa88ff8ef99922925225cb16c1d0d0e4d1c7a9ff872547af37a36a597f1bf4c56c0f8a3b64c85d87e4ff34f27272
|
7
|
+
data.tar.gz: 5d9034267124e08c4ac445abbe0d72e7c2c738e304899eb12685a7777225558611f7538c02d35fee827d9485603920aba065b5105f45f9e683d8f70b1aac64fb
|
data/README.md
CHANGED
@@ -2,12 +2,9 @@
|
|
2
2
|
|
3
3
|
# RedPotion
|
4
4
|
|
5
|
-
*Note the potion command isn't working yet. It will soon.*
|
6
|
-
|
7
|
-
|
8
5
|
RedPotion combines [RMQ](http://rubymotionquery.com/), [ProMotion](https://github.com/clearsightstudio/ProMotion), [CDQ](https://github.com/infinitered/cdq), [AFMotion](https://github.com/clayallsopp/afmotion), and other libraries. It also adds new features to better integrate RMQ with ProMotion.
|
9
6
|
|
10
|
-
Its goals are to choose standard libraries and promote best practices, allowing you to
|
7
|
+
Its goals are to choose standard libraries and promote best practices, allowing you to developed iOS apps in record time.
|
11
8
|
|
12
9
|
=========
|
13
10
|
|
@@ -25,18 +22,17 @@ You can use both RMQ Plugins and ProMotion Add-ons
|
|
25
22
|
|
26
23
|
![image](http://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/11/2014/11/ProMotion-addon-logo.png)
|
27
24
|
|
28
|
-
ProMotion Addon
|
29
25
|
|
30
26
|
## Quick start
|
31
27
|
|
32
28
|
```
|
33
|
-
gem install
|
29
|
+
gem install red_potion
|
34
30
|
|
35
31
|
potion create my_app
|
36
32
|
bundle
|
37
33
|
rake pod:install
|
38
|
-
potion create model state
|
39
|
-
potion create
|
34
|
+
potion create model state # This doesn't work yet
|
35
|
+
potion create screen table states # This doesn't work yet
|
40
36
|
# a few changes
|
41
37
|
rake
|
42
38
|
```
|
data/bin/potion
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "erb"
|
4
|
+
require "rubygems"
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
$:.unshift(File.join(File.dirname(__FILE__), "/../lib/project"))
|
8
|
+
require "version"
|
9
|
+
|
10
|
+
class PotionCommandLine
|
11
|
+
HELP_TEXT = %{ potion version #{RedPotion::VERSION}
|
12
|
+
|
13
|
+
Some things you can do with the potion command:
|
14
|
+
|
15
|
+
> potion create my_new_app
|
16
|
+
|
17
|
+
> potion create model foo
|
18
|
+
> potion create controller foos
|
19
|
+
> potion create view bar
|
20
|
+
> potion create shared some_class_used_app_wide
|
21
|
+
> potion create lib some_class_used_by_multiple_apps
|
22
|
+
|
23
|
+
> potion create collection_view_controller foos
|
24
|
+
> potion create table_view_controller bars
|
25
|
+
|
26
|
+
> potion -h, --help
|
27
|
+
> potion -v, --version
|
28
|
+
|
29
|
+
> rmq_docs
|
30
|
+
> rmq_docs query
|
31
|
+
> rmq_docs "background image" }
|
32
|
+
|
33
|
+
class << self
|
34
|
+
VALID_CREATE_TYPES = [
|
35
|
+
:model, :controller,
|
36
|
+
:view,
|
37
|
+
:shared,
|
38
|
+
:lib,
|
39
|
+
:collection_view_controller,
|
40
|
+
:table_view_controller
|
41
|
+
]
|
42
|
+
|
43
|
+
def create(template_or_app_name, name, options)
|
44
|
+
@dry_run = true if options == 'dry_run'
|
45
|
+
|
46
|
+
if name
|
47
|
+
if VALID_CREATE_TYPES.include?(template_or_app_name.to_sym)
|
48
|
+
insert_from_template(template_or_app_name, name)
|
49
|
+
else
|
50
|
+
puts "potion - Invalid command, do something like this: potion create controller my_controller\n"
|
51
|
+
end
|
52
|
+
else
|
53
|
+
#ensure_template_dir
|
54
|
+
create_app(template_or_app_name)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_app(app_name)
|
59
|
+
puts ' Creating app'
|
60
|
+
|
61
|
+
`motion create --template=git@github.com:infinitered/redpotion-template.git #{app_name}`
|
62
|
+
|
63
|
+
puts %{
|
64
|
+
Complete. Things you should do:
|
65
|
+
> cd #{app_name}
|
66
|
+
> bundle
|
67
|
+
> rake spec
|
68
|
+
> rake
|
69
|
+
(main)> exit
|
70
|
+
|
71
|
+
Then try these:
|
72
|
+
> rake device_name='iPhone 4s'
|
73
|
+
> rake device_name='iPhone 5s'
|
74
|
+
> rake device_name='iPhone 5s' target=7.1
|
75
|
+
> rake device_name='iPhone 6 Plus'
|
76
|
+
> rake device_name='iPad Retina'
|
77
|
+
> rake device
|
78
|
+
|
79
|
+
Or for XCode 5.1
|
80
|
+
> rake retina=3.5
|
81
|
+
> rake retina=4
|
82
|
+
> rake device_family=ipad}
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
def template_dir
|
87
|
+
"#{Dir.home}/Library/RubyMotion/template/potion-template"
|
88
|
+
end
|
89
|
+
|
90
|
+
# TODO Disabling for now, this needs to get latest template
|
91
|
+
def ensure_template_dir
|
92
|
+
return if Dir.exists?(template_dir)
|
93
|
+
`git clone git@github.com:infinitered/potion-template.git #{template_dir}`
|
94
|
+
end
|
95
|
+
|
96
|
+
def template_path(template_name)
|
97
|
+
sub_path = "templates/#{template_name}/"
|
98
|
+
|
99
|
+
# First check local directory, use that if it exists
|
100
|
+
if Dir.exist?("#{Dir.pwd}/#{sub_path}")
|
101
|
+
"#{Dir.pwd}/#{sub_path}"
|
102
|
+
else # Then check the gem
|
103
|
+
begin
|
104
|
+
spec = Gem::Specification.find_by_name("redpotion")
|
105
|
+
gem_root = spec.gem_dir
|
106
|
+
"#{gem_root}/#{sub_path}"
|
107
|
+
rescue Exception => e
|
108
|
+
puts "potion - could not find template directory\n"
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def insert_from_template(template_name, name)
|
115
|
+
puts `rmq create #{template_name} #{name}`
|
116
|
+
return
|
117
|
+
|
118
|
+
#if [:lib, :collection_view_controller, :shared, :controller].include?(template_name)
|
119
|
+
#end
|
120
|
+
|
121
|
+
puts "\n Creating #{template_name}: #{name}\n\n"
|
122
|
+
|
123
|
+
return unless (@template_path = template_path(template_name))
|
124
|
+
files = Dir["#{@template_path}**/*"].select {|f| !File.directory? f}
|
125
|
+
|
126
|
+
@name = name.gsub(/_?(controller|stylesheet)/,'')
|
127
|
+
@name_camel_case = @name.split('_').map{|word| word.capitalize}.join
|
128
|
+
|
129
|
+
files.each do |template_file_path_and_name|
|
130
|
+
@in_app_path = File.dirname(template_file_path_and_name).gsub(@template_path, '')
|
131
|
+
@ext = File.extname(template_file_path_and_name)
|
132
|
+
@file_name = File.basename(template_file_path_and_name, @ext)
|
133
|
+
|
134
|
+
@new_file_name = @file_name.gsub('name', @name)
|
135
|
+
@new_file_path_name = "#{Dir.pwd}/#{@in_app_path}/#{@new_file_name}#{@ext}"
|
136
|
+
|
137
|
+
if @dry_run
|
138
|
+
puts "\n Instance vars:"
|
139
|
+
self.instance_variables.each{|var| puts " #{var} = #{self.instance_variable_get(var)}"}
|
140
|
+
puts
|
141
|
+
end
|
142
|
+
|
143
|
+
if Dir.exist?(@in_app_path)
|
144
|
+
puts " Using existing directory: #{@in_app_path}"
|
145
|
+
else
|
146
|
+
puts " \u0394 Creating directory: #{@in_app_path}"
|
147
|
+
Dir.mkdir(@in_app_path) unless @dry_run
|
148
|
+
end
|
149
|
+
|
150
|
+
results = load_and_parse_erb(template_file_path_and_name)
|
151
|
+
|
152
|
+
if File.exists?(@new_file_path_name)
|
153
|
+
puts " X File exists, SKIPPING: #{@new_file_path_name}"
|
154
|
+
else
|
155
|
+
puts " \u0394 Creating file: #{@new_file_path_name}"
|
156
|
+
File.open(@new_file_path_name, 'w+') { |file| file.write(results) } unless @dry_run
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
puts "\n Done"
|
161
|
+
end
|
162
|
+
|
163
|
+
def load_and_parse_erb(template_file_name_and_path)
|
164
|
+
template_file = File.open(template_file_name_and_path, 'r').read
|
165
|
+
erb = ERB.new(template_file)
|
166
|
+
erb.result(binding)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
# Process input, execute actions
|
173
|
+
unless ARGV.length > 0
|
174
|
+
puts "potion - Invalid command, do something like this: potion create my_new_app\n"
|
175
|
+
puts PotionCommandLine::HELP_TEXT
|
176
|
+
exit
|
177
|
+
end
|
178
|
+
|
179
|
+
action = ARGV[0]
|
180
|
+
query = ARGV[1]
|
181
|
+
|
182
|
+
case action
|
183
|
+
when 'create'
|
184
|
+
PotionCommandLine.create(ARGV[1], ARGV[2], ARGV[3])
|
185
|
+
when 'rmq_docs'
|
186
|
+
if query
|
187
|
+
query = URI::encode(query)
|
188
|
+
url = "http://rubymotionquery.com?s=#{query}&post_type=document"
|
189
|
+
`open #{url}`
|
190
|
+
else
|
191
|
+
`open http://rubymotionquery.com/documentation`
|
192
|
+
end
|
193
|
+
when '--help', '-h'
|
194
|
+
puts PotionCommandLine::HELP_TEXT
|
195
|
+
when '-v', '--version'
|
196
|
+
puts RedPotion::VERSION
|
197
|
+
else
|
198
|
+
puts 'potion - Invalid action'
|
199
|
+
puts PotionCommandLine::HELP_TEXT
|
200
|
+
end
|
201
|
+
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfiniteRed
|
@@ -71,11 +71,13 @@ description: RedPotion - The best combination of RubyMotion tools and libraries
|
|
71
71
|
email:
|
72
72
|
- hello@infinitered.com
|
73
73
|
- hello@clearsightstudio.com
|
74
|
-
executables:
|
74
|
+
executables:
|
75
|
+
- potion
|
75
76
|
extensions: []
|
76
77
|
extra_rdoc_files: []
|
77
78
|
files:
|
78
79
|
- README.md
|
80
|
+
- bin/potion
|
79
81
|
- lib/project/redpotion.rb
|
80
82
|
- lib/project/version.rb
|
81
83
|
- lib/redpotion.rb
|
@@ -99,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
101
|
version: '0'
|
100
102
|
requirements: []
|
101
103
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.4.4
|
103
105
|
signing_key:
|
104
106
|
specification_version: 4
|
105
107
|
summary: RedPotion combines RMQ, ProMotion, CDQ, AFMotion, and more for the perfect
|