strip_comments 0.1.5 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f9e16503c9d04afbbae765175aed88aadf3bfab276d3700c7f7f567f55d0663
4
- data.tar.gz: b6a7531445417be527fbb185688c2bbd29410529e367f45c79f112dcb1b6f8fd
3
+ metadata.gz: 467eeea86bc98782dcb2e27b5da9433d5e2a9f828179ddee79a1109d213b4240
4
+ data.tar.gz: d0a33c9f55e6dda57f77e6d769cec5641880acd8130352664d08b1d6f193a0b7
5
5
  SHA512:
6
- metadata.gz: 57be646f36a83b9fba2d525142da161b6f9db842e561309e75684c07b075c71f0f519f9a43190b71568b06c3c96dfa5686c5faf8a5aa08d285aff765f749cf36
7
- data.tar.gz: 95d0565dfb0867264e7ffc5a5386b7c7f5fe1cc47b237aeadf1fbe8ae33c182b24a10d2b44877066773d2ab1e0c21aee68efedb1f6a230e76c401e49b48ff985
6
+ metadata.gz: bb1e184ae7e6136f6cf2830a3f7b7a207b0bdc957e5d233be1fef64a103d50c1fd9994c8f88666631f7a806a11b10748edf0c722ea9a2da40e482c30d4f64a1c
7
+ data.tar.gz: 661358114b7747313b2d1ddab3f8b73eda96a4d656985467acb39029691ff95a64d2d914d21dd7fbb3a21faabfdf0a60ddcfe6c90dea77fe8dbf2296732989e7
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Uses regular expressions to strip things that look like comments from strings.
4
4
 
5
+ **Supported extensions:** css, glsl, html, properties, yml
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -29,7 +31,15 @@ stripped = StripComments::strip_yaml(input)
29
31
  You can use this to, for example, rewrite all source files in a folder:
30
32
 
31
33
  ```rb
32
- TODO
34
+ require "strip_comments"
35
+
36
+ Dir.glob(File.join(File.dirname(__FILE__), "..", "**", "*.{css,html,yml,properties,glsl}")).each do |filename|
37
+ extension = filename.split(".").last
38
+ input = File.open(filename).read
39
+ output = StripComments::strip(extension, input)
40
+
41
+ File.write(filename, output)
42
+ end
33
43
  ```
34
44
 
35
45
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StripComments
4
- VERSION = "0.1.5"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -47,7 +47,7 @@ module StripComments
47
47
  end
48
48
 
49
49
  def self.strip_properties(str)
50
- str.gsub(/(\n)[\t ]*#[^\n]+/, '\\1')
50
+ str.gsub(/(\n)[\t ]*#[^\n]+/, '\\1').gsub(/^#[^\n]+/, '\\1')
51
51
  end
52
52
 
53
53
  def self.strip_glsl(str)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strip_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jevon Wright
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Uses regular expressions to strip things that look like comments from
14
14
  strings