rainpress 1.0 → 1.0.1
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 +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/NEWS.md +9 -0
- data/README.md +47 -0
- data/Rakefile +6 -16
- data/lib/rainpress.rb +36 -52
- data/lib/rainpress/version.rb +3 -0
- data/rainpress.gemspec +15 -30
- data/spec/rainpress_spec.rb +3 -7
- metadata +50 -69
- data/CHANGELOG +0 -1
- data/Manifest +0 -11
- data/README.rdoc +0 -52
- data/lib/autotest/discover.rb +0 -1
- data/lib/autotest/spec.rb +0 -60
- data/spec/build_safe.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 856f9bd8013d0fcda82f0b0b15e9ea12b357a2b7
|
4
|
+
data.tar.gz: 50255e841952d798ab0c3d50bbb12cfc0f5ad3d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 225d2c42c001b63ab899044f3919a5061cc5fe116064ac48647681851028d70030a80d1d537ce6864222c73ce874e9abcd75924b62b422c72057116d1937257b
|
7
|
+
data.tar.gz: bed95a7cc99c4827c23972854e0a10fce10ccc59088a92eff43238861a713ea1401496436cc0d0fac2fb4ff5d9bc32aa8748b9487e8fb12d84190f57e89ad529
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rainpress (1.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.10.1)
|
10
|
+
rake (12.0.0)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 1.14)
|
17
|
+
minitest
|
18
|
+
rainpress!
|
19
|
+
rake
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
1.14.5
|
data/NEWS.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
[](http://rubygems.org/gems/rainpress)
|
2
|
+
[](https://travis-ci.org/ddfreyne/rainpress)
|
3
|
+
|
4
|
+
# Rainpress
|
5
|
+
|
6
|
+
Rainpress is a compressor for CSS, written in Ruby. It removes unnecessary characters and replaces some attributes with a shorter equivalent name.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'rainpress'
|
12
|
+
compressed_style_text = Rainpress.compress(style_text)
|
13
|
+
```
|
14
|
+
|
15
|
+
Options:
|
16
|
+
|
17
|
+
* `:comments` — if set to false, comments will not be removed
|
18
|
+
* `:newlines` — if set to false, newlines will not be removed
|
19
|
+
* `:spaces` — if set to false, spaces will not be removed
|
20
|
+
* `:colors` — if set to false, colors will not be modified
|
21
|
+
* `:misc` — if set to false, miscellaneous compression parts will be skipped
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
Copyright (c) 2007–2008 Uwe L. Korn
|
26
|
+
|
27
|
+
Copyright (c) 20xx Jeff Smick
|
28
|
+
|
29
|
+
Copyright (c) 2017–… Denis Defreyne
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
33
|
+
in the Software without restriction, including without limitation the rights
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
36
|
+
furnished to do so, subject to the following conditions:
|
37
|
+
|
38
|
+
The above copyright notice and this permission notice shall be included in
|
39
|
+
all copies or substantial portions of the Software.
|
40
|
+
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
47
|
+
THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,18 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'hanna/rdoctask'
|
1
|
+
require 'rake/testtask'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
p.url = 'http://github.com/sprsquish/rainpress/tree/master'
|
8
|
-
|
9
|
-
p.project = 'squishtech'
|
10
|
-
p.summary = 'A CSS compressor'
|
11
|
-
|
12
|
-
p.rdoc_options += %w[-S -T hanna --main README.rdoc --exclude autotest]
|
13
|
-
|
14
|
-
p.test_pattern = 'spec/*_spec.rb'
|
15
|
-
p.rcov_options = ['--exclude \/Library\/Ruby\/Gems,spec\/', '--xrefs']
|
16
|
-
|
17
|
-
p.retain_gemspec = true
|
3
|
+
Rake::TestTask.new do |t|
|
4
|
+
t.test_files = Dir['spec/**/*_spec.rb']
|
5
|
+
t.libs << 'spec'
|
18
6
|
end
|
7
|
+
|
8
|
+
task default: :test
|
data/lib/rainpress.rb
CHANGED
@@ -1,20 +1,4 @@
|
|
1
|
-
# == Information
|
2
|
-
#
|
3
|
-
# This is the main class of Rainpress, create an instance of it to compress
|
4
|
-
# your CSS-styles.
|
5
|
-
#
|
6
|
-
# Author:: Uwe L. Korn <uwelk@xhochy.org>
|
7
|
-
#
|
8
|
-
# <b>Options:</b>
|
9
|
-
#
|
10
|
-
# * <tt>:comments</tt> - if set to false, comments will not be removed
|
11
|
-
# * <tt>:newlines</tt> - if set to false, newlines will not be removed
|
12
|
-
# * <tt>:spaces</tt> - if set to false, spaces will not be removed
|
13
|
-
# * <tt>:colors</tt> - if set to false, colors will not be modified
|
14
|
-
# * <tt>:misc</tt> - if set to false, miscellaneous compression parts will be skipped
|
15
1
|
class Rainpress
|
16
|
-
# Quick-compress the styles.
|
17
|
-
# This eliminates the need to create an instance of the class
|
18
2
|
def self.compress(style, options = {})
|
19
3
|
self.new(style, options).compress!
|
20
4
|
end
|
@@ -47,7 +31,7 @@ class Rainpress
|
|
47
31
|
# Attention: If you are doing css hacks for IE using the comment tricks,
|
48
32
|
# they will be removed using this function. Please consider for IE css style
|
49
33
|
# corrections the usage of conditionals comments in your (X)HTML document.
|
50
|
-
|
34
|
+
def remove_comments!
|
51
35
|
input = @style
|
52
36
|
@style = ''
|
53
37
|
|
@@ -66,37 +50,37 @@ class Rainpress
|
|
66
50
|
input = input[(pos+2)..-1]
|
67
51
|
end
|
68
52
|
end
|
69
|
-
|
53
|
+
end
|
70
54
|
|
71
55
|
# Remove all newline characters
|
72
56
|
#
|
73
57
|
# We take care of Windows(\r\n), Unix(\n) and Mac(\r) newlines.
|
74
|
-
|
75
|
-
|
76
|
-
|
58
|
+
def remove_newlines!
|
59
|
+
@style.gsub!(/\n|\r/, '')
|
60
|
+
end
|
77
61
|
|
78
|
-
|
79
|
-
|
62
|
+
# Remove unneeded spaces
|
63
|
+
#
|
80
64
|
# 1. Turn mutiple spaces into a single
|
81
65
|
# 2. Remove spaces around ;:{},
|
82
66
|
# 3. Remove tabs
|
83
67
|
def remove_spaces!
|
84
|
-
@style.gsub!
|
68
|
+
@style.gsub!(/\s*(\s|;|:|\}|\{|,)\s*/, '\1')
|
85
69
|
@style.gsub! "\t", ''
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
70
|
+
end
|
71
|
+
|
72
|
+
# Replace color values with their shorter equivalent
|
73
|
+
#
|
74
|
+
# 1. Turn rgb(,,)-colors into #-values
|
75
|
+
# 2. Shorten #AABBCC down to #ABC
|
76
|
+
# 3. Replace names with their shorter hex-equivalent
|
77
|
+
# * white -> #fff
|
94
78
|
# * black -> #000
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
@style.gsub!
|
79
|
+
# 4. Replace #-values with their shorter name
|
80
|
+
# * #f00 -> red
|
81
|
+
def shorten_colors!
|
82
|
+
# rgb(50,101,152) to #326598
|
83
|
+
@style.gsub!(/rgb\s*\(\s*([0-9,\s]+)\s*\)/) do |match|
|
100
84
|
out = '#'
|
101
85
|
$1.split(',').each do |num|
|
102
86
|
out += '0' if num.to_i < 16
|
@@ -105,7 +89,7 @@ class Rainpress
|
|
105
89
|
out
|
106
90
|
end
|
107
91
|
# Convert #AABBCC to #ABC, keep if preceed by a '='
|
108
|
-
@style.gsub!
|
92
|
+
@style.gsub!(/([^\"'=\s])(\s*)#([\da-f])\3([\da-f])\4([\da-f])\5/i, '\1#\3\4\5')
|
109
93
|
|
110
94
|
# At the moment we assume that colours only appear before ';' or '}' and
|
111
95
|
# after a ':', if there could be an occurence of a color before or after
|
@@ -114,55 +98,55 @@ class Rainpress
|
|
114
98
|
|
115
99
|
# shorten several names to numbers
|
116
100
|
## shorten white -> #fff
|
117
|
-
@style.gsub!
|
101
|
+
@style.gsub!(/:\s*white\s*(;|\})/, ':#fff\1')
|
118
102
|
|
119
103
|
## shorten black -> #000
|
120
|
-
@style.gsub!
|
104
|
+
@style.gsub!(/:\s*black\s*(;|\})/, ':#000\1')
|
121
105
|
|
122
106
|
# shotern several numbers to names
|
123
107
|
## shorten #f00 or #ff0000 -> red
|
124
|
-
@style.gsub!
|
108
|
+
@style.gsub!(/:\s*#f{1,2}0{2,4}(;|\})/i, ':red\1')
|
125
109
|
end
|
126
110
|
|
127
111
|
# Do miscellaneous compression methods on the style.
|
128
112
|
def do_misc!
|
129
113
|
# Replace 0(pt,px,em,%) with 0 but only when preceded by : or a white-space
|
130
|
-
@style.gsub!
|
114
|
+
@style.gsub!(/([\s:]+)(0)(px|em|%|in|cm|mm|pc|pt|ex)/i, '\1\2')
|
131
115
|
|
132
116
|
# Replace :0 0 0 0(;|}) with :0(;|})
|
133
|
-
@style.gsub!
|
117
|
+
@style.gsub!(/:0 0 0 0(;|\})/, ':0\1')
|
134
118
|
|
135
119
|
# Replace :0 0 0(;|}) with :0(;|})
|
136
|
-
@style.gsub!
|
120
|
+
@style.gsub!(/:0 0 0(;|\})/, ':0\1')
|
137
121
|
|
138
122
|
# Replace :0 0(;|}) with :0(;|})
|
139
|
-
@style.gsub!
|
123
|
+
@style.gsub!(/:0 0(;|\})/, ':0\1')
|
140
124
|
|
141
125
|
# Replace background-position:0; with background-position:0 0;
|
142
126
|
@style.gsub! 'background-position:0;', 'background-position:0 0;'
|
143
127
|
|
144
128
|
# Replace 0.6 to .6, but only when preceded by : or a white-space
|
145
|
-
@style.gsub!
|
129
|
+
@style.gsub!(/[:\s]0+\.(\d+)/) do |match|
|
146
130
|
match.sub '0', '' # only first '0' !!
|
147
131
|
end
|
148
132
|
|
149
133
|
# Replace multiple ';' with a single ';'
|
150
|
-
@style.gsub!
|
134
|
+
@style.gsub!(/[;]+/, ';')
|
151
135
|
|
152
136
|
# Replace ;} with }
|
153
137
|
@style.gsub! ';}', '}'
|
154
138
|
|
155
139
|
# Replace font-weight:normal; with 400
|
156
|
-
@style.gsub!
|
157
|
-
@style.gsub!
|
140
|
+
@style.gsub!(/font-weight[\s]*:[\s]*normal[\s]*(;|\})/i,'font-weight:400\1')
|
141
|
+
@style.gsub!(/font[\s]*:[\s]*normal[\s;\}]*/) do |match|
|
158
142
|
match.sub 'normal', '400'
|
159
143
|
end
|
160
144
|
|
161
145
|
# Replace font-weight:bold; with 700
|
162
|
-
@style.gsub!
|
163
|
-
@style.gsub!
|
146
|
+
@style.gsub!(/font-weight[\s]*:[\s]*bold[\s]*(;|\})/,'font-weight:700\1')
|
147
|
+
@style.gsub!(/font[\s]*:[\s]*bold[\s;\}]*/) do |match|
|
164
148
|
match.sub 'bold', '700'
|
165
149
|
end
|
166
150
|
end
|
167
151
|
|
168
|
-
end
|
152
|
+
end
|
data/rainpress.gemspec
CHANGED
@@ -1,37 +1,22 @@
|
|
1
|
-
|
1
|
+
require_relative 'lib/rainpress/version'
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.
|
4
|
+
s.name = 'rainpress'
|
5
|
+
s.description = 'A CSS compressor'
|
6
|
+
s.summary = 'A CSS compressor'
|
7
|
+
s.version = Rainpress::VERSION
|
8
|
+
s.authors = ['Uwe L. Korn', 'Jeff Smick', 'Denis Defreyne']
|
9
|
+
s.email = 'denis@stoneship.org'
|
10
|
+
s.homepage = 'https://github.com/ddfreyne/rainpress'
|
11
|
+
s.license = 'MIT'
|
6
12
|
|
7
|
-
s.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
s.description = %q{A CSS compressor}
|
12
|
-
s.email = %q{sprsquish@gmail.com}
|
13
|
+
s.files =
|
14
|
+
Dir['[A-Z]*'] +
|
15
|
+
Dir['{bin,lib,spec}/**/*'] +
|
16
|
+
Dir['*.gemspec']
|
13
17
|
s.executables = ["csspress"]
|
14
|
-
s.
|
15
|
-
s.files = ["bin/csspress", "CHANGELOG", "lib/autotest/discover.rb", "lib/autotest/spec.rb", "lib/rainpress.rb", "Manifest", "rainpress.gemspec", "Rakefile", "README.rdoc", "spec/build_safe.rb", "spec/rainpress_spec.rb"]
|
16
|
-
s.has_rdoc = true
|
17
|
-
s.homepage = %q{http://github.com/sprsquish/rainpress/tree/master}
|
18
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rainpress", "--main", "README.rdoc", "-S", "-T", "hanna", "--main", "README.rdoc", "--exclude", "autotest"]
|
18
|
+
s.default_executable = %q{csspress}
|
19
19
|
s.require_paths = ["lib"]
|
20
|
-
s.rubyforge_project = %q{squishtech}
|
21
|
-
s.rubygems_version = %q{1.3.1}
|
22
|
-
s.summary = %q{A CSS compressor}
|
23
|
-
s.test_files = ["spec/rainpress_spec.rb"]
|
24
|
-
|
25
|
-
if s.respond_to? :specification_version then
|
26
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
-
s.specification_version = 2
|
28
20
|
|
29
|
-
|
30
|
-
s.add_development_dependency(%q<echoe>, [">= 0"])
|
31
|
-
else
|
32
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
33
|
-
end
|
34
|
-
else
|
35
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
36
|
-
end
|
21
|
+
s.add_development_dependency('bundler', '~> 1.14')
|
37
22
|
end
|
data/spec/rainpress_spec.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), *%w[.. lib rainpress])
|
4
|
-
require 'rubygems'
|
1
|
+
require 'rainpress'
|
2
|
+
require 'minitest'
|
5
3
|
require 'minitest/spec'
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
Unit.autorun
|
5
|
+
Minitest.autorun
|
10
6
|
|
11
7
|
describe 'Rainpress module' do
|
12
8
|
it 'removes comments' do
|
metadata
CHANGED
@@ -1,89 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainpress
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
- Uwe L. Korn
|
6
|
+
authors:
|
7
|
+
- Uwe L. Korn
|
8
|
+
- Jeff Smick
|
9
|
+
- Denis Defreyne
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
date: 2017-03-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.14'
|
17
22
|
type: :development
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
version:
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.14'
|
25
29
|
description: A CSS compressor
|
26
|
-
email:
|
27
|
-
executables:
|
30
|
+
email: denis@stoneship.org
|
31
|
+
executables:
|
28
32
|
- csspress
|
29
33
|
extensions: []
|
30
|
-
|
31
|
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
- README.rdoc
|
38
|
-
files:
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- NEWS.md
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
39
41
|
- bin/csspress
|
40
|
-
- CHANGELOG
|
41
|
-
- lib/autotest/discover.rb
|
42
|
-
- lib/autotest/spec.rb
|
43
42
|
- lib/rainpress.rb
|
44
|
-
-
|
43
|
+
- lib/rainpress/version.rb
|
45
44
|
- rainpress.gemspec
|
46
|
-
- Rakefile
|
47
|
-
- README.rdoc
|
48
|
-
- spec/build_safe.rb
|
49
45
|
- spec/rainpress_spec.rb
|
50
|
-
|
51
|
-
|
46
|
+
homepage: https://github.com/ddfreyne/rainpress
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
52
50
|
post_install_message:
|
53
|
-
rdoc_options:
|
54
|
-
|
55
|
-
- --inline-source
|
56
|
-
- --title
|
57
|
-
- Rainpress
|
58
|
-
- --main
|
59
|
-
- README.rdoc
|
60
|
-
- -S
|
61
|
-
- -T
|
62
|
-
- hanna
|
63
|
-
- --main
|
64
|
-
- README.rdoc
|
65
|
-
- --exclude
|
66
|
-
- autotest
|
67
|
-
require_paths:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
68
53
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
71
56
|
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version:
|
74
|
-
|
75
|
-
|
76
|
-
requirements:
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
77
61
|
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
version:
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
81
64
|
requirements: []
|
82
|
-
|
83
|
-
|
84
|
-
rubygems_version: 1.3.1
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.6.10
|
85
67
|
signing_key:
|
86
|
-
specification_version:
|
68
|
+
specification_version: 4
|
87
69
|
summary: A CSS compressor
|
88
|
-
test_files:
|
89
|
-
- spec/rainpress_spec.rb
|
70
|
+
test_files: []
|
data/CHANGELOG
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
v1.0 Initial release
|
data/Manifest
DELETED
data/README.rdoc
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
== About
|
2
|
-
|
3
|
-
Rainpress is a compressor for CSS. It's written in ruby, but should not be
|
4
|
-
limited to ruby projects.
|
5
|
-
|
6
|
-
Rainpress does not apply common compression algorithms like gzip, it removes
|
7
|
-
unnecessary characters and replaces some attributes with a shorter equivalent
|
8
|
-
name.
|
9
|
-
|
10
|
-
== Simple Usage
|
11
|
-
|
12
|
-
require 'rubygems'
|
13
|
-
require 'rainpress'
|
14
|
-
compressed_style_text = Rainpress.compress style_text
|
15
|
-
|
16
|
-
== License
|
17
|
-
|
18
|
-
Copyright (c) 2007-2008 Uwe L. Korn
|
19
|
-
|
20
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
21
|
-
of this software and associated documentation files (the "Software"), to deal
|
22
|
-
in the Software without restriction, including without limitation the rights
|
23
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
24
|
-
copies of the Software, and to permit persons to whom the Software is
|
25
|
-
furnished to do so, subject to the following conditions:
|
26
|
-
|
27
|
-
The above copyright notice and this permission notice shall be included in
|
28
|
-
all copies or substantial portions of the Software.
|
29
|
-
|
30
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
31
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
32
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
33
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
34
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
35
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
36
|
-
THE SOFTWARE.
|
37
|
-
|
38
|
-
Remark(not part of the license text): This is a MIT-style license
|
39
|
-
|
40
|
-
== Links
|
41
|
-
|
42
|
-
* {Rainpress Website}[http://rainpress.xhochy.com/]
|
43
|
-
* {SVN repository}[http://code.google.com/p/rainpress/source]
|
44
|
-
* {Bugtracker}[https://bugs.launchpad.net/rainpress/]
|
45
|
-
* {Wiki}[http://code.google.com/p/rainpress/w/list]
|
46
|
-
* {Translations}[https://translations.launchpad.net/rainpress/]
|
47
|
-
* {XhochY Weblog (for Announcements about Rainpress)}[http://xhochy.org/en/]
|
48
|
-
* {Mailinglist}[http://groups.google.com/group/xy-oss-projects-discussion]
|
49
|
-
* {Continous Integration Builds and Tests}[http://cruisecontrol-rb.xhochy.com/builds/rainpress]
|
50
|
-
* {Freshmeat Record}[http://freshmeat.net/projects/rainpress]
|
51
|
-
* {Ohloh listing}[http://www.ohloh.net/projects/12620/]
|
52
|
-
* {GitHub}[http://github.com/sprsquish/rainpress/tree/master]
|
data/lib/autotest/discover.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Autotest.add_discovery { 'spec' if File.directory?('spec') && ENV['MINISPEC'] }
|
data/lib/autotest/spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'autotest'
|
2
|
-
|
3
|
-
Autotest.add_hook :initialize do |at|
|
4
|
-
at.clear_mappings
|
5
|
-
# watch out: Ruby bug (1.8.6):
|
6
|
-
# %r(/) != /\//
|
7
|
-
at.add_mapping(%r%^spec/.*_spec.rb$%) { |filename, _|
|
8
|
-
filename
|
9
|
-
}
|
10
|
-
at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
|
11
|
-
["spec/#{m[1]}_spec.rb"]
|
12
|
-
}
|
13
|
-
at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
|
14
|
-
at.files_matching %r%^spec/.*_spec\.rb$%
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
BAR = "=" * 78
|
19
|
-
REDCODE = 31
|
20
|
-
GREENCODE = 32
|
21
|
-
|
22
|
-
Autotest.add_hook :ran_command do |at|
|
23
|
-
at.results.last =~ /^.* (\d+) failures, (\d+) errors/
|
24
|
-
|
25
|
-
code = ($1 == "0" and $2 == "0") ? GREENCODE : REDCODE
|
26
|
-
puts "\e[#{ code }m#{ BAR }\e[0m\n\n"
|
27
|
-
end
|
28
|
-
|
29
|
-
class Autotest::Spec < Autotest
|
30
|
-
def path_to_classname(s)
|
31
|
-
sep = File::SEPARATOR
|
32
|
-
f = s.sub(/spec#{sep}/, '').sub(/(spec)?\.rb$/, '').split(sep)
|
33
|
-
f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
|
34
|
-
f = f.delete_if { |path| path == 'Core' }
|
35
|
-
f.join
|
36
|
-
end
|
37
|
-
|
38
|
-
##
|
39
|
-
# Returns a hash mapping a file name to the known failures for that
|
40
|
-
# file.
|
41
|
-
|
42
|
-
def consolidate_failures(failed)
|
43
|
-
filters = new_hash_of_arrays
|
44
|
-
|
45
|
-
class_map = Hash[*self.find_order.grep(/^spec/).map { |f| # TODO: ugly
|
46
|
-
[path_to_classname(f), f]
|
47
|
-
}.flatten]
|
48
|
-
class_map.merge!(self.extra_class_map)
|
49
|
-
|
50
|
-
failed.each do |method, klass|
|
51
|
-
if class_map.has_key? klass then
|
52
|
-
filters[class_map[klass]] << method
|
53
|
-
else
|
54
|
-
output.puts "Unable to map class #{klass} to a file"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
return filters
|
59
|
-
end
|
60
|
-
end
|
data/spec/build_safe.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
if ARGV.size < 1
|
5
|
-
puts "Usage: build_save.rb my-project.gemspec"
|
6
|
-
exit
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'rubygems/specification'
|
10
|
-
data = File.read(ARGV[0])
|
11
|
-
spec = nil
|
12
|
-
|
13
|
-
if data !~ %r{!ruby/object:Gem::Specification}
|
14
|
-
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
15
|
-
else
|
16
|
-
spec = YAML.load(data)
|
17
|
-
end
|
18
|
-
|
19
|
-
puts spec
|
20
|
-
puts "OK"
|