codeobscure 0.1.6.3 → 0.1.6.5
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.
- checksums.yaml +4 -4
- data/lib/codeobscure.rb +3 -1
- data/lib/codeobscure/funclist.rb +2 -1
- data/lib/codeobscure/imagemix.rb +30 -0
- data/lib/codeobscure/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7078d90b8993eae6c1a91a40e54125209e46337ac5f03f62fd6ef18ac3f1e411
|
4
|
+
data.tar.gz: 6fe0727ec2ccbfafc38f0eabe001ed4c4468621d430f24e5cb80488e58924d1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc49e1a9d92b275498acb23ab51ed55a37146e5de46fedea04972225a59f858bb6df2528ed2e20ce3f0a10e9af6092e35d47b1144092a9323fecc137ad081f96
|
7
|
+
data.tar.gz: d82ef5be08be43c81fd340d8210cadf715a4530e9054ee6ece7c5c38da7f9a6c60bf8a37182f56406bbc53bf9ca37d3a60a5deefef8963bda4bdf4cc06450bf9
|
data/lib/codeobscure.rb
CHANGED
@@ -2,6 +2,7 @@ require "codeobscure/version"
|
|
2
2
|
require "codeobscure/funclist"
|
3
3
|
require "codeobscure/obscure"
|
4
4
|
require "codeobscure/filtsymbols"
|
5
|
+
require "codeobscure/imagemix"
|
5
6
|
require "colorize"
|
6
7
|
require 'xcodeproj'
|
7
8
|
require 'fileutils'
|
@@ -36,7 +37,7 @@ module Codeobscure
|
|
36
37
|
options[:reset] = true
|
37
38
|
end
|
38
39
|
|
39
|
-
opts.on("-f", "--fetch type1,type2,type3", "fetch and replace type,default type is [c,p,f].c for class,p for property,f for function") do |v|
|
40
|
+
opts.on("-f", "--fetch type1,type2,type3", "fetch and replace type,default type is [c,p,f,i].c for class,p for property,f for function") do |v|
|
40
41
|
options[:fetch] = v
|
41
42
|
end
|
42
43
|
|
@@ -92,6 +93,7 @@ module Codeobscure
|
|
92
93
|
xpj_path = options[:obscure]
|
93
94
|
if File.exist? xpj_path
|
94
95
|
root_dir = xpj_path.split("/")[0...-1].join "/"
|
96
|
+
ImageMix.mix root_dir
|
95
97
|
FuncList.genFuncList root_dir , "h", true, fetch_types
|
96
98
|
header_file = Obscure.run root_dir , options[:type]
|
97
99
|
project = Xcodeproj::Project.open xpj_path
|
data/lib/codeobscure/funclist.rb
CHANGED
@@ -35,7 +35,7 @@ module FuncList
|
|
35
35
|
str = to_utf8 content_str
|
36
36
|
|
37
37
|
#filter file
|
38
|
-
if file_path.include?
|
38
|
+
if file_path.include?(".storyboard") || file_path.include?(".xib")
|
39
39
|
str.scan @@storyboard_filt_regex do |curr_match|
|
40
40
|
md = Regexp.last_match
|
41
41
|
whole_match = md[0]
|
@@ -187,6 +187,7 @@ module FuncList
|
|
187
187
|
file_pathes += `find #{path} -name "*.m" -d`.split "\n"
|
188
188
|
end
|
189
189
|
file_pathes += `find #{path} -name "*.storyboard" -d`.split "\n"
|
190
|
+
file_pathes += `find #{path} -name "*.xib" -d`.split "\n"
|
190
191
|
|
191
192
|
file_pathes.each do |file_path|
|
192
193
|
content = File.read file_path
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "colorize"
|
2
|
+
module ImageMix
|
3
|
+
|
4
|
+
def self.mix(root_path)
|
5
|
+
|
6
|
+
puts "处理图片资源中...".colorize(:yellow)
|
7
|
+
|
8
|
+
file_pathes = `find #{root_path} -name "*.png" -d`.split "\n"
|
9
|
+
file_pathes += `find #{root_path} -name "*.jpeg" -d`.split "\n"
|
10
|
+
file_pathes += `find #{root_path} -name "*.jpg" -d`.split "\n"
|
11
|
+
file_pathes += `find #{root_path} -name "*.pdf" -d`.split "\n"
|
12
|
+
|
13
|
+
file_pathes.each do |file_path|
|
14
|
+
puts "处理图片#{file_path}"
|
15
|
+
|
16
|
+
identifier = "9751ccfb0743f75600dba0d69e482433"
|
17
|
+
date_str = Time.now.to_f.to_s
|
18
|
+
content = File.read(file_path)
|
19
|
+
addition_content = "#{identifier}#{date_str}#{identifier}"
|
20
|
+
aindex = content.index identifier
|
21
|
+
if aindex
|
22
|
+
content[aindex..-1] = addition_content
|
23
|
+
else
|
24
|
+
content += addition_content
|
25
|
+
end
|
26
|
+
File.open(file_path, "w") {|file| file.puts content }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/codeobscure/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeobscure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.6.
|
4
|
+
version: 0.1.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaich
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/codeobscure.rb
|
123
123
|
- lib/codeobscure/filtsymbols.rb
|
124
124
|
- lib/codeobscure/funclist.rb
|
125
|
+
- lib/codeobscure/imagemix.rb
|
125
126
|
- lib/codeobscure/obscure.rb
|
126
127
|
- lib/codeobscure/version.rb
|
127
128
|
- test/codeobscure_test.rb
|