tinypress 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/tinypress +5 -0
- data/lib/tinypress.rb +59 -0
- data/lib/tinypress/cli.rb +21 -0
- data/lib/tinypress/config.rb +5 -0
- data/lib/tinypress/post.rb +33 -0
- data/lib/tinypress/site.rb +31 -0
- data/lib/tinypress/version.rb +3 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b6bfb136ff4d7540430e3b2eb8db255ef7b1c1a
|
4
|
+
data.tar.gz: 95f25e6e55852358dda976a4be9831c2ad380627
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8bc22432441bfa6d2c734d013cefce6ae3e3f9e34fd31257b8f40067791bc013ab7ed2e0974fc705bebd4708141b7a0e97ae96f380854d7fcd793792e94c722f
|
7
|
+
data.tar.gz: 7c47d55a1bbdcd0e757eefc91b7aafa35f1599fc9a3615d730310a58b917311a2b51190fc3ab002ff9803a3cb3d5a1f0997ad4e0638bdd9b601295b87449b00a
|
data/bin/tinypress
ADDED
data/lib/tinypress.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Add tinypress's lib into the load path
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
3
|
+
|
4
|
+
# Load external dependencies
|
5
|
+
begin
|
6
|
+
# Nice CLI interface toolkit
|
7
|
+
require 'thor'
|
8
|
+
|
9
|
+
# A better ERB
|
10
|
+
require 'erubis'
|
11
|
+
|
12
|
+
# Manipulating filesystem via Ruby
|
13
|
+
require 'fileutils'
|
14
|
+
|
15
|
+
# YAML file support
|
16
|
+
require 'yaml'
|
17
|
+
|
18
|
+
# Pretty output
|
19
|
+
require 'colorize'
|
20
|
+
|
21
|
+
rescue LoadError => e
|
22
|
+
puts "Oops. Looks like you're missing the '#{e.path}' gem."
|
23
|
+
puts "Try running 'bundle install' to resolve this."
|
24
|
+
exit(1)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Load TinyPress components
|
28
|
+
require 'tinypress/post'
|
29
|
+
require 'tinypress/site'
|
30
|
+
|
31
|
+
module TinyPress
|
32
|
+
class Main < Thor
|
33
|
+
|
34
|
+
desc "establish", "Generates a TinyPress blog in the current directory"
|
35
|
+
def establish
|
36
|
+
begin
|
37
|
+
TinyPress::Site.generate
|
38
|
+
rescue Exception => e
|
39
|
+
abort_with_message( e.message )
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "publish", "Publishes content/ using provided templates/ to generate published/"
|
44
|
+
def publish
|
45
|
+
begin
|
46
|
+
TinyPress::Site.publish
|
47
|
+
rescue Exception => e
|
48
|
+
abort_with_message( e.message )
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
no_commands do
|
53
|
+
def abort_with_message( message )
|
54
|
+
puts message
|
55
|
+
exit(1)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TinyPress
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
no_commands do
|
5
|
+
def self.setup(command_handlers)
|
6
|
+
@@command_handlers = command_handlers
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "establish", "Generates a TinyPress blog in the current directory"
|
11
|
+
def establish
|
12
|
+
@@command_handlers[:establish].call()
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "publish", "Publishes content/ using provided templates/ to generate published/"
|
16
|
+
def publish
|
17
|
+
@@command_handlers[:publish].call()
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module TinyPress
|
2
|
+
class Post
|
3
|
+
attr_reader :title, :description, :date, :publish, :body
|
4
|
+
|
5
|
+
# Public: Create a new instance of Post.
|
6
|
+
#
|
7
|
+
# title - A String that represents the Post's title.
|
8
|
+
# description - A short String description of the Post.
|
9
|
+
# date - A Date object that indicates when this Post was written.
|
10
|
+
# publish - A Boolean value indicating if this post should be published
|
11
|
+
# body - A String representing the body of the post
|
12
|
+
#
|
13
|
+
# Returns an instance of Post.
|
14
|
+
def initialize( title, description, date, publish, body )
|
15
|
+
@title = title
|
16
|
+
@description = description
|
17
|
+
@date = date
|
18
|
+
@publish = publish
|
19
|
+
@body = body
|
20
|
+
end
|
21
|
+
|
22
|
+
# Public: Indicates if this Post should be published.
|
23
|
+
#
|
24
|
+
# Examples
|
25
|
+
#
|
26
|
+
# print post if post.publish?
|
27
|
+
#
|
28
|
+
# Returns true if this Post should be published, otherwise returns false.
|
29
|
+
def publish?
|
30
|
+
@publish
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TinyPress
|
2
|
+
class Site
|
3
|
+
def self.generate
|
4
|
+
if self.site_exists?
|
5
|
+
raise "Whoops! Looks like there's TinyPress site at this location already.".red
|
6
|
+
else
|
7
|
+
%x( touch .tinypressrc )
|
8
|
+
end
|
9
|
+
puts "Established a new TinyPress site.".green
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.publish
|
13
|
+
self.abort_unless_site_exists
|
14
|
+
|
15
|
+
puts "Published whole site.".green
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.site_exists?
|
19
|
+
File.exists?('.tinypressrc')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.abort_unless_site_exists
|
23
|
+
unless site_exists?
|
24
|
+
message = ""
|
25
|
+
message += "Cannot find a TinyPress install at this location.\n".red
|
26
|
+
message += "You can try setting up a new site with 'tinypress establish' to resolve this.\n".red
|
27
|
+
raise message
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tinypress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vidur Murali
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: erubis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
description: My version of a tiny blogging platform. Powers http://vidur.io/writes
|
56
|
+
email:
|
57
|
+
- vidur.murali@gmail.com
|
58
|
+
executables:
|
59
|
+
- tinypress
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- lib/tinypress/cli.rb
|
64
|
+
- lib/tinypress/config.rb
|
65
|
+
- lib/tinypress/post.rb
|
66
|
+
- lib/tinypress/site.rb
|
67
|
+
- lib/tinypress/version.rb
|
68
|
+
- lib/tinypress.rb
|
69
|
+
- bin/tinypress
|
70
|
+
homepage: http://github.com/vyder/tinypress
|
71
|
+
licenses:
|
72
|
+
- LICENSE
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.3.6
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.0.3
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: A tiny static blog generator
|
94
|
+
test_files: []
|