jugyo-filetter 0.2.5 → 0.2.6

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/README.rdoc CHANGED
@@ -8,25 +8,27 @@ Filetter is a pluggable tool for file system.
8
8
 
9
9
  == FEATURES/PROBLEMS:
10
10
 
11
- only few plugins.
12
- (プラグインがまだ全然ない!)
11
+ Available modes:
13
12
 
14
- no test!
15
- (テスト全然書いてない!)
13
+ - mozrepl mode
14
+ - twitter mode
15
+ - flickr mode
16
16
 
17
- In the future,
18
- (将来的にはこんなプラグインが実装される予定!)
17
+ In the future:
19
18
 
20
- - rspec plugin
21
- - flickr plugin
22
- - backup plugin
23
- - twitter plugin
24
- - blog plugin
25
- - tumblr plugin
26
- - mail plugin
19
+ - rspec
20
+ - backup
21
+ - blog
22
+ - tumblr
23
+ - mail
24
+ ...
27
25
 
28
26
  == SYNOPSIS:
29
27
 
28
+ Show help:
29
+
30
+ filetter --help
31
+
30
32
  Run:
31
33
 
32
34
  filetter -m MODE
@@ -37,11 +39,11 @@ or (for development)
37
39
 
38
40
  Example:
39
41
 
40
- run as 'mozrepl' mode for files named '*.css':
42
+ Run as 'mozrepl' mode for files named '*.css':
41
43
 
42
44
  filetter -m mozrepl -p './**/*.css'
43
45
 
44
- You load a file for configuration or original modes.
46
+ To load your file:
45
47
 
46
48
  filetter -f your_file
47
49
 
@@ -49,7 +51,10 @@ Default file to load is '.filetter' in the current directory if exist.
49
51
 
50
52
  == REQUIREMENTS:
51
53
 
52
- configatron
54
+ - configatron
55
+ - highline
56
+ - rubytter
57
+ - rflickr
53
58
 
54
59
  == INSTALL:
55
60
 
data/lib/filetter.rb CHANGED
@@ -18,39 +18,42 @@ module Filetter
18
18
  interval = 2
19
19
  debug = false
20
20
  mode = nil
21
- load_path = nil
22
21
  load_file = '.filetter'
23
22
  work_dir = nil
23
+ help = nil
24
+ list = false
24
25
 
25
26
  OptionParser.new do |opt|
26
27
  opt.version = VERSION
27
28
  opt.program_name = self.to_s
28
29
  opt.on('-m', '--mode=mode', 'Run mode' ) {|v| mode = v }
29
- opt.on('-l', '--loadpath=path', 'Library load path' ) {|v| load_path = v }
30
30
  opt.on('-f', '--loadfile=file', 'File to load' ) {|v| load_file = v }
31
31
  opt.on('-c', '--cd=directory', 'cd to directory' ) {|v| work_dir = v }
32
32
  opt.on('-p', '--pattern=pattern', 'Pattern of target files' ) {|v| pattern = v }
33
33
  opt.on('-i', '--interval=interval', 'Interval of check files', Integer ) {|v| interval = v }
34
34
  opt.on('-d', '--debug', 'Enable debug mode' ) {|v| debug = true }
35
+ opt.on('-l', '--list', 'List up available modes' ) {|v| list = true }
35
36
  opt.parse!(ARGV)
37
+ help = opt.help
36
38
  end
37
39
 
38
- $:.unshift(File.expand_path(load_path)) if load_path
39
-
40
40
  if work_dir
41
41
  Dir.chdir(work_dir)
42
42
  puts "=> cd to #{work_dir}"
43
43
  end
44
44
 
45
45
  begin
46
- unless mode || load_file
47
- puts '=> Run as "sample" mode'
48
- require 'modes/sample'
49
- else
50
- if load_file && File.exist?(load_file)
51
- puts "=> load \"#{load_file}\""
52
- load load_file
46
+ if mode.nil? && !File.exist?(load_file)
47
+ if list
48
+ puts Dir[File.dirname(__FILE__) + '/modes/*.rb'].map{|f|File.basename(f).gsub(/\.rb$/, '')}
49
+ exit
50
+ else
51
+ puts help
52
+ exit!
53
53
  end
54
+ else
55
+ puts "=> load \"#{load_file}\""
56
+ load load_file
54
57
  if mode
55
58
  puts "=> Run as \"#{mode}\" mode"
56
59
  require "modes/#{mode}"
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Filetter
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jugyo-filetter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo