compressit 1.0.3 → 1.0.4
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.
- data/lib/compressit.rb +27 -31
- data/lib/compressit/version.rb +1 -1
- metadata +3 -3
data/lib/compressit.rb
CHANGED
@@ -6,43 +6,39 @@ module Compressit
|
|
6
6
|
class << self
|
7
7
|
|
8
8
|
def run(arguments)
|
9
|
-
|
10
|
-
|
11
|
-
optparser = OptionParser.new do|opts|
|
9
|
+
unless arguments.empty? || !arguments[0].include?('-')
|
10
|
+
options = Hash.new
|
12
11
|
|
13
|
-
|
12
|
+
optparser = OptionParser.new do|opts|
|
13
|
+
|
14
|
+
opts.banner = "Usage: compressit [option] [FOLDER] [VERSION]"
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
opts.on('-h', '--help', 'Display this help') do
|
17
|
+
puts optparser
|
18
|
+
end
|
19
|
+
opts.on('-v', '--version', 'Display current gem version') do
|
20
|
+
puts "Currently using version: #{VERSION}"
|
21
|
+
end
|
22
|
+
opts.on('-c', '--css FOLDER VERSION', 'Compress css files from [FOLDER] into [FOLDER]/compressed') do
|
23
|
+
puts "Compressing css files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.css'"
|
24
|
+
options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.css'
|
25
|
+
Compressit::Base.compressit(options)
|
26
|
+
end
|
27
|
+
opts.on('-j', '--js FOLDER VERSION', 'Compress javascript files from [FOLDER] into [FOLDER]/compressed') do
|
28
|
+
puts "Compressing javascript files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.js'"
|
29
|
+
options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.js'
|
30
|
+
Compressit::Base.compressit(options)
|
20
31
|
end
|
21
32
|
end
|
22
|
-
|
23
|
-
|
33
|
+
|
34
|
+
begin optparser.parse!(arguments)
|
35
|
+
rescue OptionParser::InvalidOption => error
|
36
|
+
puts "#{error}, try one of this: "
|
24
37
|
puts optparser
|
38
|
+
exit 1
|
25
39
|
end
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
opts.on('-c', '--css FOLDER VERSION', 'Compress css files from [FOLDER] into [FOLDER]/compressed') do
|
30
|
-
puts "Compressing css files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.css'"
|
31
|
-
options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.css'
|
32
|
-
Compressit::Base.compressit(options)
|
33
|
-
end
|
34
|
-
opts.on('-j', '--js FOLDER VERSION', 'Compress javascript files from [FOLDER] into [FOLDER]/compressed') do
|
35
|
-
puts "Compressing javascript files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.js'"
|
36
|
-
options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.js'
|
37
|
-
Compressit::Base.compressit(options)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
begin optparser.parse!(arguments)
|
42
|
-
rescue OptionParser::InvalidOption => error
|
43
|
-
puts "#{error}, try one of this: "
|
44
|
-
puts optparser
|
45
|
-
exit 1
|
40
|
+
else
|
41
|
+
puts `compressit -h`
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
data/lib/compressit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compressit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-09 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70181998155980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70181998155980
|
25
25
|
description: Compressit uses the yuicompressor-2.4.6.jar java file created by Yahoo
|
26
26
|
to compress all of your .css and .js files into single compressed files respectively.
|
27
27
|
This not only reduces the size of your files, but also results in less http requests
|