kia 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/cli/build.feature +12 -0
- data/features/cli/create.feature +3 -3
- data/features/cli/post.feature +7 -2
- data/features/step_definitions/cli_steps.rb +5 -0
- data/kia.gemspec +3 -2
- data/lib/kia/cli.rb +19 -2
- data/lib/kia/commands/build.rb +21 -3
- data/lib/kia/commands/create.rb +4 -4
- data/lib/kia/commands/post.rb +2 -6
- data/lib/kia/commands/serve.rb +12 -0
- data/lib/kia/version.rb +1 -1
- data/templates/files/post.html.md +1 -0
- data/templates/site/config.ru +12 -0
- data/templates/site/public/.keep +0 -0
- data/templates/site/{index.html.erb → source/index.html.erb} +0 -0
- data/templates/site/source/posts/.keep +0 -0
- metadata +28 -7
- data/templates/new_post.md +0 -3
- data/templates/site/posts/readme.html.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8be63e9fba7391d602c88dff0a3e40894f96afb2
|
4
|
+
data.tar.gz: 111bc8a77e5623856a1fb4c1621dfbe1d5a89299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7b0ffeae470a7732aa3d7c21f1615ad416dafe5556a4db7982e30418d1295d3f39481c7dc152cb3ed2b7e49ecadcc448e345b981cc2597f5a0e61d6a8c125a4
|
7
|
+
data.tar.gz: 3cee1a5a28de2d77b8675f08bec133d815a22cfa153f29610c96e4668861ac3c0070e5628194292422fcd1b6a383f2e535f66455ca63106471efebafa9d34f28
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Building a static site
|
2
|
+
In order to serve a site
|
3
|
+
I want to render templates
|
4
|
+
|
5
|
+
Scenario: Outside a Kia project
|
6
|
+
When I run `kia build`
|
7
|
+
Then the output should contain "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
8
|
+
|
9
|
+
Scenario: Inside a Kia project
|
10
|
+
Given I have a kia project named "test_build"
|
11
|
+
When I run `kia build`
|
12
|
+
Then a file named "public/index.html" should exist
|
data/features/cli/create.feature
CHANGED
@@ -2,7 +2,7 @@ Feature: Creating a new project
|
|
2
2
|
In order to create a Kia project
|
3
3
|
I want an easy to use CLI
|
4
4
|
|
5
|
-
Scenario:
|
6
|
-
When I run
|
5
|
+
Scenario: With a name argument
|
6
|
+
When I run `kia create test`
|
7
7
|
Then a directory named "test" should exist
|
8
|
-
Then a file named "test/index.html.erb" should exist
|
8
|
+
Then a file named "test/source/index.html.erb" should exist
|
data/features/cli/post.feature
CHANGED
@@ -2,6 +2,11 @@ Feature: Creating a new post
|
|
2
2
|
In order to create new posts
|
3
3
|
I want an easy to use CLI
|
4
4
|
|
5
|
-
Scenario:
|
6
|
-
When I run
|
5
|
+
Scenario: Outside a Kia project
|
6
|
+
When I run `kia post test`
|
7
7
|
Then the output should contain "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
8
|
+
|
9
|
+
Scenario: Inside a Kia project
|
10
|
+
Given I have a kia project named "test"
|
11
|
+
When I run `kia post test`
|
12
|
+
Then a file named "source/posts/test.html.md" should exist
|
data/kia.gemspec
CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "thor"
|
22
|
-
spec.add_dependency "
|
23
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "rack"
|
23
|
+
spec.add_dependency "tilt"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "cucumber"
|
28
28
|
spec.add_development_dependency "aruba"
|
29
|
+
spec.add_development_dependency "debugger"
|
29
30
|
end
|
data/lib/kia/cli.rb
CHANGED
@@ -15,12 +15,29 @@ module Kia
|
|
15
15
|
|
16
16
|
desc "kia post NAME", "Create a new post"
|
17
17
|
def post(name)
|
18
|
-
|
18
|
+
if File.exist?("config.ru")
|
19
|
+
Kia::Commands::Post.start([name])
|
20
|
+
else
|
21
|
+
puts "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
desc "kia build", "Generate a static site"
|
22
26
|
def build
|
23
|
-
|
27
|
+
if File.exist?("config.ru")
|
28
|
+
Kia::Commands::Build.start
|
29
|
+
else
|
30
|
+
puts "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "kia serve", "Serve a static site"
|
35
|
+
def build
|
36
|
+
if File.exist?("config.ru")
|
37
|
+
Kia::Commands::Serve.start
|
38
|
+
else
|
39
|
+
puts "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
40
|
+
end
|
24
41
|
end
|
25
42
|
end
|
26
43
|
end
|
data/lib/kia/commands/build.rb
CHANGED
@@ -1,12 +1,30 @@
|
|
1
1
|
require "thor/group"
|
2
|
-
require "
|
2
|
+
require "tilt"
|
3
3
|
|
4
4
|
module Kia
|
5
5
|
module Commands
|
6
6
|
class Build < Thor::Group
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
attr_accessor :templates
|
9
|
+
|
10
|
+
def compile
|
11
|
+
@templates = []
|
12
|
+
|
13
|
+
files = Dir.glob(["**/source/*.erb"])
|
14
|
+
|
15
|
+
files.each do |file|
|
16
|
+
@templates << Tilt.new(file)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def output
|
21
|
+
@templates.each do |template|
|
22
|
+
template.file.gsub!("source", "public").gsub!(".erb", "")
|
23
|
+
|
24
|
+
File.open(template.file, "w") do |file|
|
25
|
+
file.write(template.render)
|
26
|
+
end
|
27
|
+
end
|
10
28
|
end
|
11
29
|
end
|
12
30
|
end
|
data/lib/kia/commands/create.rb
CHANGED
@@ -7,12 +7,12 @@ module Kia
|
|
7
7
|
|
8
8
|
argument :name, type: :string
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def self.template_path
|
11
|
+
File.expand_path "../../../templates/site", File.dirname(__FILE__)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def create_site
|
15
|
+
FileUtils.cp_r Kia::Commands::Create.template_path, "./#{name}"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/kia/commands/post.rb
CHANGED
@@ -8,15 +8,11 @@ module Kia
|
|
8
8
|
argument :name, type: :string
|
9
9
|
|
10
10
|
def self.source_root
|
11
|
-
File.expand_path "../../../templates/", File.dirname(__FILE__)
|
11
|
+
File.expand_path "../../../templates/files/", File.dirname(__FILE__)
|
12
12
|
end
|
13
13
|
|
14
14
|
def copy_template
|
15
|
-
|
16
|
-
template "new_post.md", "_posts/#{name}.md"
|
17
|
-
else
|
18
|
-
puts "Hold on mate, you'll need to initialize a Kia project (kia init NAME) to be able to make posts."
|
19
|
-
end
|
15
|
+
template "post.html.md", "source/posts/#{name}.html.md"
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
data/lib/kia/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
# New post
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Callister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: tilt
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '>='
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: debugger
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: A static site generator
|
112
126
|
email:
|
113
127
|
- jarsbe@gmail.com
|
@@ -122,8 +136,10 @@ files:
|
|
122
136
|
- README.md
|
123
137
|
- Rakefile
|
124
138
|
- bin/kia
|
139
|
+
- features/cli/build.feature
|
125
140
|
- features/cli/create.feature
|
126
141
|
- features/cli/post.feature
|
142
|
+
- features/step_definitions/cli_steps.rb
|
127
143
|
- features/support/setup.rb
|
128
144
|
- kia.gemspec
|
129
145
|
- lib/kia.rb
|
@@ -131,10 +147,13 @@ files:
|
|
131
147
|
- lib/kia/commands/build.rb
|
132
148
|
- lib/kia/commands/create.rb
|
133
149
|
- lib/kia/commands/post.rb
|
150
|
+
- lib/kia/commands/serve.rb
|
134
151
|
- lib/kia/version.rb
|
135
|
-
- templates/
|
136
|
-
- templates/site/
|
137
|
-
- templates/site/
|
152
|
+
- templates/files/post.html.md
|
153
|
+
- templates/site/config.ru
|
154
|
+
- templates/site/public/.keep
|
155
|
+
- templates/site/source/index.html.erb
|
156
|
+
- templates/site/source/posts/.keep
|
138
157
|
homepage: ''
|
139
158
|
licenses:
|
140
159
|
- MIT
|
@@ -160,6 +179,8 @@ signing_key:
|
|
160
179
|
specification_version: 4
|
161
180
|
summary: A static site generator
|
162
181
|
test_files:
|
182
|
+
- features/cli/build.feature
|
163
183
|
- features/cli/create.feature
|
164
184
|
- features/cli/post.feature
|
185
|
+
- features/step_definitions/cli_steps.rb
|
165
186
|
- features/support/setup.rb
|
data/templates/new_post.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
##### Test #####
|