assetify 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +69 -57
- data/Rakefile +1 -50
- data/bin/assetify +4 -8
- data/lib/assetify.rb +11 -11
- data/lib/assetify/asset.rb +47 -64
- data/lib/assetify/asset/pathfix.rb +17 -19
- data/lib/assetify/asset/pkg.rb +16 -16
- data/lib/assetify/assetfile.rb +11 -10
- data/lib/assetify/cli.rb +47 -15
- data/lib/assetify/cli/colored.rb +20 -22
- data/lib/assetify/cli/term.rb +6 -4
- data/lib/assetify/constants.rb +4 -5
- data/lib/assetify/dsl.rb +35 -35
- data/lib/assetify/extensions/string.rb +6 -8
- data/lib/assetify/gui.rb +4 -4
- data/lib/assetify/gui/server.rb +2 -3
- data/lib/assetify/helpers.rb +15 -17
- data/lib/assetify/version.rb +1 -1
- metadata +110 -126
@@ -1,17 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# Adapted ptools - http://rdoc.info/gems/ptools/1.2.1/File.binary%3F
|
3
|
+
#
|
1
4
|
class String
|
2
|
-
|
3
|
-
#
|
4
|
-
# Adapted ptools - http://rdoc.info/gems/ptools/1.2.1/File.binary%3F
|
5
|
-
#
|
6
5
|
def binary?
|
7
|
-
#s = (File.read(file, File.stat(file).blksize) || "").split(//)
|
8
|
-
s = (self[0..4096].force_encoding(
|
9
|
-
ratio =
|
6
|
+
# s = (File.read(file, File.stat(file).blksize) || "").split(//)
|
7
|
+
s = (self[0..4096].force_encoding('binary') || '') # .split(//)
|
8
|
+
ratio = s.gsub(/\d|\w|\s|[-~\.]/, '').size / s.size.to_f
|
10
9
|
# if Opt[:debug]
|
11
10
|
# print "Detecting #{s}"
|
12
11
|
# puts "Ratio #{ratio}"
|
13
12
|
# end
|
14
13
|
ratio > 0.3
|
15
14
|
end
|
16
|
-
|
17
15
|
end
|
data/lib/assetify/gui.rb
CHANGED
data/lib/assetify/gui/server.rb
CHANGED
@@ -7,19 +7,18 @@ get '/' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
get '/new' do
|
10
|
-
headers = {} #"Allow" => "BREW, POST, GET, PROPFIND, WHEN", "Refresh" => "Refresh: 20; http://www.ietf.org/rfc/rfc2324.txt"
|
10
|
+
headers = {} # "Allow" => "BREW, POST, GET, PROPFIND, WHEN", "Refresh" => "Refresh: 20; http://www.ietf.org/rfc/rfc2324.txt"
|
11
11
|
body "T#{Time.now.to_i}"
|
12
12
|
end
|
13
13
|
|
14
14
|
post '/edit' do
|
15
15
|
puts params
|
16
16
|
|
17
|
-
body
|
17
|
+
body 'OK'
|
18
18
|
end
|
19
19
|
|
20
20
|
get '/i' do
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
23
|
get '/u' do
|
25
24
|
end
|
data/lib/assetify/helpers.rb
CHANGED
@@ -2,7 +2,6 @@ require 'digest/md5'
|
|
2
2
|
|
3
3
|
module Assetify
|
4
4
|
module Helpers
|
5
|
-
|
6
5
|
#
|
7
6
|
# Detects numerical software version from text.
|
8
7
|
#
|
@@ -12,31 +11,31 @@ module Assetify
|
|
12
11
|
find_version_from_bin(txt)
|
13
12
|
else
|
14
13
|
v = find_version_from_txt(txt)
|
15
|
-
v && v[0] =~ /(\d+)\.(\d+).*/ ? v :
|
14
|
+
v && v[0] =~ /(\d+)\.(\d+).*/ ? v : find_version_from_bin(txt)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
18
|
private
|
20
19
|
|
21
|
-
def find_version_from_txt
|
20
|
+
def find_version_from_txt(blob)
|
22
21
|
version = blob.match(/(?:(\d+)\.)?(?:(\d+)\.)?(\d+)?\.?(\d+)/)
|
23
22
|
# If matches a dot, it`s text. Otherwise make it number.
|
24
23
|
v = version.to_a.reject(&:nil?).map { |d| d =~ /\./ ? d : d.to_i }
|
25
24
|
v.empty? || 0 == v[0] ? nil : v
|
26
25
|
end
|
27
26
|
|
28
|
-
def find_version_from_bin
|
27
|
+
def find_version_from_bin(blob)
|
29
28
|
Digest::MD5.hexdigest blob
|
30
29
|
end
|
31
30
|
|
32
31
|
#
|
33
32
|
# Downloads assets
|
34
33
|
#
|
35
|
-
def download
|
34
|
+
def download(url_str, limit = 10)
|
36
35
|
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
37
36
|
uri = URI.parse url_str
|
38
|
-
http = Net::HTTP.start(uri.host, :
|
39
|
-
response = http.get(uri.path.empty? ?
|
37
|
+
http = Net::HTTP.start(uri.host, use_ssl: url_str =~ /https/) # do |http|
|
38
|
+
response = http.get(uri.path.empty? ? '/' : uri.path)
|
40
39
|
|
41
40
|
case response
|
42
41
|
when Net::HTTPSuccess then @data = response
|
@@ -50,25 +49,24 @@ module Assetify
|
|
50
49
|
|
51
50
|
def get_data(str)
|
52
51
|
@data = if str =~ /http/
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
data = download(str)
|
53
|
+
data ? data.body : nil
|
54
|
+
else
|
55
|
+
File.open(str)
|
56
|
+
end
|
58
57
|
end
|
59
58
|
|
60
|
-
def write
|
61
|
-
FileUtils.mkdir_p path unless Dir.
|
62
|
-
File.open(fullpath,
|
59
|
+
def write(binary)
|
60
|
+
FileUtils.mkdir_p path unless Dir.exist?(path)
|
61
|
+
File.open(fullpath, 'w') { |f| f.puts(binary) }
|
63
62
|
end
|
64
63
|
|
65
|
-
def redirect_url
|
64
|
+
def redirect_url(response)
|
66
65
|
if response['location'].nil?
|
67
66
|
response.body.match(/<a href=\"([^>]+)\">/i)[1]
|
68
67
|
else
|
69
68
|
response['location']
|
70
69
|
end
|
71
70
|
end
|
72
|
-
|
73
71
|
end
|
74
72
|
end
|
data/lib/assetify/version.rb
CHANGED
metadata
CHANGED
@@ -1,182 +1,166 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: assetify
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 2
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
segments_generated: true
|
10
|
-
version: 2.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Marcos Piccinini
|
14
8
|
- Rafael Barbosa
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: rspec
|
24
|
-
requirement:
|
25
|
-
|
26
|
-
requirements:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
27
18
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
segments_generated: true
|
19
|
+
- !ruby/object:Gem::Version
|
34
20
|
version: 2.3.0
|
35
21
|
type: :development
|
36
22
|
prerelease: false
|
37
|
-
version_requirements:
|
38
|
-
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 2.3.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
39
29
|
name: bundler
|
40
|
-
requirement:
|
41
|
-
|
42
|
-
requirements:
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
43
32
|
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
- 0
|
49
|
-
segments_generated: true
|
33
|
+
- !ruby/object:Gem::Version
|
50
34
|
version: 1.0.0
|
51
35
|
type: :development
|
52
36
|
prerelease: false
|
53
|
-
version_requirements:
|
54
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.0.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
55
43
|
name: jeweler
|
56
|
-
requirement:
|
57
|
-
|
58
|
-
requirements:
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
59
46
|
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
- 0
|
63
|
-
segments_generated: true
|
64
|
-
version: "0"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
65
49
|
type: :development
|
66
50
|
prerelease: false
|
67
|
-
version_requirements:
|
68
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
69
57
|
name: webmock
|
70
|
-
requirement:
|
71
|
-
|
72
|
-
requirements:
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
73
60
|
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
- 0
|
77
|
-
segments_generated: true
|
78
|
-
version: "0"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
79
63
|
type: :development
|
80
64
|
prerelease: false
|
81
|
-
version_requirements:
|
82
|
-
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
83
71
|
name: sinatra
|
84
|
-
requirement:
|
85
|
-
|
86
|
-
requirements:
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
87
74
|
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
- 0
|
91
|
-
segments_generated: true
|
92
|
-
version: "0"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
93
77
|
type: :development
|
94
78
|
prerelease: false
|
95
|
-
version_requirements:
|
96
|
-
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
97
85
|
name: libarchive
|
98
|
-
requirement:
|
99
|
-
|
100
|
-
requirements:
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
101
88
|
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
- 0
|
105
|
-
segments_generated: true
|
106
|
-
version: "0"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
107
91
|
type: :development
|
108
92
|
prerelease: false
|
109
|
-
version_requirements:
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
110
98
|
description: Downloads/updates assets based on an Assetfile. Any framework.
|
111
|
-
email:
|
99
|
+
email:
|
112
100
|
- x@nofxx.com
|
113
|
-
executables:
|
101
|
+
executables:
|
114
102
|
- assetify
|
115
103
|
extensions: []
|
116
|
-
|
117
104
|
extra_rdoc_files: []
|
118
|
-
|
119
|
-
|
105
|
+
files:
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- bin/assetify
|
109
|
+
- lib/assetify.rb
|
110
|
+
- lib/assetify/asset.rb
|
111
|
+
- lib/assetify/asset/pathfix.rb
|
112
|
+
- lib/assetify/asset/pkg.rb
|
113
|
+
- lib/assetify/assetfile.rb
|
114
|
+
- lib/assetify/cli.rb
|
120
115
|
- lib/assetify/cli/colored.rb
|
121
116
|
- lib/assetify/cli/term.rb
|
122
|
-
- lib/assetify/
|
123
|
-
- lib/assetify/
|
117
|
+
- lib/assetify/constants.rb
|
118
|
+
- lib/assetify/dsl.rb
|
124
119
|
- lib/assetify/extensions/string.rb
|
125
|
-
- lib/assetify/
|
120
|
+
- lib/assetify/gui.rb
|
126
121
|
- lib/assetify/gui/server.rb
|
127
122
|
- lib/assetify/gui/views/home.html.erb
|
128
|
-
- lib/assetify/
|
129
|
-
- lib/assetify/constants.rb
|
130
|
-
- lib/assetify/asset.rb
|
131
|
-
- lib/assetify/dsl.rb
|
123
|
+
- lib/assetify/helpers.rb
|
132
124
|
- lib/assetify/version.rb
|
133
|
-
- lib/assetify/asset/pathfix.rb
|
134
|
-
- lib/assetify/asset/pkg.rb
|
135
|
-
- lib/assetify.rb
|
136
|
-
- README.md
|
137
|
-
- Rakefile
|
138
|
-
- bin/assetify
|
139
|
-
has_rdoc: true
|
140
125
|
homepage: http://github.com/nofxx/assetify
|
141
|
-
licenses:
|
126
|
+
licenses:
|
142
127
|
- MIT
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
128
|
+
metadata: {}
|
129
|
+
post_install_message: |2
|
130
|
+
|
131
|
+
A ------------------------------------------------------------ A
|
132
|
+
|
133
|
+
* A S S E T I F Y *
|
134
|
+
|
135
|
+
Thank you for installing assetify-2.0.0.
|
136
|
+
|
137
|
+
Here is a few optional gems:
|
150
138
|
|
151
|
-
|
139
|
+
* libarchive - For untar/unzip packages
|
140
|
+
* minimagick - For image transformations
|
141
|
+
* sass - For css2sass support
|
142
|
+
|
143
|
+
|
144
|
+
We hope `assetify` saves you some time!
|
145
|
+
|
146
|
+
A ------------------------------------------------------------ A
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
152
149
|
- lib
|
153
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
-
|
155
|
-
requirements:
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
156
152
|
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
segments_generated: true
|
162
|
-
version: "0"
|
163
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
-
none: false
|
165
|
-
requirements:
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
166
157
|
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
segments:
|
169
|
-
- 1
|
170
|
-
- 3
|
171
|
-
- 6
|
172
|
-
segments_generated: true
|
158
|
+
- !ruby/object:Gem::Version
|
173
159
|
version: 1.3.6
|
174
160
|
requirements: []
|
175
|
-
|
176
161
|
rubyforge_project:
|
177
|
-
rubygems_version:
|
162
|
+
rubygems_version: 2.6.6
|
178
163
|
signing_key:
|
179
|
-
specification_version:
|
164
|
+
specification_version: 4
|
180
165
|
summary: Manage your assets.
|
181
166
|
test_files: []
|
182
|
-
|