ruby_motion_query 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76f506811d1d67113c310ec502d535616f6b38f1
4
- data.tar.gz: 37a3df0dc5b514d37b66f06cac433c8e284b742b
3
+ metadata.gz: 4af6aa73cedcfee0e9779696b6aba1b487875e12
4
+ data.tar.gz: 046515ebe027e0d3161d62eb5f45d84b3cd8aa66
5
5
  SHA512:
6
- metadata.gz: fcb6596b2d269f2f6f5a4516f8d2a2d4962a3f4bf1fba20428370f9a5cf64cbdc3ba6d7bc758be356670f9ffe1dad72599079c7d7e8ac9a6dc8fceee92905357
7
- data.tar.gz: 2b373b59ba3a839755e3fa24d930871723dfea9a974a63ae045ae7bff3e0fb928249665f7e51695fbdb6ec1447561b6722af7101c701338c92581400bffa2a0c
6
+ metadata.gz: 73c0dbb90e91d58dea1bea33e9f1020e56fac0fd8bab8849057f768879c38e409e39b42bbce6cefe4db3a39125b77a2257534b392a3c8a55645f22ad28215bde
7
+ data.tar.gz: 82af998393074a7f53cb872ba7252a639985cccdaf5441783bf20271acf1b5438465416ef9dbfdb29bf88a93bc3d66d18b22c129a5f1a461a83ca1c8424a2884
@@ -11,4 +11,8 @@ Motion::Project::App.setup do |app|
11
11
  files << Dir.glob(File.join(parent, "motion/**/*.rb"))
12
12
  files.flatten!.uniq!
13
13
  app.files.unshift files
14
+ app.development do
15
+ app.info_plist["ProjectBuildTime"] = Time.now
16
+ app.info_plist["ProjectRootPath"] = File.absolute_path(app.project_dir)
17
+ end
14
18
  end
data/motion/ext.rb CHANGED
@@ -70,37 +70,46 @@ if RUBYMOTION_ENV == "development"
70
70
  private
71
71
 
72
72
  def enable_rmq_live_stylesheets(interval)
73
- # Get list of stylesheet files
74
73
  return unless root_path = RubyMotionQuery::RMQ.project_path
75
74
 
75
+ # Get list of stylesheet files
76
76
  path_query = "#{root_path}/app/stylesheets/*.rb"
77
- puts path_query if @live_reload_debug
78
77
  stylesheet_file_paths = Dir.glob(path_query)
79
- stylesheet_file_paths.delete_if{|stylesheet| stylesheet =~ /application_stylesheet\.rb$/}
80
- puts stylesheet_file_paths if @live_reload_debug
81
78
 
82
79
  stylesheets = stylesheet_file_paths.inject({}) do |out, stylesheet_path_file|
83
- klassname = File.basename(stylesheet_path_file, '.rb')
84
- klassname = klassname.gsub("_", " ").gsub(/\b(?<!['’`])[a-z]/){ $&.capitalize }.gsub(/\s/, "")
85
- out[klassname] = {
80
+ klass_name = File.basename(stylesheet_path_file, '.rb')
81
+ klass_name = klass_name.gsub("_", " ").gsub(/\b(?<!['’`])[a-z]/){ $&.capitalize }.gsub(/\s/, "")
82
+ out[klass_name] = {
83
+ class_name: klass_name,
86
84
  path: stylesheet_path_file,
87
- modified: File.mtime(stylesheet_path_file)
85
+ modified: File.mtime(stylesheet_path_file),
88
86
  }
89
87
  out
90
88
  end
91
89
 
90
+ if @live_reload_debug
91
+ puts "path_query: #{path_query}\n"
92
+ puts stylesheet_file_paths
93
+ #puts stylesheets.to_s
94
+ end
95
+
96
+ # Check if any stylesheets have been modified
92
97
  @live_reload_timer = RubyMotionQuery::App.every(interval) do
93
- vc_rmq = rmq.view_controller.rmq
94
- klass_name = vc_rmq.stylesheet.class.name
95
- if stylesheet = stylesheets[klass_name]
96
- if File.mtime(stylesheet[:path]) > stylesheet[:modified]
98
+ style_changed = false
99
+ stylesheets.each do |key, stylesheet|
100
+
101
+ modified_at = File.mtime(stylesheet[:path])
102
+ if modified_at > stylesheet[:modified]
97
103
  code = File.read(stylesheet[:path])
98
- puts "Reloaded #{klass_name}." if @live_reload_debug
104
+ puts "Reloaded #{stylesheet[:class_name]}" if @live_reload_debug
99
105
  eval(code)
100
- vc_rmq.all.and_self.reapply_styles
101
- stylesheets[klass_name][:modified] = File.mtime(stylesheet[:path])
106
+ stylesheet[:modified] = modified_at
107
+ style_changed = true
102
108
  end
109
+
103
110
  end
111
+
112
+ rmq.view_controller.rmq.all.and_self.reapply_styles if style_changed
104
113
  end
105
114
 
106
115
  "Live reloading of RMQ stylesheets is now on."
@@ -132,6 +132,41 @@ module RubyMotionQuery
132
132
  end
133
133
  end
134
134
 
135
+ def log_stylers(markdown = false)
136
+ styler_constants_names = Stylers.constants.grep(/.*Styler$/).sort
137
+ $s = styler_constants_names
138
+ styler_constants_names.delete(:UIViewStyler)
139
+ styler_constants_names.unshift(:UIViewStyler)
140
+
141
+ object_methods = Object.public_instance_methods
142
+ ui_view_styler_methods = (Stylers::UIViewStyler.public_instance_methods - object_methods).sort
143
+
144
+ # remove deprecated methods, sorry for this hack
145
+ deprecated = [:"left", :"left=:", :"x", :"x=:", :"top", :"top=:", :"y", :"y=:", :"from_right", :"from_right=:",
146
+ :"width", :"width=:", :"height", :"height=:", :"bottom", :"bottom=:", :"from_bottom", :"from_bottom=:"]
147
+
148
+
149
+ styler_constants_names.each do |constant_name|
150
+ constant_name = constant_name.gsub(/^:/, '')
151
+ styler_constant = RubyMotionQuery::Stylers.const_get(constant_name)
152
+
153
+ methods = if constant_name == "UIViewStyler"
154
+ (ui_view_styler_methods - deprecated).sort
155
+ else
156
+ (styler_constant.public_instance_methods - ui_view_styler_methods - object_methods).sort
157
+ end
158
+ methods = methods.map do |method|
159
+ method = method.gsub(/:$/, '')
160
+ method << "(value)" if method.end_with?("=")
161
+ method
162
+ end
163
+
164
+ puts "#{'## ' if markdown}#{constant_name}\n\n"
165
+ puts "* #{methods.join("\n* ")}"
166
+ puts "\n\n"
167
+ end
168
+ end
169
+
135
170
  protected
136
171
 
137
172
  # Override to set your own stylers, or just open up the styler classes
@@ -118,6 +118,22 @@ end)
118
118
 
119
119
  ppath
120
120
  end
121
+
122
+ # To use this, put this in your Rakefile:
123
+ # app.development do
124
+ # app.info_plist["ProjectBuildTime"] = Time.now
125
+ # end
126
+ def build_time
127
+ if btime = NSBundle.mainBundle.infoDictionary["ProjectBuildTime"]
128
+ else
129
+ puts %(
130
+ [RMQ Warning] The build_time method requires that this code is in your RakeFile:
131
+ app.development do
132
+ app.info_plist["ProjectBuildTime"] = Time.now
133
+ end)
134
+ end
135
+ btime
136
+ end
121
137
  end
122
138
  end
123
139
 
@@ -1,5 +1,5 @@
1
1
  module RubyMotionQuery
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
 
4
4
  class RMQ
5
5
  def version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_motion_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Werth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-15 00:00:00.000000000 Z
12
+ date: 2015-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon