statikaj 0.0.1 → 0.0.2
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/CHANGELOG.md +15 -0
- data/README.md +14 -2
- data/lib/statikaj/cli.rb +28 -9
- data/lib/statikaj/version.rb +1 -1
- metadata +5 -4
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Statikaj <a href='https://gemnasium.com/dukex/statikaj'><img src="https://gemnasium.com/dukex/statikaj.png" alt="Dependency Status" /></a>
|
2
2
|
|
3
|
-
|
3
|
+
Simple static blog tools,
|
4
|
+
|
5
|
+
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -16,15 +18,25 @@ Or install it yourself as:
|
|
16
18
|
|
17
19
|
$ gem install statikaj
|
18
20
|
|
19
|
-
##
|
21
|
+
## Install
|
20
22
|
|
21
23
|
$ statikaj new myblog
|
22
24
|
$ cd myblog
|
23
25
|
$ statikaj build
|
24
26
|
$ rackup -p 3000
|
27
|
+
|
28
|
+
## Create a article
|
29
|
+
TODO
|
30
|
+
|
31
|
+
## Costum design
|
32
|
+
TODO
|
25
33
|
|
26
34
|
Your static blog is running on http://localhost:3000
|
27
35
|
|
36
|
+
## How use?
|
37
|
+
|
38
|
+
* [Apartamento131](https://github.com/dukex/apartamento131)
|
39
|
+
|
28
40
|
## Contributing
|
29
41
|
|
30
42
|
1. Fork it
|
data/lib/statikaj/cli.rb
CHANGED
@@ -8,10 +8,6 @@ module Statikaj
|
|
8
8
|
class CLI < Thor
|
9
9
|
include Thor::Actions
|
10
10
|
|
11
|
-
def self.source_root
|
12
|
-
File.expand_path('../../..', __FILE__)
|
13
|
-
end
|
14
|
-
|
15
11
|
desc 'new', 'Create a new project'
|
16
12
|
def new(name)
|
17
13
|
directory('templates', name)
|
@@ -33,7 +29,7 @@ module Statikaj
|
|
33
29
|
articles = articles_files.map{|f| Article.new(f) }
|
34
30
|
|
35
31
|
articles.each do |article|
|
36
|
-
|
32
|
+
say "Saving: #{article.slug}", :green
|
37
33
|
article_file = destination.join("#{article.slug}").to_s
|
38
34
|
|
39
35
|
render = Render.new(source, article: article)
|
@@ -43,18 +39,41 @@ module Statikaj
|
|
43
39
|
end
|
44
40
|
|
45
41
|
#unless File.exists?(article_file)
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
file = File.new(article_file, "w+")
|
43
|
+
file.puts content
|
44
|
+
file.close
|
49
45
|
#end
|
50
46
|
end
|
51
47
|
|
52
|
-
|
48
|
+
say "Creating index.html", :green
|
53
49
|
render = Render.new(source, page: 'index', articles: articles.reverse)
|
54
50
|
content = render.page {}
|
55
51
|
file = File.new(destination.join("index.html"), "w+")
|
56
52
|
file.puts content
|
57
53
|
file.close
|
58
54
|
end
|
55
|
+
|
56
|
+
desc "article", "Create new article"
|
57
|
+
def article
|
58
|
+
title = ask('Title: ')
|
59
|
+
slug = title.empty?? nil : title.strip.slugize
|
60
|
+
|
61
|
+
article = {'title' => title, 'date' => Time.now.strftime("%d/%m/%Y"), 'author' => 'User'}.to_yaml
|
62
|
+
article << "\n"
|
63
|
+
article << "Once upon a time...\n\n"
|
64
|
+
path = "src/articles/#{Time.now.strftime("%Y-%m-%d")}#{'-' + slug if slug}.md"
|
65
|
+
unless File.exist? path
|
66
|
+
begin
|
67
|
+
File.open(path, "w") do |file|
|
68
|
+
file.write article
|
69
|
+
end
|
70
|
+
say "An article was created for you at #{path}.", :green
|
71
|
+
rescue
|
72
|
+
say "Impossible to create #{path}, make sure you are in project root", :red
|
73
|
+
end
|
74
|
+
else
|
75
|
+
say "I can't create the article, #{path} already exists.", :red
|
76
|
+
end
|
77
|
+
end
|
59
78
|
end
|
60
79
|
end
|
data/lib/statikaj/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statikaj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- .gitignore
|
119
|
+
- CHANGELOG.md
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE.txt
|
121
122
|
- README.md
|
@@ -151,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
152
|
version: '0'
|
152
153
|
segments:
|
153
154
|
- 0
|
154
|
-
hash: -
|
155
|
+
hash: -1496453532116018902
|
155
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
157
|
none: false
|
157
158
|
requirements:
|
@@ -160,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
161
|
version: '0'
|
161
162
|
segments:
|
162
163
|
- 0
|
163
|
-
hash: -
|
164
|
+
hash: -1496453532116018902
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
167
|
rubygems_version: 1.8.23
|