bluepotion 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bluepotion_add_line_numbers +46 -0
- data/bin/bluepotion_remove_line_numbers +34 -0
- data/lib/project/blue_potion_net.rb +5 -5
- data/lib/project/compatibility/dispatch.rb +7 -0
- data/lib/project/pro_motion/adapters/pm_base_adapter.rb +7 -1
- data/lib/project/pro_motion/adapters/pm_cursor_adapter.rb +10 -2
- data/lib/project/pro_motion/fragments/pm_list_screen.rb +4 -0
- data/lib/project/version.rb +1 -1
- data/lib/project/volley_wrap/http_result.rb +0 -2
- data/lib/project/volley_wrap/request.rb +20 -6
- data/lib/project/volley_wrap/session_client.rb +2 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2753dc1bf30f1d007bbdde6e645aa14894fafe0
|
4
|
+
data.tar.gz: 3f373b657682bf8617045c056e5cee5b88e7b6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85af577175f249ca9b416135aaa58ba8191428a4707024fb7cbc8033702b04d455ce91c792ab56c8ebc23e6e32bd96470dfe0e3d926e3656368ef98f06aaba49
|
7
|
+
data.tar.gz: 6b1233452ee3ca385c832e5708ce0e8d8b37975739a08a047c8741a2cbc4ab85038d2581b0953be98aa02e508b350138324715b3985fce3a99f39b44b9b258d2
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
def skip_line?(line)
|
5
|
+
return true if
|
6
|
+
line.strip == "" ||
|
7
|
+
line.strip =~ /^class\s/ ||
|
8
|
+
line.strip =~ /^module\s/ ||
|
9
|
+
line.strip =~ /^def\s/ ||
|
10
|
+
line.strip =~ /^if\s/ ||
|
11
|
+
line.strip =~ /^unless\s/ ||
|
12
|
+
line.strip =~ /^while\s/ ||
|
13
|
+
line.strip =~ /^#/ ||
|
14
|
+
line =~ /\sdo(\s|$)/ ||
|
15
|
+
line.strip == "end"
|
16
|
+
end
|
17
|
+
|
18
|
+
base_path = Dir.pwd
|
19
|
+
file = ARGV[0]
|
20
|
+
path_and_file = "#{base_path}/#{file}"
|
21
|
+
puts "Adding line numbers to #{path_and_file}"
|
22
|
+
|
23
|
+
file = File.open(path_and_file)
|
24
|
+
contents = file.read
|
25
|
+
file.close
|
26
|
+
|
27
|
+
lines = contents.split("\n")
|
28
|
+
|
29
|
+
out = []
|
30
|
+
lines.each_with_index do |line, i|
|
31
|
+
if skip_line?(line)
|
32
|
+
out << " " * 13
|
33
|
+
else
|
34
|
+
out << "mp \"#{(i + 1).to_s.rjust(4)} ‡\"; "
|
35
|
+
end
|
36
|
+
out << line
|
37
|
+
out << "\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
out = out.join
|
41
|
+
|
42
|
+
FileUtils.cp path_and_file, "#{path_and_file}_before_adding_lines"
|
43
|
+
|
44
|
+
File.write(path_and_file, out)
|
45
|
+
|
46
|
+
puts "Done"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
base_path = Dir.pwd
|
5
|
+
file = ARGV[0]
|
6
|
+
path_and_file = "#{base_path}/#{file}"
|
7
|
+
puts "Removing line numbers from #{path_and_file}"
|
8
|
+
|
9
|
+
file = File.open(path_and_file)
|
10
|
+
contents = file.read
|
11
|
+
file.close
|
12
|
+
|
13
|
+
lines = contents.split("\n")
|
14
|
+
|
15
|
+
out = []
|
16
|
+
lines.each_with_index do |line, i|
|
17
|
+
ll = line.length
|
18
|
+
|
19
|
+
if ll > 12
|
20
|
+
original_line = line[13..(ll - 1)]
|
21
|
+
out << original_line
|
22
|
+
else
|
23
|
+
out << line
|
24
|
+
end
|
25
|
+
out << "\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
out = out.join
|
29
|
+
|
30
|
+
FileUtils.cp path_and_file, "#{path_and_file}_before_removing_lines"
|
31
|
+
|
32
|
+
File.write(path_and_file, out)
|
33
|
+
|
34
|
+
puts "Done"
|
@@ -71,17 +71,17 @@ class BluePotionNet
|
|
71
71
|
session_client.build_shared(PMApplication.current_application.context, url, &block)
|
72
72
|
end
|
73
73
|
|
74
|
-
def get(url, opts={}, &block)
|
74
|
+
def get(url, params={}, opts={}, &block)
|
75
75
|
raise "[BluePotion error] You must provide a block when using app.net.get" unless block
|
76
76
|
ses = opts.delete(:session) || self.session
|
77
|
-
|
78
|
-
ses.get(url, opts, &block)
|
77
|
+
ses.get(url, params, opts, &block)
|
79
78
|
end
|
80
79
|
|
81
|
-
def get_json(url, opts={}, &block)
|
80
|
+
def get_json(url, params={}, opts={}, &block)
|
82
81
|
raise "[BluePotion error] You must provide a block when using app.net.get_json" unless block
|
82
|
+
ses = opts.delete(:session) || self.session
|
83
83
|
opts[:serializer] = :json
|
84
|
-
get(url, opts, &block)
|
84
|
+
ses.get(url, params, opts, &block)
|
85
85
|
end
|
86
86
|
|
87
87
|
def post(url, params, opts={}, &block)
|
@@ -70,6 +70,12 @@ class PMBaseAdapter < Android::Widget::BaseAdapter
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def update_view(view, data)
|
73
|
-
|
73
|
+
if cell_options[:update].is_a?(Proc)
|
74
|
+
cell_options[:update].call(out, data)
|
75
|
+
elsif cell_options[:update].is_a?(Symbol) || cell_options[:update].is_a?(String)
|
76
|
+
find.screen.send(cell_options[:update], out, data)
|
77
|
+
else
|
78
|
+
out.text = data
|
79
|
+
end
|
74
80
|
end
|
75
81
|
end
|
@@ -22,13 +22,21 @@ class PMCursorAdapter < PMBaseAdapter
|
|
22
22
|
out = convert_view || rmq.create!(cell_options[:cell_class] || Potion::TextView)
|
23
23
|
update_view(out, data)
|
24
24
|
if cell_options[:action]
|
25
|
-
find(out).on(:tap)
|
25
|
+
find(out).on(:tap) do
|
26
|
+
find.screen.send(cell_options[:action], item(position), position)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
out
|
28
30
|
end
|
29
31
|
|
30
32
|
def update_view(out, data)
|
31
|
-
|
33
|
+
if cell_options[:update].is_a?(Proc)
|
34
|
+
cell_options[:update].call(out, data)
|
35
|
+
elsif cell_options[:update].is_a?(Symbol) || cell_options[:update].is_a?(String)
|
36
|
+
find.screen.send(cell_options[:update], out, data)
|
37
|
+
else
|
38
|
+
out.text = data.getString(cell_options[:title_column].to_i)
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
end
|
data/lib/project/version.rb
CHANGED
@@ -8,10 +8,9 @@ module VW
|
|
8
8
|
VOLLEY_PUT = 2
|
9
9
|
VOLLEY_DELETE = 3
|
10
10
|
|
11
|
-
def self.get_request(url, listener)
|
12
|
-
|
13
|
-
|
14
|
-
req.setRetryPolicy(retry_policy)
|
11
|
+
def self.get_request(url, params, listener)
|
12
|
+
url = add_params_to_url(url, params)
|
13
|
+
request_with_params(VOLLEY_GET, url, params, listener).tap do |req|
|
15
14
|
req.listener = listener
|
16
15
|
end
|
17
16
|
end
|
@@ -52,6 +51,18 @@ module VW
|
|
52
51
|
super
|
53
52
|
end
|
54
53
|
|
54
|
+
def self.add_params_to_url(url, params)
|
55
|
+
if params.blank?
|
56
|
+
url
|
57
|
+
else
|
58
|
+
params_array = params.map do |k, v|
|
59
|
+
v = Java::Net::URLEncoder.encode(v, "utf-8")
|
60
|
+
"#{k}=#{v}"
|
61
|
+
end
|
62
|
+
"#{url}?#{params_array.join("&")}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
55
66
|
def self.set_request_for_listener(method, url, params, listener)
|
56
67
|
# There probably is a much better way then passing all these around like this
|
57
68
|
listener.request_url = url
|
@@ -83,13 +94,16 @@ module VW
|
|
83
94
|
new_params
|
84
95
|
end
|
85
96
|
|
97
|
+
|
86
98
|
def self.request_with_params(method, url, params, listener)
|
87
99
|
set_request_for_listener method, url, params, listener
|
88
100
|
|
89
101
|
Request.new(method, url, listener, listener).tap do |req|
|
90
102
|
req.setRetryPolicy(retry_policy)
|
91
|
-
|
92
|
-
|
103
|
+
unless method == VOLLEY_GET
|
104
|
+
params = prepare_params(params)
|
105
|
+
req.setParams(params)
|
106
|
+
end
|
93
107
|
end
|
94
108
|
end
|
95
109
|
|
@@ -29,11 +29,11 @@ module VW
|
|
29
29
|
@serializer = serializer
|
30
30
|
end
|
31
31
|
|
32
|
-
def get(url, opts={},
|
32
|
+
def get(url, params, opts={}, &block)
|
33
33
|
request_url = base_url + url
|
34
34
|
ser = opts[:serializer] || @serializer
|
35
35
|
listener = VW::ResponseListener.new(ser, &block)
|
36
|
-
queue VW::Request.get_request(request_url, listener)
|
36
|
+
queue VW::Request.get_request(request_url, params, listener)
|
37
37
|
end
|
38
38
|
|
39
39
|
def post(url, params, opts={}, &block)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluepotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfiniteRed
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -31,13 +31,18 @@ email:
|
|
31
31
|
- hello@clearsightstudio.com
|
32
32
|
executables:
|
33
33
|
- bluepotion
|
34
|
+
- bluepotion_add_line_numbers
|
35
|
+
- bluepotion_remove_line_numbers
|
34
36
|
extensions: []
|
35
37
|
extra_rdoc_files: []
|
36
38
|
files:
|
37
39
|
- README.md
|
38
40
|
- bin/bluepotion
|
41
|
+
- bin/bluepotion_add_line_numbers
|
42
|
+
- bin/bluepotion_remove_line_numbers
|
39
43
|
- lib/bluepotion.rb
|
40
44
|
- lib/project/blue_potion_net.rb
|
45
|
+
- lib/project/compatibility/dispatch.rb
|
41
46
|
- lib/project/ext/activity.rb
|
42
47
|
- lib/project/ext/array_list.rb
|
43
48
|
- lib/project/ext/fragment.rb
|