defoker 0.0.3 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aed1f825f53ce3bffb1facd20f9a687411f1914
4
- data.tar.gz: 4587f2276a3d6b386016a01c3eb9df7558ee28ec
3
+ metadata.gz: ca9c983a5ecae049e87562fde03ae9069924d36f
4
+ data.tar.gz: 2cec660df681c77d30518cecce73565058af772f
5
5
  SHA512:
6
- metadata.gz: 9dee078bc2eff30844b21d640b5df52a666da010dc6cbfcaf880e9fb73bd163034c28776902365ec889955902b6a58cc492e49ef842e234826e616b163a05502
7
- data.tar.gz: edfeecefaa528ba8377b57cc88b03421c63abdbe1f5a6b83d029c64b95fe958284028046d025f5745f0d3a3aa222a88cfb59ffe3a8a54d5c38597e32e06c8cbf
6
+ metadata.gz: 9d4d2d1a1c78a9c0b4a8b2bfa2e0ca578218bc6ddb41d6e5f51cce2672a600af51d376f7c1346928357780dc594426e4e28d30b61fef27e2e092a9ad758100d4
7
+ data.tar.gz: c317466dd4413d0a80a877778fb9cf81ca0a7dedff229151e2596fc4910b3814f4d53f7b9eed68cdd67481e711d8f6a98f9c4c5c1c2c0b3c783dc7e66d170bde
data/Gemfile CHANGED
@@ -1,18 +1,15 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
- gem "rspec", "~> 2.14.1"
5
- gem "thor", "~> 0.18.1"
6
- gem "simplecov", "~> 0.8.2"
7
- gem "activesupport", "~> 4.0.1"
8
- gem "activemodel", "~> 4.0.2"
9
- gem "tudu", "~> 0.0.4"
4
+ gem 'rspec', '~> 2.14.1'
5
+ gem 'thor', '~> 0.18.1'
6
+ gem 'simplecov', '~> 0.8.2'
10
7
 
11
8
  group :doc do
12
- gem "yard"
9
+ gem 'yard'
13
10
  end
14
11
 
15
12
  group :test do
16
13
  gem 'coveralls', require: false
17
- gem "timecop"
14
+ gem 'timecop'
18
15
  end
data/README.md CHANGED
@@ -273,13 +273,81 @@ $ ls -F | grep /
273
273
  2017_hoge/
274
274
  ~~~
275
275
 
276
+ ### rule-output
277
+ * generate Defokerfile template
278
+
279
+ ~~~bash
280
+ $ defoker init
281
+ $ cat Defokerfile
282
+ # type is required.
283
+ # you can choose type form...
284
+ # [:today | :tomorrow | :yesterday | :this_month | :next_month | :previous_month | :this_year | :previous_year | :next_month]
285
+ # example
286
+ # type :this_month
287
+ type :today
288
+ # base is optional.
289
+ # example
290
+ # base 'ruby'
291
+ base ''
292
+ ~~~
293
+
294
+ * execute by default Defokerfile
295
+
296
+ ~~~bash
297
+ # execute at 2014/10/01
298
+ $ defoker rule
299
+ $ ls -F | grep /
300
+ 20141001/
301
+ $ defoker rule -a hoge
302
+ $ ls -F | grep /
303
+ 20141001_hoge/
304
+
305
+ # execute at 2014/10/02
306
+ $ defoker rule
307
+ $ ls -F | grep /
308
+ 20141002/
309
+ $ defoker rule -a hoge
310
+ $ ls -F | grep /
311
+ 20141002_hoge/
312
+ ~~~
313
+
314
+ * edit Defokerfile.(type = previous_month, base = monthly_report)
315
+
316
+ ~~~bash
317
+ $ cat Defokerfile
318
+ type :previous_month
319
+ base 'monthly_report'
320
+ ~~~
321
+
322
+ * execute by edited Defokerfile.
323
+
324
+ ~~~bash
325
+ # execute at 2014/10
326
+ $ defoker rule
327
+ $ ls -F | grep /
328
+ 201409_monthly_report/
329
+ $ defoker rule -a hoge
330
+ $ ls -F | grep /
331
+ 201409_monthly_report_hoge/
332
+
333
+ # execute at 2014/11
334
+ $ defoker rule
335
+ $ ls -F | grep /
336
+ 201410_monthly_report/
337
+ $ defoker rule -a hoge
338
+ $ ls -F | grep /
339
+ 201410_monthly_report_hoge/
340
+ ~~~
341
+
276
342
  ## History
343
+ * version 0.0.4 : Add init/rule command for rule-output.
344
+ * version 0.0.3 : Fix typo in gemspec.
277
345
  * version 0.0.2 : Fix typo and change public interface tommorow to tomorrow.
278
346
  * version 0.0.1 : First release.
279
347
 
280
348
  ## Contributing
281
349
 
282
- 1. Fork it ( https://github.com/[my-github-username]/defoker/fork )
350
+ 1. Fork it ( https://github.com/tbpgr/defoker/fork )
283
351
  2. Create your feature branch (`git checkout -b my-new-feature`)
284
352
  3. Commit your changes (`git commit -am 'Add some feature'`)
285
353
  4. Push to the branch (`git push origin my-new-feature`)
data/bin/defoker CHANGED
@@ -1,117 +1,131 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require 'defoker_core'
5
- require 'defoker/version'
6
- require 'thor'
7
- require 'fileutils'
8
-
9
- module Defoker
10
- # = Defoker CLI
11
- class CLI < Thor
12
- class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
13
- class_option :version, type: :boolean, desc: 'version'
14
-
15
- option :additional, aliases: 'a'
16
- desc 'today', 'create today folder. ex) 20140912, 20140912_hoge'
17
- def today
18
- defoker_core_single_caller(:today)
19
- end
20
-
21
- option :additional, aliases: 'a'
22
- desc 'tomorrow', 'create tomorrow folder. ex) 20140913, 20140913_hoge'
23
- def tomorrow
24
- defoker_core_single_caller(:tomorrow)
25
- end
26
-
27
- option :additional, aliases: 'a'
28
- desc 'yesterday', 'create yesterday folder. ex) 20140911, 20140911_hoge'
29
- def yesterday
30
- defoker_core_single_caller(:yesterday)
31
- end
32
-
33
- option :count, aliases: 'c'
34
- option :additional, aliases: 'a'
35
- desc 'days', "create day folder list. ex) ['20140909','20140910','20140911','20140912'], ['20140909_hoge','20140910_hoge','20140911_hoge','20140912_hoge']"
36
- def days(date)
37
- defoker_core_multi_caller(date, :days)
38
- end
39
-
40
- option :additional, aliases: 'a'
41
- desc 'this_month', 'create this_month folder. ex) 201409, 201409_hoge'
42
- def this_month
43
- defoker_core_single_caller(:this_month)
44
- end
45
-
46
- option :additional, aliases: 'a'
47
- desc 'next_month', 'create next_month folder. ex) 201410, 201410_hoge'
48
- def next_month
49
- defoker_core_single_caller(:next_month)
50
- end
51
-
52
- option :additional, aliases: 'a'
53
- desc 'previous_month', 'create previous_month folder. ex) 201410, 201410_hoge'
54
- def previous_month
55
- defoker_core_single_caller(:previous_month)
56
- end
57
-
58
- option :count, aliases: 'c'
59
- option :additional, aliases: 'a'
60
- desc 'months', "create month folder list. ex) ['201410','201411','201412','201501'], ['201410_hoge','201411_hoge','201412_hoge','201501_hoge']"
61
- def months(date)
62
- defoker_core_multi_caller(date, :months)
63
- end
64
-
65
- option :additional, aliases: 'a'
66
- desc 'this_year', 'create this_year folder. ex) 2014, 2014_hoge'
67
- def this_year
68
- defoker_core_single_caller(:this_year)
69
- end
70
-
71
- option :additional, aliases: 'a'
72
- desc 'next_year', 'create next_year folder. ex) 2015, 2015_hoge'
73
- def next_year
74
- defoker_core_single_caller(:next_year)
75
- end
76
-
77
- option :additional, aliases: 'a'
78
- desc 'previous_year', 'create previous_year folder. ex) 2013, 2013_hoge'
79
- def previous_year
80
- defoker_core_single_caller(:previous_year)
81
- end
82
-
83
- option :count, aliases: 'c'
84
- option :additional, aliases: 'a'
85
- desc 'years', "create year folder list. ex) ['2014','2015','2016','2017'], ['2014_hoge','2015_hoge','2016_hoge','2017_hoge']"
86
- def years(date)
87
- defoker_core_multi_caller(date, :years)
88
- end
89
-
90
- desc 'version', 'version'
91
- def version
92
- p Defoker::VERSION
93
- end
94
-
95
- private
96
- def defoker_core_single_caller(method_name)
97
- additional = options[:additional] ? options[:additional] : ''
98
- dir = Defoker::Core.new.send(method_name, additional: additional)
99
- FileUtils.mkdir_p(dir)
100
- exit(true)
101
- rescue
102
- exit(false)
103
- end
104
-
105
- def defoker_core_multi_caller(date, method_name)
106
- count = options[:count] ? options[:count].to_i : 3
107
- additional = options[:additional] ? options[:additional] : ''
108
- dirs = Defoker::Core.new.send(method_name, date, count: count, additional: additional)
109
- FileUtils.mkdir_p(dirs)
110
- exit(true)
111
- rescue
112
- exit(false)
113
- end
114
- end
115
- end
116
-
117
- Defoker::CLI.start(ARGV)
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'defoker_core'
5
+ require 'defoker/version'
6
+ require 'thor'
7
+ require 'fileutils'
8
+
9
+ module Defoker
10
+ # = Defoker CLI
11
+ class CLI < Thor
12
+ class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
13
+ class_option :version, type: :boolean, desc: 'version'
14
+
15
+ desc 'init', 'generate Defokerfile template'
16
+ def init
17
+ Defoker::Core.new.init
18
+ exit(true)
19
+ rescue
20
+ exit(false)
21
+ end
22
+
23
+ option :additional, aliases: 'a'
24
+ desc 'today', 'create today folder. ex) 20140912, 20140912_hoge'
25
+ def today
26
+ defoker_core_single_caller(:today)
27
+ end
28
+
29
+ option :additional, aliases: 'a'
30
+ desc 'tomorrow', 'create tomorrow folder. ex) 20140913, 20140913_hoge'
31
+ def tomorrow
32
+ defoker_core_single_caller(:tomorrow)
33
+ end
34
+
35
+ option :additional, aliases: 'a'
36
+ desc 'yesterday', 'create yesterday folder. ex) 20140911, 20140911_hoge'
37
+ def yesterday
38
+ defoker_core_single_caller(:yesterday)
39
+ end
40
+
41
+ option :count, aliases: 'c'
42
+ option :additional, aliases: 'a'
43
+ desc 'days', "create day folder list. ex) ['20140909','20140910','20140911','20140912'], ['20140909_hoge','20140910_hoge','20140911_hoge','20140912_hoge']"
44
+ def days(date)
45
+ defoker_core_multi_caller(date, :days)
46
+ end
47
+
48
+ option :additional, aliases: 'a'
49
+ desc 'this_month', 'create this_month folder. ex) 201409, 201409_hoge'
50
+ def this_month
51
+ defoker_core_single_caller(:this_month)
52
+ end
53
+
54
+ option :additional, aliases: 'a'
55
+ desc 'next_month', 'create next_month folder. ex) 201410, 201410_hoge'
56
+ def next_month
57
+ defoker_core_single_caller(:next_month)
58
+ end
59
+
60
+ option :additional, aliases: 'a'
61
+ desc 'previous_month', 'create previous_month folder. ex) 201410, 201410_hoge'
62
+ def previous_month
63
+ defoker_core_single_caller(:previous_month)
64
+ end
65
+
66
+ option :count, aliases: 'c'
67
+ option :additional, aliases: 'a'
68
+ desc 'months', "create month folder list. ex) ['201410','201411','201412','201501'], ['201410_hoge','201411_hoge','201412_hoge','201501_hoge']"
69
+ def months(date)
70
+ defoker_core_multi_caller(date, :months)
71
+ end
72
+
73
+ option :additional, aliases: 'a'
74
+ desc 'this_year', 'create this_year folder. ex) 2014, 2014_hoge'
75
+ def this_year
76
+ defoker_core_single_caller(:this_year)
77
+ end
78
+
79
+ option :additional, aliases: 'a'
80
+ desc 'next_year', 'create next_year folder. ex) 2015, 2015_hoge'
81
+ def next_year
82
+ defoker_core_single_caller(:next_year)
83
+ end
84
+
85
+ option :additional, aliases: 'a'
86
+ desc 'previous_year', 'create previous_year folder. ex) 2013, 2013_hoge'
87
+ def previous_year
88
+ defoker_core_single_caller(:previous_year)
89
+ end
90
+
91
+ option :count, aliases: 'c'
92
+ option :additional, aliases: 'a'
93
+ desc 'years', "create year folder list. ex) ['2014','2015','2016','2017'], ['2014_hoge','2015_hoge','2016_hoge','2017_hoge']"
94
+ def years(date)
95
+ defoker_core_multi_caller(date, :years)
96
+ end
97
+
98
+ option :additional, aliases: 'a'
99
+ desc 'rule', 'create folder by Defokerfile''s rule.'
100
+ def rule
101
+ defoker_core_single_caller(:rule)
102
+ end
103
+
104
+ desc 'version', 'version'
105
+ def version
106
+ p Defoker::VERSION
107
+ end
108
+
109
+ private
110
+ def defoker_core_single_caller(method_name)
111
+ additional = options[:additional] ? options[:additional] : ''
112
+ dir = Defoker::Core.new.send(method_name, additional: additional)
113
+ FileUtils.mkdir_p(dir)
114
+ exit(true)
115
+ rescue
116
+ exit(false)
117
+ end
118
+
119
+ def defoker_core_multi_caller(date, method_name)
120
+ count = options[:count] ? options[:count].to_i : 3
121
+ additional = options[:additional] ? options[:additional] : ''
122
+ dirs = Defoker::Core.new.send(method_name, date, count: count, additional: additional)
123
+ FileUtils.mkdir_p(dirs)
124
+ exit(true)
125
+ rescue
126
+ exit(false)
127
+ end
128
+ end
129
+ end
130
+
131
+ Defoker::CLI.start(ARGV)
data/defoker.gemspec CHANGED
@@ -1,25 +1,25 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'defoker/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'defoker'
8
- spec.version = Defoker::VERSION
9
- spec.authors = ['tbpgr']
10
- spec.email = ['tbpgr@tbpgr.jp']
11
- spec.summary = %q(Create various kind of date-base format named folders.)
12
- spec.description = %q(Create various kind of date-base format named folders.)
13
- spec.homepage = 'https://github.com/tbpgr/defoker'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_development_dependency 'bundler', '~> 1.6'
22
- spec.add_development_dependency 'rake', '~> 10.0'
23
- spec.add_development_dependency 'yard'
24
- spec.add_development_dependency 'timecop'
25
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'defoker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'defoker'
8
+ spec.version = Defoker::VERSION
9
+ spec.authors = ['tbpgr']
10
+ spec.email = ['tbpgr@tbpgr.jp']
11
+ spec.summary = 'Create various kind of date-base format named folders.'
12
+ spec.description = 'Create various kind of date-base format named folders.'
13
+ spec.homepage = 'https://github.com/tbpgr/defoker'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'yard'
24
+ spec.add_development_dependency 'timecop'
25
+ end
data/images/defoker.gif CHANGED
Binary file