sugamasao-saag 0.3.4 → 0.3.5

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/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 2009-08-08 sugamasao@gmail.com
2
+
3
+ * Version 0.3.5 : add option "-x"
4
+
1
5
  2009-07-06 sugamasao@gmail.com
2
6
 
3
7
  * Version 0.3.4 : modified ends at the [Sass Syntax Error] or [File I/O
data/README.rdoc CHANGED
@@ -22,20 +22,29 @@ SASS ファイルを監視し、変更があれば即座に CSS ファイルへ
22
22
  == Synopsis
23
23
 
24
24
  使用例:
25
- % saag
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
- 出力先は、上記と同様に、sass ファイルのあるディレクトリになります。
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
@@ -1,6 +1,4 @@
1
1
  = TODO List
2
2
 
3
- * Tab Character to '2 spaces'
4
3
  * GUI Interface
5
- * Plugin Function
6
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
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)') {|v| @conf[:in_path] = set_dir_path(v)}
45
- opt.on('-o', '--output_path=VAL', 'generated css file output path') {|v| @conf[:out_path] = set_dir_path(v)}
46
- opt.on('-r', '--render_opt=VAL', 'sass render option [nested or expanded or compact or compressed]' ){|v| @conf[:render_opt] = set_render_opt(v)}
47
- opt.on('-v', '--version', 'show version' ) { puts "#{@app_name} #{@version}"; exit 1 }
48
- opt.on('-d', '--debug', 'log level to debug') {|v| @conf[:debug] = v}
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 => File.mtime(path),
330
- :change => true
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
@@ -0,0 +1,11 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'saag'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
10
+
11
+
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
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-07-06 00:00:00 -07:00
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.2.0
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