sugamasao-saag 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README.rdoc +24 -4
- data/TODO +0 -2
- data/VERSION +1 -1
- data/lib/saag.rb +35 -9
- data/spec/saag_spec.rb +10 -0
- data/spec/spec_helper.rb +11 -0
- metadata +7 -5
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -22,20 +22,29 @@ SASS ファイルを監視し、変更があれば即座に CSS ファイルへ
|
|
22
22
|
== Synopsis
|
23
23
|
|
24
24
|
使用例:
|
25
|
-
|
25
|
+
|
26
|
+
=== オプション無し
|
27
|
+
% saag
|
28
|
+
|
26
29
|
引数を使用しない場合、コマンド実行者のカレントディレクトリを基点とし、*.sass ファイルを探し、対象ファイルとします。
|
27
30
|
|
28
31
|
また、出力される CSS ファイルは sass ファイルと同じ階層になります。
|
29
|
-
|
32
|
+
|
33
|
+
(Version 0.3.5以降) saag を実行するよりも以前のタイムスタンプのファイルは対象ファイルに含まれません 。
|
34
|
+
|
35
|
+
古いタイムスタンプも変換したい場合は -x オプションを使用してください
|
36
|
+
|
37
|
+
=== オプション -i
|
30
38
|
% saag -i /path/to/sass
|
31
39
|
|
32
40
|
-i オプションを使用することで、sass ファイルのあるディレクトリ(ファイル名でも可)を指定する事が可能です。
|
33
41
|
|
34
|
-
|
42
|
+
出力先は、変更対象の sass ファイルのあるディレクトリと同じディレクトリになります。
|
35
43
|
|
44
|
+
=== オプション -o
|
36
45
|
% saag -i /path/to/sass -o /path/to/css
|
37
46
|
|
38
|
-
-o オプションを使用することで、css
|
47
|
+
-o オプションを使用することで、css の出力先ファイルを指定することができます。-o オプション単独での使用も可能です。
|
39
48
|
|
40
49
|
出力先ファイルのディレクトリ構成は、-i オプションに依存します。
|
41
50
|
|
@@ -43,6 +52,17 @@ SASS ファイルを監視し、変更があれば即座に CSS ファイルへ
|
|
43
52
|
|
44
53
|
/path/to/css/sub_dir/hoge.css となります。
|
45
54
|
|
55
|
+
-o 単独で使用した場合、実行時のカレントディレクトリ配下から *.sass ファイルを探し、 -o で指定したディレクトリに *.css を出力します。
|
56
|
+
|
57
|
+
=== オプション -x
|
58
|
+
% saag -x
|
59
|
+
|
60
|
+
-x オプションを使用する事で、本プロセスを起動するよりも前に編集された sass ファイルを変更対象に含めます。
|
61
|
+
|
62
|
+
逆に言うと、 -x を使用しない場合は、saag 起動後に編集したファイルしか変更対象になりません。
|
63
|
+
|
64
|
+
このオプションは Version 0.3.5 以降で実装されました。
|
65
|
+
|
46
66
|
== Copyright
|
47
67
|
|
48
68
|
Author:: sugamasao <sugamasao@gmail.com>
|
data/TODO
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/lib/saag.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# $Id$
|
2
|
-
|
3
1
|
require 'optparse'
|
4
2
|
require 'logger'
|
5
3
|
require 'pp'
|
@@ -41,11 +39,26 @@ class Saag
|
|
41
39
|
|
42
40
|
begin
|
43
41
|
OptionParser.new do |opt|
|
44
|
-
opt.on('-i', '--input_path=VAL', 'input file path(directory or filename)')
|
45
|
-
|
46
|
-
|
47
|
-
opt.on('-
|
48
|
-
|
42
|
+
opt.on('-i', '--input_path=VAL', 'input file path(directory or filename)') do |v|
|
43
|
+
@conf[:in_path] = set_dir_path(v)
|
44
|
+
end
|
45
|
+
opt.on('-o', '--output_path=VAL', 'generated css file output path') do |v|
|
46
|
+
@conf[:out_path] = set_dir_path(v)
|
47
|
+
end
|
48
|
+
opt.on('-r', '--render_opt=VAL', 'sass render option [nested or expanded or compact or compressed]') do |v|
|
49
|
+
@conf[:render_opt] = set_render_opt(v)
|
50
|
+
end
|
51
|
+
opt.on('-v', '--version', 'show version' ) do
|
52
|
+
# TODO stderror print.
|
53
|
+
puts "#{@app_name} #{@version}";
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
opt.on('-d', '--debug', 'log level to debug') do |v|
|
57
|
+
@conf[:debug] = v
|
58
|
+
end
|
59
|
+
opt.on('-x', '--exclude', 'exclude older Sass Script(target to "Time.now < Sass Script Modified Time")') do
|
60
|
+
@conf[:exclude] = true
|
61
|
+
end
|
49
62
|
end.parse!(argv)
|
50
63
|
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
51
64
|
@logger.error('invalid args...! looks for "-h" option')
|
@@ -58,6 +71,7 @@ class Saag
|
|
58
71
|
@logger.debug("args input_path => #{@conf[:in_path]}")
|
59
72
|
@logger.debug("args output_path => #{@conf[:out_path]}")
|
60
73
|
@logger.debug("args render_opt => #{@conf[:render_opt]}")
|
74
|
+
@logger.debug("args -x? => #{@conf[:exclude]}")
|
61
75
|
|
62
76
|
set_default_conf()
|
63
77
|
set_signal()
|
@@ -269,6 +283,9 @@ class Saag
|
|
269
283
|
unless @conf[:render_opt]
|
270
284
|
@conf[:render_opt] = :nested
|
271
285
|
end
|
286
|
+
|
287
|
+
# プロセス開始時刻
|
288
|
+
@conf[:start_time] = Time.now
|
272
289
|
end
|
273
290
|
|
274
291
|
#== saag#get_file_list
|
@@ -323,11 +340,20 @@ class Saag
|
|
323
340
|
if path =~ /#{@conf[:in_path]}(.+)/
|
324
341
|
sub_path = $1
|
325
342
|
end
|
343
|
+
|
344
|
+
change = true
|
345
|
+
file_time = File.mtime(path)
|
346
|
+
# exclude オプションが無い(デフォルト時)はプロセスのスタート時刻よりも古い時刻のファイルは false にする
|
347
|
+
unless @conf[:exclude]
|
348
|
+
@logger.debug("no exclude option.")
|
349
|
+
change = false if(file_time < @conf[:start_time])
|
350
|
+
end
|
351
|
+
|
326
352
|
data = {
|
327
353
|
:path => path,
|
328
354
|
:sub_path => sub_path,
|
329
|
-
:time =>
|
330
|
-
:change =>
|
355
|
+
:time => file_time,
|
356
|
+
:change => change
|
331
357
|
}
|
332
358
|
@logger.debug("create_file_data@sub_path => #{sub_path}")
|
333
359
|
return data
|
data/spec/saag_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
|
4
|
+
class Saag
|
5
|
+
# private methods to public
|
6
|
+
public :main_loop, :set_dir_path, :set_signal, :set_render_opt, :set_default_conf, :get_file_list, :create_file_data, :write_css_file, :check_file_list, :set_default_time
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Saag, "test" do
|
10
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugamasao-saag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sugamasao
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
- saag
|
15
15
|
dependencies:
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- TODO
|
43
43
|
has_rdoc: false
|
44
44
|
homepage: http://github.com/sugamasao/saag
|
45
|
+
licenses:
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options:
|
47
48
|
- --title
|
@@ -73,9 +74,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
74
|
requirements: []
|
74
75
|
|
75
76
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.3.5
|
77
78
|
signing_key:
|
78
79
|
specification_version: 3
|
79
80
|
summary: SAss Automatic monitor and Generate css file.
|
80
|
-
test_files:
|
81
|
-
|
81
|
+
test_files:
|
82
|
+
- spec/saag_spec.rb
|
83
|
+
- spec/spec_helper.rb
|