sass-embedded 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/ext/{sass_embedded/.gitignore → .gitignore} +0 -0
- data/ext/Makefile +51 -0
- data/ext/extconf.rb +159 -0
- data/lib/sass/transport.rb +2 -2
- data/lib/sass/version.rb +1 -1
- data/sass-embedded.gemspec +1 -1
- metadata +5 -5
- data/ext/sass_embedded/Makefile +0 -28
- data/ext/sass_embedded/extconf.rb +0 -129
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e345b143aa337d47b0f28d6d58d2a5636f84fb69b4f5ed739b6613ab39327a2d
|
4
|
+
data.tar.gz: 72c0bae0108414a5a989ea6b2f5eac86406eb83faa9c3fa1f1f642e609930afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478a33de83120ace9665efd401d9988a956a291ed19b905f77d129486fd3e796bb90a66d6e3ee4f8f1fde47eddbb285918e84f5d8795d2a9f3546c82c431ef88
|
7
|
+
data.tar.gz: d9512132067039d511bafc684132ae010238b0b7b9ad1c37e3d7c6a4cb6463caa620eed87b05af3fc671c9200246f81af591b82d8c0d01b38429cafb87667394
|
data/Rakefile
CHANGED
@@ -6,9 +6,9 @@ task default: :test
|
|
6
6
|
|
7
7
|
desc 'Download dart-sass-embedded'
|
8
8
|
task :extconf do
|
9
|
-
system('make', '-C', 'ext
|
10
|
-
require_relative 'ext/
|
11
|
-
system('make', '-C', 'ext
|
9
|
+
system('make', '-C', 'ext', 'distclean')
|
10
|
+
require_relative 'ext/extconf'
|
11
|
+
system('make', '-C', 'ext')
|
12
12
|
end
|
13
13
|
|
14
14
|
desc 'Run all tests'
|
File without changes
|
data/ext/Makefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
ifeq ($(OS),Windows_NT)
|
2
|
+
RM = cmd /c del /f /q /s
|
3
|
+
else
|
4
|
+
RM = rm -fr
|
5
|
+
endif
|
6
|
+
EXTCONF = ruby -- extconf.rb --without-sass-embedded --without-sass-embedded-protocol --without-protoc
|
7
|
+
|
8
|
+
.PHONY: all
|
9
|
+
all: sass_embedded embedded_sass_pb.rb
|
10
|
+
|
11
|
+
.PHONY: install
|
12
|
+
install:
|
13
|
+
|
14
|
+
.PHONY: clean
|
15
|
+
clean:
|
16
|
+
$(RM) embedded_sass_pb.rb protoc sass_embedded
|
17
|
+
|
18
|
+
.PHONY: distclean
|
19
|
+
distclean: clean
|
20
|
+
$(RM) embedded_sass.proto protoc-*.zip sass_embedded-*.tar.gz
|
21
|
+
|
22
|
+
ifeq ($(OS),Windows_NT)
|
23
|
+
sass_embedded-*.zip:
|
24
|
+
else
|
25
|
+
sass_embedded-*.tar.gz:
|
26
|
+
endif
|
27
|
+
$(EXTCONF) --with-sass-embedded
|
28
|
+
|
29
|
+
ifeq ($(OS),Windows_NT)
|
30
|
+
sass_embedded: sass_embedded-*.zip
|
31
|
+
powershell -c "Get-Item $< | Expand-Archive -DestinationPath . -Force"
|
32
|
+
else
|
33
|
+
sass_embedded: sass_embedded-*.tar.gz
|
34
|
+
tar -vxzf $<
|
35
|
+
endif
|
36
|
+
|
37
|
+
protoc-*.zip:
|
38
|
+
$(EXTCONF) --with-protoc
|
39
|
+
|
40
|
+
protoc: protoc-*.zip
|
41
|
+
ifeq ($(OS),Windows_NT)
|
42
|
+
powershell -c "Get-Item $< | Expand-Archive -DestinationPath $@ -Force"
|
43
|
+
else
|
44
|
+
unzip -od $@ $<
|
45
|
+
endif
|
46
|
+
|
47
|
+
embedded_sass.proto:
|
48
|
+
$(EXTCONF) --with-sass-embedded-protocol
|
49
|
+
|
50
|
+
%_pb.rb: %.proto protoc
|
51
|
+
./protoc/bin/protoc --ruby_out=. $<
|
data/ext/extconf.rb
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'mkmf'
|
5
|
+
require 'json'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'fileutils'
|
8
|
+
require_relative '../lib/sass/platform'
|
9
|
+
|
10
|
+
module Sass
|
11
|
+
class Extconf
|
12
|
+
def initialize
|
13
|
+
get_with_config('sass-embedded', true) { latest_sass_embedded }
|
14
|
+
get_with_config('sass-embedded-protocol', true) { latest_sass_embedded_protocol }
|
15
|
+
get_with_config('protoc', true) { latest_protoc }
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_with_config(config, default)
|
21
|
+
val = with_config(config, default)
|
22
|
+
case val
|
23
|
+
when true
|
24
|
+
if block_given?
|
25
|
+
get yield
|
26
|
+
else
|
27
|
+
get default
|
28
|
+
end
|
29
|
+
when false
|
30
|
+
nil
|
31
|
+
else
|
32
|
+
get val
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get(uri_s)
|
37
|
+
uri = URI.parse(uri_s)
|
38
|
+
path = File.absolute_path(File.basename(uri.path), __dir__)
|
39
|
+
if uri.is_a?(URI::File) || uri.instance_of?(URI::Generic)
|
40
|
+
FileUtils.copy_file uri.path, path
|
41
|
+
elsif uri.respond_to? :open
|
42
|
+
uri.open do |source|
|
43
|
+
File.open(path, 'wb') do |destination|
|
44
|
+
destination.write source.read
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
raise
|
49
|
+
end
|
50
|
+
rescue StandardError
|
51
|
+
raise "Failed to get: #{uri}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def latest_release(repo, prerelease: false)
|
55
|
+
if prerelease
|
56
|
+
headers = {}
|
57
|
+
headers['Authorization'] = "token #{ENV['GITHUB_TOKEN']}" if ENV['GITHUB_TOKEN']
|
58
|
+
URI.parse("https://api.github.com/repos/#{repo}/releases").open(headers) do |file|
|
59
|
+
JSON.parse(file.read)[0]['tag_name']
|
60
|
+
end
|
61
|
+
else
|
62
|
+
URI.parse("https://github.com/#{repo}/releases/latest").open do |file|
|
63
|
+
File.basename file.base_uri.to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def latest_sass_embedded
|
69
|
+
repo = 'sass/dart-sass-embedded'
|
70
|
+
|
71
|
+
# TODO, don't use prerelease once a release is available
|
72
|
+
tag_name = latest_release repo, prerelease: true
|
73
|
+
|
74
|
+
os = case Sass::Platform::OS
|
75
|
+
when 'darwin'
|
76
|
+
'macos'
|
77
|
+
when 'linux'
|
78
|
+
'linux'
|
79
|
+
when 'windows'
|
80
|
+
'windows'
|
81
|
+
else
|
82
|
+
raise "Unsupported OS: #{Sass::Platform::OS}"
|
83
|
+
end
|
84
|
+
|
85
|
+
arch = case Sass::Platform::ARCH
|
86
|
+
when 'x86_64'
|
87
|
+
'x64'
|
88
|
+
when 'i386'
|
89
|
+
'ia32'
|
90
|
+
else
|
91
|
+
raise "Unsupported Arch: #{Sass::Platform::ARCH}"
|
92
|
+
end
|
93
|
+
|
94
|
+
ext = case os
|
95
|
+
when 'windows'
|
96
|
+
'zip'
|
97
|
+
else
|
98
|
+
'tar.gz'
|
99
|
+
end
|
100
|
+
|
101
|
+
"https://github.com/#{repo}/releases/download/#{tag_name}/sass_embedded-#{tag_name}-#{os}-#{arch}.#{ext}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def latest_protoc
|
105
|
+
repo = 'protocolbuffers/protobuf'
|
106
|
+
|
107
|
+
tag_name = latest_release repo
|
108
|
+
|
109
|
+
os = case Sass::Platform::OS
|
110
|
+
when 'darwin'
|
111
|
+
'osx'
|
112
|
+
when 'linux'
|
113
|
+
'linux'
|
114
|
+
when 'windows'
|
115
|
+
'win'
|
116
|
+
else
|
117
|
+
raise "Unsupported OS: #{Sass::Platform::OS}"
|
118
|
+
end
|
119
|
+
|
120
|
+
arch = case Sass::Platform::ARCH
|
121
|
+
when 'aarch64'
|
122
|
+
'aarch_64'
|
123
|
+
when 'sparcv9'
|
124
|
+
's390'
|
125
|
+
when 'i386'
|
126
|
+
'x86_32'
|
127
|
+
when 'x86_64'
|
128
|
+
'x86_64'
|
129
|
+
when 'powerpc64'
|
130
|
+
'ppcle_64'
|
131
|
+
else
|
132
|
+
raise "Unsupported Arch: #{Sass::Platform::ARCH}"
|
133
|
+
end
|
134
|
+
|
135
|
+
os_arch = case os
|
136
|
+
when 'win'
|
137
|
+
os + arch.split('_').last
|
138
|
+
else
|
139
|
+
"#{os}-#{arch}"
|
140
|
+
end
|
141
|
+
|
142
|
+
ext = 'zip'
|
143
|
+
|
144
|
+
"https://github.com/#{repo}/releases/download/#{tag_name}/protoc-#{tag_name[1..-1]}-#{os_arch}.#{ext}"
|
145
|
+
end
|
146
|
+
|
147
|
+
def latest_sass_embedded_protocol
|
148
|
+
repo = 'sass/embedded-protocol'
|
149
|
+
|
150
|
+
# TODO: use latest release once available
|
151
|
+
# tag_name = latest_release repo
|
152
|
+
tag_name = 'HEAD'
|
153
|
+
|
154
|
+
"https://raw.githubusercontent.com/#{repo}/#{tag_name}/embedded_sass.proto"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
Sass::Extconf.new
|
data/lib/sass/transport.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
require 'open3'
|
4
4
|
require 'observer'
|
5
|
-
require_relative '../../ext/
|
5
|
+
require_relative '../../ext/embedded_sass_pb'
|
6
6
|
|
7
7
|
module Sass
|
8
8
|
class Transport
|
9
9
|
include Observable
|
10
10
|
|
11
11
|
DART_SASS_EMBEDDED = File.absolute_path(
|
12
|
-
"../../ext/sass_embedded/
|
12
|
+
"../../ext/sass_embedded/dart-sass-embedded#{Sass::Platform::OS == 'windows' ? '.bat' : ''}", __dir__
|
13
13
|
)
|
14
14
|
|
15
15
|
PROTOCOL_ERROR_ID = 4_294_967_295
|
data/lib/sass/version.rb
CHANGED
data/sass-embedded.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.extensions = ['ext/
|
18
|
+
spec.extensions = ['ext/extconf.rb']
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
@@ -113,7 +113,7 @@ email:
|
|
113
113
|
- i@ntk.me
|
114
114
|
executables: []
|
115
115
|
extensions:
|
116
|
-
- ext/
|
116
|
+
- ext/extconf.rb
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- ".github/workflows/build.yml"
|
@@ -122,9 +122,9 @@ files:
|
|
122
122
|
- LICENSE
|
123
123
|
- README.md
|
124
124
|
- Rakefile
|
125
|
-
- ext
|
126
|
-
- ext/
|
127
|
-
- ext/
|
125
|
+
- ext/.gitignore
|
126
|
+
- ext/Makefile
|
127
|
+
- ext/extconf.rb
|
128
128
|
- lib/sass.rb
|
129
129
|
- lib/sass/embedded.rb
|
130
130
|
- lib/sass/error.rb
|
data/ext/sass_embedded/Makefile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
ifeq ($(OS),Windows_NT)
|
2
|
-
RM = cmd /c del /f /q /s
|
3
|
-
else
|
4
|
-
RM = rm -fr
|
5
|
-
endif
|
6
|
-
|
7
|
-
.PHONY: all
|
8
|
-
all:
|
9
|
-
|
10
|
-
.PHONY: install
|
11
|
-
install:
|
12
|
-
ifeq ($(OS),Windows_NT)
|
13
|
-
powershell -Command "Get-Item sass_embedded-*.zip | Expand-Archive -DestinationPath . -Force"
|
14
|
-
powershell -Command "Get-Item protoc-*.zip | Expand-Archive -DestinationPath protoc -Force"
|
15
|
-
./protoc/bin/protoc --ruby_out=. embedded_sass.proto
|
16
|
-
else
|
17
|
-
tar -vxzf sass_embedded-*.tar.gz
|
18
|
-
unzip -od protoc protoc-*.zip
|
19
|
-
./protoc/bin/protoc --ruby_out=. embedded_sass.proto
|
20
|
-
endif
|
21
|
-
|
22
|
-
.PHONY: clean
|
23
|
-
clean:
|
24
|
-
$(RM) embedded_sass_pb.rb protoc sass_embedded
|
25
|
-
|
26
|
-
.PHONY: distclean
|
27
|
-
distclean: clean
|
28
|
-
$(RM) embedded_sass.proto protoc-*.zip sass_embedded-*.tar.gz
|
@@ -1,129 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'json'
|
5
|
-
require 'open-uri'
|
6
|
-
require_relative '../../lib/sass/platform'
|
7
|
-
|
8
|
-
module Sass
|
9
|
-
class Extconf
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
download_sass_embedded
|
13
|
-
download_protoc
|
14
|
-
download_embedded_sass_proto
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def api(url)
|
20
|
-
headers = {}
|
21
|
-
headers['Authorization'] = "token #{ENV['GITHUB_TOKEN']}" if ENV['GITHUB_TOKEN']
|
22
|
-
URI.parse(url).open(headers) do |file|
|
23
|
-
JSON.parse file.read
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def download(url)
|
28
|
-
URI.parse(url).open do |source|
|
29
|
-
File.open(File.absolute_path(File.basename(url), __dir__), 'wb') do |destination|
|
30
|
-
destination.write source.read
|
31
|
-
end
|
32
|
-
end
|
33
|
-
rescue StandardError
|
34
|
-
raise "Failed to download: #{url}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def download_sass_embedded
|
38
|
-
repo = 'sass/dart-sass-embedded'
|
39
|
-
|
40
|
-
release = api("https://api.github.com/repos/#{repo}/releases")[0]['tag_name']
|
41
|
-
|
42
|
-
os = case Sass::Platform::OS
|
43
|
-
when 'darwin'
|
44
|
-
'macos'
|
45
|
-
when 'linux'
|
46
|
-
'linux'
|
47
|
-
when 'windows'
|
48
|
-
'windows'
|
49
|
-
else
|
50
|
-
raise "Unsupported OS: #{Sass::Platform::OS}"
|
51
|
-
end
|
52
|
-
|
53
|
-
arch = case Sass::Platform::ARCH
|
54
|
-
when 'x86_64'
|
55
|
-
'x64'
|
56
|
-
when 'i386'
|
57
|
-
'ia32'
|
58
|
-
else
|
59
|
-
raise "Unsupported Arch: #{Sass::Platform::ARCH}"
|
60
|
-
end
|
61
|
-
|
62
|
-
ext = case os
|
63
|
-
when 'windows'
|
64
|
-
'zip'
|
65
|
-
else
|
66
|
-
'tar.gz'
|
67
|
-
end
|
68
|
-
|
69
|
-
url = "https://github.com/#{repo}/releases/download/#{release}/sass_embedded-#{release}-#{os}-#{arch}.#{ext}"
|
70
|
-
download url
|
71
|
-
end
|
72
|
-
|
73
|
-
def download_protoc
|
74
|
-
repo = 'protocolbuffers/protobuf'
|
75
|
-
|
76
|
-
tag = URI.parse("https://github.com/#{repo}/releases/latest").open do |file|
|
77
|
-
File.basename file.base_uri.to_s
|
78
|
-
end
|
79
|
-
|
80
|
-
release = tag[1..-1]
|
81
|
-
|
82
|
-
os = case Sass::Platform::OS
|
83
|
-
when 'darwin'
|
84
|
-
'osx'
|
85
|
-
when 'linux'
|
86
|
-
'linux'
|
87
|
-
when 'windows'
|
88
|
-
'win'
|
89
|
-
else
|
90
|
-
raise "Unsupported OS: #{Sass::Platform::OS}"
|
91
|
-
end
|
92
|
-
|
93
|
-
arch = case Sass::Platform::ARCH
|
94
|
-
when 'aarch64'
|
95
|
-
'aarch_64'
|
96
|
-
when 'sparcv9'
|
97
|
-
's390'
|
98
|
-
when 'i386'
|
99
|
-
'x86_32'
|
100
|
-
when 'x86_64'
|
101
|
-
'x86_64'
|
102
|
-
when 'powerpc64'
|
103
|
-
'ppcle_64'
|
104
|
-
else
|
105
|
-
raise "Unsupported Arch: #{Sass::Platform::ARCH}"
|
106
|
-
end
|
107
|
-
|
108
|
-
os_arch = case os
|
109
|
-
when 'win'
|
110
|
-
os + arch.split('_').last
|
111
|
-
else
|
112
|
-
"#{os}-#{arch}"
|
113
|
-
end
|
114
|
-
|
115
|
-
ext = 'zip'
|
116
|
-
|
117
|
-
url = "https://github.com/#{repo}/releases/download/#{tag}/protoc-#{release}-#{os_arch}.#{ext}"
|
118
|
-
download url
|
119
|
-
end
|
120
|
-
|
121
|
-
def download_embedded_sass_proto
|
122
|
-
url = 'https://raw.githubusercontent.com/sass/embedded-protocol/HEAD/embedded_sass.proto'
|
123
|
-
download url
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
Sass::Extconf.new
|