yass-css 0.3.0 → 0.4.0
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/CHANGELOG.md +5 -1
- data/Cargo.lock +1 -1
- data/README.md +2 -0
- data/RELEASING.md +15 -0
- data/ext/yass/Cargo.toml +1 -1
- data/ext/yass/src/rules/init.rs +1 -0
- data/ext/yass/src/rules/style_rule.rs +28 -5
- data/lib/yass/rules.rb +1 -1
- data/lib/yass/version.rb +1 -1
- data/lib/yass/visitor.rb +1 -0
- 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: 964454f0c8bdcfd25f640bff134b466d111d77762345707e7c75c778a5edf224
|
|
4
|
+
data.tar.gz: be5c8bad69e40f961b554a65bd9faad47bde6c190bbb966ac3d2af8118981341
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90de862ea2b3691488983d8bfe765c40a10df87d3598b336385293e055599558b1fb6d344b90eb70270fcdfa8c6438fee44011e3b60be48ba32ad72350da2fe3
|
|
7
|
+
data.tar.gz: 1a466ea66b1012163c8da76c31b0c46b660ce1f51997af8324dd86c87ce3f1f66220f744fcdd61063a61d950766508f926a4bfbaa7900767ed6649a66f719bb9
|
data/CHANGELOG.md
CHANGED
data/Cargo.lock
CHANGED
data/README.md
CHANGED
data/RELEASING.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Releasing Yass
|
|
2
|
+
|
|
3
|
+
Follow these steps to release a new version of Yass:
|
|
4
|
+
|
|
5
|
+
1. Bump the version in lib/yass/version.rb.
|
|
6
|
+
2. Bump the version in ext/yass/Cargo.toml (should be the same version from step 1).
|
|
7
|
+
3. Add a heading in CHANGELOG.md with the version number and today's date.
|
|
8
|
+
4. Run `bundle install` and `bundle exec rake compile` to refresh the Bundler and Cargo lockfiles.
|
|
9
|
+
5. Commit the results of these changes and push them to GitHub.
|
|
10
|
+
6. Wait for CI to run. This might seem unimportant but weird things can go wrong with lockfiles, etc, so it's best to wait for a clean bill of health before continuing.
|
|
11
|
+
7. Create a release in the GitHub UI [here](https://github.com/camertron/yass/releases/new).
|
|
12
|
+
1. Create a new tag for the release of the form vX.X.X, using the same version number you've been using this whole time.
|
|
13
|
+
2. Name the release the same thing, i.e. vX.X.X.
|
|
14
|
+
3. Copy the relevant section from CHANGELOG.md (including the header) and paste it into the release notes.
|
|
15
|
+
8. This will kick off the GitHub action in .github/workflows/release.yml, build the native extension for all the supported ruby versions and platforms, and publish the various .gem files to rubygems.org.
|
data/ext/yass/Cargo.toml
CHANGED
data/ext/yass/src/rules/init.rs
CHANGED
|
@@ -8,6 +8,7 @@ pub fn init(ruby: &Ruby, yass_module: &RModule) -> Result<(), Error> {
|
|
|
8
8
|
let style_rule_class = yass_module.define_class("StyleRule", rule_class)?;
|
|
9
9
|
style_rule_class.define_method("selectors", method!(YStyleRule::selectors, 0))?;
|
|
10
10
|
style_rule_class.define_method("declarations", method!(YStyleRule::declarations, 0))?;
|
|
11
|
+
style_rule_class.define_method("rules", method!(YStyleRule::rules, 0))?;
|
|
11
12
|
style_rule_class.define_method("source_location", method!(YStyleRule::source_location, 0))?;
|
|
12
13
|
|
|
13
14
|
let media_rule_class = yass_module.define_class("MediaRule", rule_class)?;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
use cssparser::SourceLocation;
|
|
2
2
|
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
3
3
|
use selectors::parser::Selector;
|
|
4
|
-
use style::{properties::PropertyDeclaration, selector_parser::SelectorImpl, servo_arc::Arc, shared_lock::{Locked, SharedRwLock}, stylesheets::StyleRule};
|
|
4
|
+
use style::{properties::PropertyDeclaration, selector_parser::SelectorImpl, servo_arc::Arc, shared_lock::{Locked, SharedRwLock}, stylesheets::{CssRule, StyleRule}};
|
|
5
5
|
|
|
6
|
-
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList, declarations::declaration::YDeclaration, general::YSourceLocation, selectors::YSelector};
|
|
6
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList, declarations::declaration::YDeclaration, general::YSourceLocation, rules::rule::make_rule, selectors::YSelector};
|
|
7
7
|
|
|
8
8
|
#[derive(TypedData)]
|
|
9
9
|
#[magnus(class = "Yass::StyleRule", mark)]
|
|
@@ -12,14 +12,15 @@ pub struct YStyleRule {
|
|
|
12
12
|
lock: SharedRwLock,
|
|
13
13
|
selectors: CachedValueList<Selector<SelectorImpl>>,
|
|
14
14
|
declarations: CachedValueList<PropertyDeclaration>,
|
|
15
|
-
source_location: CachedValue<SourceLocation
|
|
15
|
+
source_location: CachedValue<SourceLocation>,
|
|
16
|
+
rules: CachedValueList<CssRule, SharedRwLock>,
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
impl YStyleRule {
|
|
19
20
|
pub fn new(rule: Arc<Locked<StyleRule>>, lock: SharedRwLock) -> Self {
|
|
20
21
|
YStyleRule {
|
|
21
22
|
rule,
|
|
22
|
-
lock,
|
|
23
|
+
lock: lock.clone(),
|
|
23
24
|
|
|
24
25
|
selectors: CachedValueList::empty(None, |selector, _ctx, ruby| {
|
|
25
26
|
YSelector::new(selector.clone()).into_value_with(ruby)
|
|
@@ -31,7 +32,11 @@ impl YStyleRule {
|
|
|
31
32
|
|
|
32
33
|
source_location: CachedValue::empty(|source_location, ruby| {
|
|
33
34
|
YSourceLocation::new(source_location.line, source_location.column).into_value_with(ruby)
|
|
34
|
-
})
|
|
35
|
+
}),
|
|
36
|
+
|
|
37
|
+
rules: CachedValueList::empty(Some(lock.clone()), |rule, ctx, ruby| {
|
|
38
|
+
make_rule(rule, ctx.as_ref().unwrap(), ruby)
|
|
39
|
+
}),
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -62,6 +67,23 @@ impl YStyleRule {
|
|
|
62
67
|
rb_self.declarations.to_a(ruby)
|
|
63
68
|
}
|
|
64
69
|
|
|
70
|
+
pub fn rules(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
71
|
+
if rb_self.rules.is_empty() {
|
|
72
|
+
let guard = rb_self.lock.read();
|
|
73
|
+
let style_rule = rb_self.rule.read_with(&guard);
|
|
74
|
+
|
|
75
|
+
if let Some(locked_rules) = &style_rule.rules {
|
|
76
|
+
let rules = locked_rules.read_with(&guard);
|
|
77
|
+
|
|
78
|
+
for rule in &rules.0 {
|
|
79
|
+
rb_self.rules.add(rule.clone(), ruby)?;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
rb_self.rules.to_a(ruby)
|
|
85
|
+
}
|
|
86
|
+
|
|
65
87
|
pub fn source_location(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
66
88
|
if rb_self.source_location.is_empty() {
|
|
67
89
|
let guard = rb_self.lock.read();
|
|
@@ -77,6 +99,7 @@ impl DataTypeFunctions for YStyleRule {
|
|
|
77
99
|
fn mark(&self, marker: &gc::Marker) {
|
|
78
100
|
self.selectors.mark(marker);
|
|
79
101
|
self.declarations.mark(marker);
|
|
102
|
+
self.rules.mark(marker);
|
|
80
103
|
self.source_location.mark(marker);
|
|
81
104
|
}
|
|
82
105
|
}
|
data/lib/yass/rules.rb
CHANGED
data/lib/yass/version.rb
CHANGED
data/lib/yass/visitor.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yass-css
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cameron Dutro
|
|
@@ -37,6 +37,7 @@ files:
|
|
|
37
37
|
- Cargo.toml
|
|
38
38
|
- LICENSE.txt
|
|
39
39
|
- README.md
|
|
40
|
+
- RELEASING.md
|
|
40
41
|
- Rakefile
|
|
41
42
|
- codegen/ruby_module_tree.rb
|
|
42
43
|
- codegen/rust_file_set.rb
|