diary 0.2.0 → 0.2.1
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/lib/diary/cli/commands/init.rb +17 -0
- data/lib/diary/cli/parser.rb +7 -2
- data/lib/diary/version.rb +1 -1
- metadata +3 -3
@@ -10,10 +10,27 @@ module Diary
|
|
10
10
|
# Create files
|
11
11
|
create_file "templates/index.html.erb", "<%= content %>"
|
12
12
|
create_file "config.yml", "sync:\n user: \n server: \n path: \n"
|
13
|
+
|
14
|
+
unless File.exists?(".git")
|
15
|
+
if options.git
|
16
|
+
Diary.message :git, "Initial commit", :magenta
|
17
|
+
init_git!
|
18
|
+
else
|
19
|
+
Diary.message :skip, "git init", :red
|
20
|
+
end
|
21
|
+
else
|
22
|
+
Diary.message :git, "Already a git repository", :yellow
|
23
|
+
end
|
13
24
|
end
|
14
25
|
|
15
26
|
private
|
16
27
|
|
28
|
+
def init_git!
|
29
|
+
`git init`
|
30
|
+
`git add .`
|
31
|
+
`git commit -m "Initial commit"`
|
32
|
+
end
|
33
|
+
|
17
34
|
def create_dir(path)
|
18
35
|
unless File.exists?(path)
|
19
36
|
FileUtils.mkdir_p(path)
|
data/lib/diary/cli/parser.rb
CHANGED
@@ -6,14 +6,19 @@ module Diary
|
|
6
6
|
def parse(args)
|
7
7
|
options = OpenStruct.new
|
8
8
|
options.force = false
|
9
|
+
options.git = true
|
9
10
|
|
10
11
|
opts = OptionParser.new do |opts|
|
11
12
|
opts.banner = "Usage: diary ACTION [-vf]"
|
12
13
|
|
13
14
|
opts.separator "\nSpecific options:"
|
14
15
|
|
15
|
-
opts.on("-f", "--[no-]force", "Force all items to compile") do |
|
16
|
-
options.force =
|
16
|
+
opts.on("-f", "--[no-]force", "Force all items to compile") do |force|
|
17
|
+
options.force = force
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-g", "--[no-]git", "Git init the repository.") do |git|
|
21
|
+
options.git = git
|
17
22
|
end
|
18
23
|
|
19
24
|
opts.separator "\nCommon options:"
|
data/lib/diary/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Robin Clart
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-05 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|