jklpost 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/jklpost +7 -0
  3. data/lib/jklpost.rb +32 -0
  4. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8811456837ceb87054540cc40cb8ff9757efdc7
4
+ data.tar.gz: ea64d7e8dce86bd330a538b57685ac82c8d4980f
5
+ SHA512:
6
+ metadata.gz: f6481e26c6ec78378084d7a2b9005b2219c82762b8f9075cff6496a1058764c8cded9233235d688af849fe4f2c4f99ce87a2f52810211bc07e387593f93a0eb7
7
+ data.tar.gz: 202c69acf08c03bddd5839997da852d8f988c82ac34f90becfcb1c2da60f60b7c6c5c6319a3c9acdd8c9fd1d2ded66067a772d2483b47dc191cf04c6c57512ef
data/bin/jklpost ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require 'jklpost'
3
+
4
+ jklpost = Jklpost.new
5
+ jklpost.run
6
+ jklpost.showDoneMsg
7
+
data/lib/jklpost.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'date'
2
+
3
+ class Jklpost
4
+
5
+ def initialize
6
+ abort("Error! Too much arguments! Usage: jklpost <filename> [options].") if ARGV.length > 2
7
+ @title = "post"
8
+ @layout = "default"
9
+ @date = Date.today.to_s
10
+ @timeStamp = Time.now.strftime "%H%M%S"
11
+
12
+ @title = ARGV[0] if ARGV.length == 1
13
+ @layout = ARGV[1] if ARGV.length == 2
14
+ @filename = @date.to_s + "-" + @title.to_s + "-" + @timeStamp.to_s + ".md"
15
+ end
16
+
17
+ def run
18
+ File.open(@filename.to_s,"w"){|file|
19
+ file.puts("---")
20
+ file.puts("layout: #{@layout}")
21
+ file.puts("title: \"#{@title}\"")
22
+ file.puts("date: #{Time.now.strftime "%Y-%m-%d %H:%M:%S"}")
23
+ file.puts("---")
24
+ }
25
+ end
26
+
27
+ def showDoneMsg
28
+ puts "Successful! #{@filename.to_s} is created."
29
+ end
30
+
31
+ end
32
+
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jklpost
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sirius Wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A gem for jekyll.
14
+ email: larrywhy.tw@gmail.com
15
+ executables:
16
+ - jklpost
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/jklpost
21
+ - lib/jklpost.rb
22
+ homepage: http://rubygems.org/gems/jklpost
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.4.2
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: A simple ruby program for automatically create the _post file in jekyll!
46
+ test_files: []