sassconf 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +29 -4
- data/Rakefile +1 -1
- data/lib/sassconf/{config_reader.rb → config_manager.rb} +16 -3
- data/lib/sassconf/core_extensions.rb +35 -12
- data/lib/sassconf/logger.rb +1 -1
- data/lib/sassconf/sass_executor.rb +32 -2
- data/lib/sassconf/util.rb +12 -1
- data/lib/sassconf/version.rb +1 -1
- data/lib/sassconf.rb +28 -7
- data/sassconf.gemspec +2 -1
- data/shippable.yml +0 -2
- data/test/resources/Error_Config.rb +5 -0
- data/test/test_config_reader.rb +27 -18
- data/test/test_sass_executor.rb +16 -15
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 680e1904ad775caa81e4c706e348487c17eb519e
|
4
|
+
data.tar.gz: a581a9c6c1dc47fc20144c940ba6f0e73e9e31c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4efdada8a4926789346e1712e8037889bc8e92c3d8df9d3e042e071bd42475a2cf8502984b27cbaba4188775b1608080c023a7ee8cab829826cbdff6c8a46b52
|
7
|
+
data.tar.gz: a453267953ca8b2d46672e5df40d21d2f5f3e4b4b2bbc3309ea315b880325da6c9138502d79a98f950f77f67a23a1a09e789787a6d39eebd8eb2174cde43a235
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,19 +2,34 @@ Sassconf
|
|
2
2
|
========
|
3
3
|
[![Build Status](https://api.shippable.com/projects/555cfb27edd7f2c052f63ad8/badge?branchName=master)](https://app.shippable.com/projects/555cfb27edd7f2c052f63ad8/builds/latest)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sassconf.svg?style=flat-square)](http://badge.fury.io/rb/sassconf)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/schlegel11/Sassconf/badges/gpa.svg)](https://codeclimate.com/github/schlegel11/Sassconf)
|
5
6
|
|
6
7
|
With the Sassconf command tool you can use a config file for defining your [Sass](https://github.com/sass/sass) options.
|
7
8
|
If you liked the config file in any Compass environment then you'll like that one also because it's very similar :)
|
8
9
|
|
10
|
+
## ChangeLog
|
11
|
+
#### Version 0.1.5
|
12
|
+
- Fixed Exception handling.
|
13
|
+
|
14
|
+
- Improved syntax error handling.
|
15
|
+
|
16
|
+
- Add Feature live reloading of config file.
|
17
|
+
|
18
|
+
- Improved process handling.
|
19
|
+
- Childprocess handling on UNIX and MS-DOS.
|
20
|
+
|
21
|
+
- Improved log messages.
|
22
|
+
|
9
23
|
## Requirements
|
10
24
|
|
11
25
|
- [Sass](https://github.com/sass/sass)
|
26
|
+
- [Filewatcher] (https://github.com/thomasfl/filewatcher)
|
12
27
|
|
13
28
|
**Supported and tested ruby versions**
|
14
29
|
- Ruby
|
15
30
|
- 1.9.2 and up
|
16
31
|
- JRuby
|
17
|
-
-
|
32
|
+
- 9.0.0.0.pre2 and up
|
18
33
|
|
19
34
|
## Installation
|
20
35
|
|
@@ -113,7 +128,11 @@ You can also set a list of values on the command line which you can use in your
|
|
113
128
|
- -a, --args ARGS
|
114
129
|
- Comma separated list of values e.g.: val_a, val_b,...
|
115
130
|
|
116
|
-
-
|
131
|
+
- -r, --reload
|
132
|
+
- Watch config file for changes and reload it.
|
133
|
+
Useful if you are using "arg_watch" in your config.
|
134
|
+
|
135
|
+
- -v, --verbose
|
117
136
|
- Print all log messages.
|
118
137
|
|
119
138
|
- -?, -h, --help
|
@@ -151,7 +170,7 @@ You can also set a list of values on the command line which you can use in your
|
|
151
170
|
**output.css**
|
152
171
|
```css
|
153
172
|
.navigation {
|
154
|
-
border-color: #
|
173
|
+
border-color: #3BBECE;
|
155
174
|
color: #2ca2af;
|
156
175
|
}
|
157
176
|
```
|
@@ -183,6 +202,12 @@ You can also set a list of values on the command line which you can use in your
|
|
183
202
|
sassconf -c ./config.rb
|
184
203
|
```
|
185
204
|
|
205
|
+
or with "live reloading":
|
206
|
+
|
207
|
+
```bash
|
208
|
+
sassconf -c ./config.rb -r
|
209
|
+
```
|
210
|
+
|
186
211
|
**Console Output:**
|
187
212
|
```bash
|
188
213
|
>>> Sass is watching for changes. Press Ctrl-C to stop.
|
@@ -195,7 +220,7 @@ You can also set a list of values on the command line which you can use in your
|
|
195
220
|
**/out/input.css**
|
196
221
|
```css
|
197
222
|
.navigation {
|
198
|
-
border-color: #
|
223
|
+
border-color: #3BBECE;
|
199
224
|
color: #2ca2af;
|
200
225
|
}
|
201
226
|
```
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require_relative 'logger'
|
|
3
3
|
require_relative 'core_extensions'
|
4
4
|
|
5
5
|
module Sassconf
|
6
|
-
class
|
6
|
+
class ConfigManager
|
7
7
|
include Logging
|
8
8
|
|
9
9
|
VARIABLE_PREFIX = 'arg_'
|
@@ -18,8 +18,21 @@ module Sassconf
|
|
18
18
|
inject_array = 'extern_args = create_array_from_string(@bind_extern_string_array);'
|
19
19
|
source_file = File.read(file_path)
|
20
20
|
collect_variables = '@vh = create_variable_hash(local_variables, binding); @vwvh = create_variable_with_value_hash(local_variables, binding)'
|
21
|
-
|
22
|
-
|
21
|
+
logger.info("Eval config file: #{file_path}")
|
22
|
+
eval_line = __LINE__ + 1
|
23
|
+
eval("#{inject_array} \n #{source_file} \n #{collect_variables}", reader_binding, file_path, __LINE__ - eval_line)
|
24
|
+
end
|
25
|
+
|
26
|
+
def watch_update(file_path, activate)
|
27
|
+
Util.pre_check(activate.is_boolean?, 'Activate is no boolean type.')
|
28
|
+
if (activate)
|
29
|
+
Util.pre_check((file_path.is_string? and file_path.is_not_nil_or_empty? and File.exist?(file_path)), "\"rb\" file path is no string, nil, empty or doesn't exist.")
|
30
|
+
FileWatcher.new([file_path]).watch do |filename, event|
|
31
|
+
if (event == :changed)
|
32
|
+
yield(filename)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
23
36
|
end
|
24
37
|
|
25
38
|
def variable_hash
|
@@ -10,6 +10,10 @@ module Sassconf
|
|
10
10
|
def is_hash?
|
11
11
|
false
|
12
12
|
end
|
13
|
+
|
14
|
+
def is_boolean?
|
15
|
+
false
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
module String
|
@@ -25,19 +29,16 @@ module Sassconf
|
|
25
29
|
!(self.nil? || self.empty?)
|
26
30
|
end
|
27
31
|
|
28
|
-
def newline(count = 1, side = :right)
|
29
|
-
|
30
|
-
self << (block_given? ? yield : '')
|
32
|
+
def newline(count = 1, side = :right, &block)
|
33
|
+
base_manipulation("\n", count, side, &block)
|
31
34
|
end
|
32
35
|
|
33
|
-
def paragraph(count = 1, side = :right)
|
34
|
-
|
35
|
-
self << (block_given? ? yield : '')
|
36
|
+
def paragraph(count = 1, side = :right, &block)
|
37
|
+
base_manipulation("\n\n", count, side, &block)
|
36
38
|
end
|
37
39
|
|
38
|
-
def blank(count = 1, side = :right)
|
39
|
-
|
40
|
-
self << (block_given? ? yield : '')
|
40
|
+
def blank(count = 1, side = :right, &block)
|
41
|
+
base_manipulation(' ', count, side, &block)
|
41
42
|
end
|
42
43
|
|
43
44
|
module ClassMethods
|
@@ -45,6 +46,14 @@ module Sassconf
|
|
45
46
|
''
|
46
47
|
end
|
47
48
|
end
|
49
|
+
|
50
|
+
def base_manipulation(char, count, side)
|
51
|
+
count.times { side == :left ? self.insert(0, char) : self << char }
|
52
|
+
self << (block_given? ? yield : '')
|
53
|
+
end
|
54
|
+
|
55
|
+
module_function :base_manipulation
|
56
|
+
|
48
57
|
end
|
49
58
|
|
50
59
|
module Hash
|
@@ -52,17 +61,31 @@ module Sassconf
|
|
52
61
|
true
|
53
62
|
end
|
54
63
|
end
|
64
|
+
|
65
|
+
module Boolean
|
66
|
+
def is_boolean?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
end
|
55
70
|
end
|
56
71
|
end
|
57
72
|
|
58
73
|
class Object
|
59
|
-
|
74
|
+
include Sassconf::CoreExtensions::Object
|
60
75
|
end
|
61
76
|
|
62
77
|
class String
|
63
|
-
|
78
|
+
include Sassconf::CoreExtensions::String
|
64
79
|
end
|
65
80
|
|
66
81
|
class Hash
|
67
|
-
|
82
|
+
include Sassconf::CoreExtensions::Hash
|
83
|
+
end
|
84
|
+
|
85
|
+
class TrueClass
|
86
|
+
include Sassconf::CoreExtensions::Boolean
|
87
|
+
end
|
88
|
+
|
89
|
+
class FalseClass
|
90
|
+
include Sassconf::CoreExtensions::Boolean
|
68
91
|
end
|
data/lib/sassconf/logger.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'open3'
|
1
2
|
require_relative 'util'
|
2
3
|
require_relative 'core_extensions'
|
3
4
|
require_relative 'logger'
|
@@ -30,7 +31,36 @@ module Sassconf
|
|
30
31
|
def execute(argument_string)
|
31
32
|
Util.pre_check((argument_string.is_string? and argument_string.is_not_nil_or_empty?), 'Argument string is no string, nil or empty.')
|
32
33
|
|
33
|
-
|
34
|
+
@pid = spawn(SASS_PROCESS % [argument_string, @sass_input, @sass_output])
|
35
|
+
logger.info("Spawn Sass process: #{@pid}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def detach_and_kill
|
39
|
+
unless @pid.nil?
|
40
|
+
logger.info("Detach Sass process: #{@pid}")
|
41
|
+
Process.detach(@pid)
|
42
|
+
out, status = if Util.windows? then
|
43
|
+
logger.info("Find child processes on MS-DOS")
|
44
|
+
Open3.capture2("wmic process where (ParentProcessId=#{@pid.to_s}) get ProcessId")
|
45
|
+
else
|
46
|
+
logger.info("Find child processes on UNIX")
|
47
|
+
Open3.capture2('ps', 'h', '--ppid', @pid.to_s, '-o', 'pid')
|
48
|
+
end
|
49
|
+
logger.info("Kill process: #{@pid}")
|
50
|
+
Process.kill('KILL', @pid)
|
51
|
+
out.each_line do |elem|
|
52
|
+
pid = elem.to_i;
|
53
|
+
unless pid == 0
|
54
|
+
Process.kill('KILL', pid)
|
55
|
+
logger.info("Killed child process: #{pid}")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def wait
|
62
|
+
logger.info("Wait for Sass process: #{@pid}")
|
63
|
+
Process.wait(@pid) unless @pid.nil?
|
34
64
|
end
|
35
65
|
|
36
66
|
private
|
@@ -43,4 +73,4 @@ module Sassconf
|
|
43
73
|
argument_hash.reduce('') { |arg_string, (key, value)| arg_string.concat((argument_type % [key, value])) }.strip
|
44
74
|
end
|
45
75
|
end
|
46
|
-
end
|
76
|
+
end
|
data/lib/sassconf/util.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module Sassconf
|
2
2
|
class Util
|
3
3
|
def self.pre_check(term, message)
|
4
|
-
raise ArgumentError, message
|
4
|
+
raise ArgumentError, message unless term
|
5
5
|
end
|
6
|
+
|
7
|
+
#Credits go to https://github.com/rdp/os
|
8
|
+
def self.windows?
|
9
|
+
if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin
|
10
|
+
false
|
11
|
+
elsif ENV['OS'] == 'Windows_NT'
|
12
|
+
true
|
13
|
+
else
|
14
|
+
false
|
15
|
+
end
|
16
|
+
end
|
6
17
|
end
|
7
18
|
end
|
8
19
|
|
data/lib/sassconf/version.rb
CHANGED
data/lib/sassconf.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'sassconf/version'
|
2
|
-
require 'sassconf/
|
2
|
+
require 'sassconf/config_manager'
|
3
3
|
require 'sassconf/sass_executor'
|
4
4
|
require 'optparse'
|
5
5
|
require 'ostruct'
|
6
|
+
require 'filewatcher'
|
6
7
|
|
7
8
|
module Sassconf
|
8
9
|
extend Logging
|
@@ -14,6 +15,8 @@ module Sassconf
|
|
14
15
|
DESCRIPTION = 'Description:'
|
15
16
|
.newline.blank(3) { 'Adds configuration file to Sass preprocessor.' }
|
16
17
|
.newline.blank(3) { "Version #{Sassconf::VERSION}" }
|
18
|
+
.newline.blank(3) {'Homepage: http://sassconf.schlegel11.de'}
|
19
|
+
.newline.blank(3) {'Email: develop@schlegel11.de'}
|
17
20
|
.paragraph
|
18
21
|
REQUIRED = 'Required:'
|
19
22
|
OPTIONAL = 'Optional:'.newline(1, :left)
|
@@ -25,6 +28,7 @@ module Sassconf
|
|
25
28
|
option_args = OpenStruct.new
|
26
29
|
option_args.config_path = String.empty
|
27
30
|
option_args.extern_args = String.empty
|
31
|
+
option_args.reload_active = false
|
28
32
|
|
29
33
|
opt_parser = OptionParser.new do |opts|
|
30
34
|
opts.banner = HelpText::USAGE
|
@@ -40,8 +44,12 @@ module Sassconf
|
|
40
44
|
option_args.extern_args = elem
|
41
45
|
end
|
42
46
|
|
47
|
+
opts.on('-r', '--reload', 'Watch config file for changes and reload it.', 'Useful if you are using "arg_watch" in your config.'.paragraph) do
|
48
|
+
option_args.reload_active = true
|
49
|
+
end
|
50
|
+
|
43
51
|
opts.on('-v', '--verbose', 'Print all log messages.') do
|
44
|
-
Sassconf::Logging.activate
|
52
|
+
Sassconf::Logging.activate
|
45
53
|
end
|
46
54
|
|
47
55
|
opts.on('-?', '-h', '--help', 'Show this help. "Wow you really need this help?! ... Me too. ;)"') do
|
@@ -63,18 +71,31 @@ module Sassconf
|
|
63
71
|
def self.start
|
64
72
|
begin
|
65
73
|
option_args = Parser.parse(ARGV)
|
66
|
-
|
74
|
+
config_manager = ConfigManager.new
|
67
75
|
executor = SassExecutor.new(ARGV[0], ARGV[1])
|
68
76
|
|
69
|
-
|
70
|
-
|
71
|
-
|
77
|
+
Sassconf.eval_and_execute(config_manager, executor, option_args)
|
78
|
+
|
79
|
+
config_manager.watch_update(option_args.config_path, option_args.reload_active) do |filename|
|
80
|
+
logger.info("Config reload: #{filename}")
|
81
|
+
Sassconf.eval_and_execute(config_manager, executor, option_args)
|
82
|
+
puts "Config reloaded: #{filename}".newline(1, :left).paragraph
|
83
|
+
end
|
72
84
|
|
73
|
-
|
85
|
+
executor.wait
|
86
|
+
rescue StandardError, ScriptError => e
|
74
87
|
puts e.message
|
75
88
|
logger.error(e)
|
76
89
|
ensure
|
77
90
|
exit
|
78
91
|
end
|
79
92
|
end
|
93
|
+
|
94
|
+
def self.eval_and_execute(config_manager, sass_executor, option_args)
|
95
|
+
sass_executor.detach_and_kill
|
96
|
+
config_manager.eval_rb_file(option_args.config_path, option_args.extern_args)
|
97
|
+
argument_string = sass_executor.create_all_argument_strings(config_manager.variable_with_value_hash, config_manager.variable_hash)
|
98
|
+
sass_executor.execute(argument_string)
|
99
|
+
end
|
100
|
+
|
80
101
|
end
|
data/sassconf.gemspec
CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.required_ruby_version = '>= 1.9.2'
|
25
25
|
spec.add_runtime_dependency 'sass', '>= 3.1.0'
|
26
|
+
spec.add_runtime_dependency 'filewatcher', '~> 0.5.1'
|
26
27
|
|
27
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
-
spec.add_development_dependency 'minitest', '
|
29
|
+
spec.add_development_dependency 'minitest', '~> 5.6'
|
29
30
|
end
|
data/shippable.yml
CHANGED
data/test/test_config_reader.rb
CHANGED
@@ -1,50 +1,59 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
|
-
require 'sassconf/
|
2
|
+
require 'sassconf/config_manager'
|
3
3
|
|
4
4
|
class TestConfigReader < Minitest::Test
|
5
5
|
CONFIG_PATH = File.dirname(__FILE__) + '/resources/Config.rb'
|
6
|
+
ERROR_CONFIG_PATH = File.dirname(__FILE__) + '/resources/Error_Config.rb'
|
6
7
|
|
7
8
|
# Called before every test method runs. Can be used
|
8
9
|
# to set up fixture information.
|
9
10
|
def setup
|
10
|
-
@
|
11
|
+
@config_manager = Sassconf::ConfigManager.new
|
11
12
|
end
|
12
13
|
|
13
14
|
def test_positive_eval_rb_file
|
14
|
-
assert_equal(nil, @
|
15
|
-
assert_equal(nil, @
|
15
|
+
assert_equal(nil, @config_manager.variable_hash)
|
16
|
+
assert_equal(nil, @config_manager.variable_with_value_hash)
|
16
17
|
|
17
|
-
@
|
18
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
18
19
|
|
19
|
-
assert_equal({'style' => 'compressed', 'sourcemap' => 'none'}, @
|
20
|
-
assert_equal({'no-cache' => :no_value}, @
|
20
|
+
assert_equal({'style' => 'compressed', 'sourcemap' => 'none'}, @config_manager.variable_with_value_hash)
|
21
|
+
assert_equal({'no-cache' => :no_value}, @config_manager.variable_hash)
|
21
22
|
|
22
|
-
@
|
23
|
+
@config_manager.eval_rb_file(CONFIG_PATH, 'dummy, inline ')
|
23
24
|
|
24
|
-
assert_equal({'style' => 'compressed', 'sourcemap' => 'inline'}, @
|
25
|
-
assert_equal({'no-cache' => :no_value}, @
|
25
|
+
assert_equal({'style' => 'compressed', 'sourcemap' => 'inline'}, @config_manager.variable_with_value_hash)
|
26
|
+
assert_equal({'no-cache' => :no_value}, @config_manager.variable_hash)
|
26
27
|
end
|
27
28
|
|
28
29
|
def test_negative_eval_rb_file
|
29
|
-
exception = assert_raises(ArgumentError) { @
|
30
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file('test/resources/Config_not_exist.rb') }
|
30
31
|
assert_equal("\"rb\" file path is no string, nil, empty or doesn't exist.", exception.message)
|
31
32
|
|
32
|
-
exception = assert_raises(ArgumentError) { @
|
33
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file(String.empty) }
|
33
34
|
assert_equal("\"rb\" file path is no string, nil, empty or doesn't exist.", exception.message)
|
34
35
|
|
35
|
-
exception = assert_raises(ArgumentError) { @
|
36
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file(nil) }
|
36
37
|
assert_equal("\"rb\" file path is no string, nil, empty or doesn't exist.", exception.message)
|
37
38
|
|
38
|
-
exception = assert_raises(ArgumentError) { @
|
39
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file(0) }
|
39
40
|
assert_equal("\"rb\" file path is no string, nil, empty or doesn't exist.", exception.message)
|
40
41
|
|
41
|
-
exception = assert_raises(ArgumentError) { @
|
42
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file(CONFIG_PATH, 0) }
|
42
43
|
assert_equal('Extern string array is no string or nil.', exception.message)
|
43
44
|
|
44
|
-
exception = assert_raises(ArgumentError) { @
|
45
|
+
exception = assert_raises(ArgumentError) { @config_manager.eval_rb_file(CONFIG_PATH, nil) }
|
45
46
|
assert_equal('Extern string array is no string or nil.', exception.message)
|
46
47
|
|
47
|
-
assert_equal(nil, @
|
48
|
-
assert_equal(nil, @
|
48
|
+
assert_equal(nil, @config_manager.variable_with_value_hash)
|
49
|
+
assert_equal(nil, @config_manager.variable_hash)
|
50
|
+
|
51
|
+
exception = assert_raises(SyntaxError) { @config_manager.eval_rb_file(ERROR_CONFIG_PATH) }
|
52
|
+
assert_includes(exception.message, ":2: syntax error, unexpected ';'\narg_no_cache =; :no_value\n")
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_negative_watch_update
|
56
|
+
exception = assert_raises(ArgumentError) { @config_manager.watch_update(nil, 0) }
|
57
|
+
assert_equal('Activate is no boolean type.', exception.message)
|
49
58
|
end
|
50
59
|
end
|
data/test/test_sass_executor.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'sassconf/sass_executor'
|
3
|
-
require 'sassconf/
|
3
|
+
require 'sassconf/config_manager'
|
4
4
|
|
5
5
|
class TestSassExecuter < Minitest::Test
|
6
6
|
|
@@ -10,14 +10,14 @@ class TestSassExecuter < Minitest::Test
|
|
10
10
|
# Called before every test method runs. Can be used
|
11
11
|
# to set up fixture information.
|
12
12
|
def setup
|
13
|
-
@
|
13
|
+
@config_manager = Sassconf::ConfigManager.new
|
14
14
|
@sass_executor = Sassconf::SassExecutor.new(SCSS_PATH, CSS_PATH)
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_positive_create_argument_with_value_string
|
18
|
-
@
|
18
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
19
19
|
|
20
|
-
assert_equal('--style=compressed --sourcemap=none', @sass_executor.create_argument_with_value_string(@
|
20
|
+
assert_equal('--style=compressed --sourcemap=none', @sass_executor.create_argument_with_value_string(@config_manager.variable_with_value_hash))
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_negative_create_argument_with_value_string
|
@@ -29,9 +29,9 @@ class TestSassExecuter < Minitest::Test
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_positive_create_argument_string
|
32
|
-
@
|
32
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
33
33
|
|
34
|
-
assert_equal('--no-cache', @sass_executor.create_argument_string(@
|
34
|
+
assert_equal('--no-cache', @sass_executor.create_argument_string(@config_manager.variable_hash))
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_negative_create_argument_string
|
@@ -43,28 +43,29 @@ class TestSassExecuter < Minitest::Test
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_positive_create_all_argument_strings
|
46
|
-
@
|
46
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
47
47
|
|
48
|
-
assert_equal('--style=compressed --sourcemap=none --no-cache', @sass_executor.create_all_argument_strings(@
|
48
|
+
assert_equal('--style=compressed --sourcemap=none --no-cache', @sass_executor.create_all_argument_strings(@config_manager.variable_with_value_hash, @config_manager.variable_hash))
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_negative_create_all_argument_strings
|
52
|
-
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(@
|
52
|
+
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(@config_manager.variable_with_value_hash, String.empty) }
|
53
53
|
assert_equal('Argument hash is no hash or nil.', exception.message)
|
54
54
|
|
55
|
-
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(@
|
55
|
+
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(@config_manager.variable_with_value_hash, nil) }
|
56
56
|
assert_equal('Argument hash is no hash or nil.', exception.message)
|
57
57
|
|
58
|
-
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(String.empty, @
|
58
|
+
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(String.empty, @config_manager.variable_hash) }
|
59
59
|
assert_equal('Argument hash is no hash or nil.', exception.message)
|
60
60
|
|
61
|
-
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(nil, @
|
61
|
+
exception = assert_raises(ArgumentError) { @sass_executor.create_all_argument_strings(nil, @config_manager.variable_hash) }
|
62
62
|
assert_equal('Argument hash is no hash or nil.', exception.message)
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_positive_execute
|
66
|
-
@
|
67
|
-
@sass_executor.execute(@sass_executor.create_all_argument_strings(@
|
66
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
67
|
+
@sass_executor.execute(@sass_executor.create_all_argument_strings(@config_manager.variable_with_value_hash, @config_manager.variable_hash))
|
68
|
+
@sass_executor.wait
|
68
69
|
|
69
70
|
assert_equal(".navigation{border-color:#3BBFCE;color:#2ca2af}\n", File.read(CSS_PATH))
|
70
71
|
|
@@ -72,7 +73,7 @@ class TestSassExecuter < Minitest::Test
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def test_negative_execute
|
75
|
-
@
|
76
|
+
@config_manager.eval_rb_file(CONFIG_PATH)
|
76
77
|
|
77
78
|
exception = assert_raises(ArgumentError) { @sass_executor.execute(0) }
|
78
79
|
assert_equal('Argument string is no string, nil or empty.', exception.message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel Schlegel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: filewatcher
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.5.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +56,16 @@ dependencies:
|
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.6
|
61
|
+
version: '5.6'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.6
|
68
|
+
version: '5.6'
|
55
69
|
description: |-
|
56
70
|
With the Sassconf command tool you can use a config file for defining your Sass options.
|
57
71
|
If you liked the config file in any Compass environment then you'll like that one also because it's very similar.
|
@@ -68,7 +82,7 @@ files:
|
|
68
82
|
- Rakefile
|
69
83
|
- bin/sassconf
|
70
84
|
- lib/sassconf.rb
|
71
|
-
- lib/sassconf/
|
85
|
+
- lib/sassconf/config_manager.rb
|
72
86
|
- lib/sassconf/core_extensions.rb
|
73
87
|
- lib/sassconf/logger.rb
|
74
88
|
- lib/sassconf/sass_executor.rb
|
@@ -77,6 +91,7 @@ files:
|
|
77
91
|
- sassconf.gemspec
|
78
92
|
- shippable.yml
|
79
93
|
- test/resources/Config.rb
|
94
|
+
- test/resources/Error_Config.rb
|
80
95
|
- test/resources/Input.scss
|
81
96
|
- test/test_config_reader.rb
|
82
97
|
- test/test_sass_executor.rb
|