moon-diary 0.0.0 → 0.1.0

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: 321951552e96acfff71c39b18089e15f03ebcb73
4
- data.tar.gz: 3b12581dcaaf1c3d8ac398109e66f3309839829d
3
+ metadata.gz: b2cf81217b67aae685a28f441b98bc0363fdd96a
4
+ data.tar.gz: 40fb789362e43718e25bacdfbd8be6b27b16433f
5
5
  SHA512:
6
- metadata.gz: 8f3814365d9cb85d92bc5fa089b4df4a4385b93d1d881ecf981656ad0bd48eafc76419e3f027acc8c67a5f7de294493c95b47ed5b9081d2c5abaaf8be6ef3b0f
7
- data.tar.gz: 8b82253e0a478a1022ef9eb3da24decbda48990b04cb550eb35ebc33920c0e300e301ff092f11fbd968d059d8f5cb79e0eb12d4be93ffdec41f836a13e2a003f
6
+ metadata.gz: 24ee2d361f5b8e4bce5d912ed37acb8614281872ba43fdfb93ddb0ba77e8da649632ce9fa7963de2e11ecc46e1dfaadea3c5a198bd70327f9e0c8122af6311f1
7
+ data.tar.gz: 32932fd9275129024b8d22e365aacb539499ec0f60427eb6c7837fd14f4380fd8ed90e9d0c8d7e0cabfbf5f97d981aaaa099a1bfeae3549fc881d2f25aa41b83
data/README.md CHANGED
@@ -3,4 +3,14 @@ OneDay
3
3
 
4
4
  A simple command to create diary with `vim` using `oneday` in Terminal or iTerm.
5
5
 
6
+ ##Installation
7
+
8
+ ```
9
+ gem install moon-diary
10
+ ```
11
+
12
+ ##Usage
13
+
14
+ You'll need a OneDay directory to save the diarys.
15
+ The first time you run it you will be prompted for it. You can modify the directory path later by editing `~/.oneday`
6
16
 
data/file.sh ADDED
@@ -0,0 +1,33 @@
1
+ #!bin/sh
2
+ for file in ./*
3
+ do
4
+ if test -f $file
5
+ then
6
+ echo $file 是文件
7
+ fi
8
+
9
+ if test -d $file
10
+ then
11
+ for subFile in $file/*
12
+ do
13
+ echo $subFile
14
+ filename=`basename $subFile`
15
+ echo "$filename"
16
+ year=`echo $filename | awk '{split($0,a,"-"); print a[1]}'` # = 12
17
+ month=`echo $filename | awk '{split($0,a,"-"); print a[2]}'` # = 12
18
+
19
+ if [[ "$month" -le 10 ]]; then
20
+ month=0$month
21
+ fi
22
+ Tmpday=`echo $filename | awk '{split($0,a,"-"); print a[3]}'` # = 56
23
+ day=`echo $Tmpday | awk '{split($0,a,"."); print a[1]}'`
24
+
25
+ if [[ "$day" -le 10 ]]; then
26
+ day=0$day
27
+ fi
28
+ echo "$day/$month/$year"
29
+ dayone -d="$month/$day/$year" -s=true new < $subFile
30
+ done
31
+ echo $file 是目录
32
+ fi
33
+ done
@@ -9,10 +9,12 @@ module DiaryEditor
9
9
  CONFIGURATION_FILE = File.expand_path("~/.oneday")
10
10
  attr_accessor :configuration
11
11
  def initialize(*args, opts)
12
- time = Time.new
13
- @day = time.day
14
- @month = time.month
15
- @year = time.year
12
+ @day = Time.now.strftime("%d")
13
+ @month = Time.now.strftime("%m")
14
+ @year = Time.now.strftime("%Y")
15
+
16
+ say "#{@day}"
17
+ say "#{@month}"
16
18
  end
17
19
 
18
20
  def run
@@ -50,7 +52,7 @@ module DiaryEditor
50
52
 
51
53
  def save_to_dayone(file_path)
52
54
  if (which("dayone"))
53
- cmd = ["dayone", 'new <', file_path].join(' ')
55
+ cmd = ["dayone -d=#{@day}/#{@month}/#{@year}",'-s=true new <', file_path].join(' ')
54
56
  system(cmd) or raise SystemCallError, "`#{cmd}` gave exit status: #{$?.exitstatus}"
55
57
  else
56
58
  say "if you want to save to dayone, you can visit http://dayoneapp.com/tools/cli-man/"
@@ -1,3 +1,3 @@
1
1
  module MoonDiary
2
- VERSION = "0.0.0"
2
+ VERSION = "0.1.0"
3
3
  end
data/moon-diary.gemspec CHANGED
@@ -7,7 +7,7 @@ require "moon-diary/version"
7
7
  Gem::Specification.new do |gem|
8
8
 
9
9
  gem.name = 'moon-diary'
10
- gem.version = '0.0.0'
10
+ gem.version = MoonDiary::VERSION
11
11
  gem.date = '2014-06-26'
12
12
  gem.summary = "a simple diary command"
13
13
  gem.description = "a simple diary command !"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moon-diary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sheldon huang
@@ -21,6 +21,7 @@ files:
21
21
  - LICENSE
22
22
  - README.md
23
23
  - bin/oneday
24
+ - file.sh
24
25
  - lib/moon-diary.rb
25
26
  - lib/moon-diary/editor.rb
26
27
  - lib/moon-diary/version.rb