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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9047644a50882744efda44377321c2be4df43be2
4
- data.tar.gz: 3c7193b4ecb93088b667dd7fa6ca29a65e570f3c
3
+ metadata.gz: 8be63e9fba7391d602c88dff0a3e40894f96afb2
4
+ data.tar.gz: 111bc8a77e5623856a1fb4c1621dfbe1d5a89299
5
5
  SHA512:
6
- metadata.gz: 065ee630a13cfe1def62b6d138cc3bed10575b722c8c4ed74a30f5ba0c8896e47d612b433a63d03be6934502449689218205515bb312cb3ec410bd2a89cd875e
7
- data.tar.gz: ee3fbdcd8be70c72a979142783726bfcade20f433b913ec3558a0294e17f2093450d4e99730c1b4d7c297244823eea0bdfd66df2245802592a8f0ed830c0730c
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
@@ -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: Scaffold
6
- When I run "kia create test"
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
@@ -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: New post with no site
6
- When I run "kia post test"
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
@@ -0,0 +1,5 @@
1
+ Given(/^I have a kia project named "(.*?)"$/) do |name|
2
+ # ALL of this gets run inside tmp/aruba.
3
+ step %Q{I run `kia create #{name}`}
4
+ step %Q{I cd to "#{name}"}
5
+ end
@@ -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 "stasis"
23
- spec.add_dependency "redcarpet"
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
@@ -15,12 +15,29 @@ module Kia
15
15
 
16
16
  desc "kia post NAME", "Create a new post"
17
17
  def post(name)
18
- Kia::Commands::Post.start([name])
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
- Kia::Commands::Build.start
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
@@ -1,12 +1,30 @@
1
1
  require "thor/group"
2
- require "stasis"
2
+ require "tilt"
3
3
 
4
4
  module Kia
5
5
  module Commands
6
6
  class Build < Thor::Group
7
7
 
8
- def compile_site
9
- system "stasis"
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
@@ -7,12 +7,12 @@ module Kia
7
7
 
8
8
  argument :name, type: :string
9
9
 
10
- def create_site
11
- FileUtils.cp_r Kia::Commands::Create.site_template, "./#{name}"
10
+ def self.template_path
11
+ File.expand_path "../../../templates/site", File.dirname(__FILE__)
12
12
  end
13
13
 
14
- def self.site_template
15
- File.expand_path "../../../templates/site", File.dirname(__FILE__)
14
+ def create_site
15
+ FileUtils.cp_r Kia::Commands::Create.template_path, "./#{name}"
16
16
  end
17
17
  end
18
18
  end
@@ -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
- if File.directory?("_posts")
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
@@ -0,0 +1,12 @@
1
+ require "thor/group"
2
+
3
+ module Kia
4
+ module Commands
5
+ class Serve < Thor::Group
6
+
7
+ def begin
8
+ system 'rackup'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Kia
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1 @@
1
+ # New post
@@ -0,0 +1,12 @@
1
+ use Rack::Static, :root => "public"
2
+
3
+ run lambda { |env|
4
+ [
5
+ 200,
6
+ {
7
+ 'Content-Type' => 'text/html',
8
+ 'Cache-Control' => 'public, max-age=86400'
9
+ },
10
+ File.open('public/index.html', File::RDONLY)
11
+ ]
12
+ }
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.1
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-19 00:00:00.000000000 Z
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: stasis
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: redcarpet
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/new_post.md
136
- - templates/site/index.html.erb
137
- - templates/site/posts/readme.html.md
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
@@ -1,3 +0,0 @@
1
- ====
2
- Hello
3
- ====
@@ -1 +0,0 @@
1
- ##### Test #####