cg 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/cg.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cg}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tomohiro, TAIRA"]
@@ -31,7 +31,9 @@ Gem::Specification.new do |s|
31
31
  "lib/cg/rebuild.rb",
32
32
  "lib/cg/scratch.rb",
33
33
  "lib/contents_generator.rb",
34
+ "skel/.exclude",
34
35
  "skel/images/please_puts_image_here",
36
+ "skel/markdown/.htaccess",
35
37
  "skel/markdown/index.mkd",
36
38
  "skel/scripts/create-elements.js",
37
39
  "skel/scripts/disqus.js",
@@ -40,6 +42,7 @@ Gem::Specification.new do |s|
40
42
  "skel/styles/fonts-min.css",
41
43
  "skel/styles/iphone.css",
42
44
  "skel/styles/reset-min.css",
45
+ "skel/templates/.htaccess",
43
46
  "skel/templates/disqus.rb",
44
47
  "skel/templates/html.rb",
45
48
  "spec/cg_spec.rb",
data/lib/cg/convert.rb CHANGED
@@ -29,11 +29,13 @@ module CG
29
29
  dir_path, html_name = gen_output_path(@source)
30
30
  mkdir_p dir_path
31
31
 
32
- open(File.join(dir_path, html_name), 'w') do |f|
32
+ html_path = File.join(dir_path, html_name)
33
+ open(html_path, 'w') do |f|
33
34
  @article = article_rendering(load_markdown(@source))
34
35
  @relative = relative_path(dir_path)
35
36
 
36
37
  f.write page_build(load_template)
38
+ puts "#{@source} => #{html_path}"
37
39
  end
38
40
  end
39
41
 
data/lib/cg/rebuild.rb CHANGED
@@ -7,6 +7,7 @@ require 'convert'
7
7
  module CG
8
8
  class Rebuild
9
9
  def initialize
10
+ @packaging = ARGV.first || false
10
11
  end
11
12
 
12
13
  def self.start!
@@ -14,10 +15,31 @@ module CG
14
15
  end
15
16
 
16
17
  def start
18
+ display 'Rebuild Start.'
19
+ begin
20
+ convert_all
21
+ packaging if @packaging == 'packing'
22
+ rescue
23
+ display 'Rebuild Faild.'
24
+ end
25
+ display 'Rebuild Success.'
26
+ end
27
+
28
+ def convert_all
17
29
  Dir.glob('markdown/*.mkd').each do |file|
18
30
  CG::Convert.start! file
19
31
  end
20
32
  end
33
+
34
+ def packaging
35
+ display ' Packing Start.'
36
+ display `tar zcvf public.tar.gz -X .exclude *`
37
+ display ' Packing End.'
38
+ end
39
+
40
+ def display(message)
41
+ puts "#{message} #{Time.now.to_s}"
42
+ end
21
43
  end
22
44
  end
23
45
 
data/lib/cg/scratch.rb CHANGED
@@ -20,6 +20,7 @@ module CG
20
20
  mkdir(@site) unless dir_exists?(@site)
21
21
  cd(@site) do |dir|
22
22
  cp_r(Dir.glob(SKEL_PATH + '/*'), './')
23
+ cp_r(Dir.glob(SKEL_PATH + '/.*'), './')
23
24
  end
24
25
  end
25
26
 
data/skel/.exclude ADDED
@@ -0,0 +1,4 @@
1
+ templates
2
+ markdown
3
+ public.tar.gz
4
+ .git
@@ -0,0 +1 @@
1
+ Deny From All
@@ -0,0 +1 @@
1
+ Deny From All
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tomohiro, TAIRA
@@ -109,7 +109,9 @@ files:
109
109
  - lib/cg/rebuild.rb
110
110
  - lib/cg/scratch.rb
111
111
  - lib/contents_generator.rb
112
+ - skel/.exclude
112
113
  - skel/images/please_puts_image_here
114
+ - skel/markdown/.htaccess
113
115
  - skel/markdown/index.mkd
114
116
  - skel/scripts/create-elements.js
115
117
  - skel/scripts/disqus.js
@@ -118,6 +120,7 @@ files:
118
120
  - skel/styles/fonts-min.css
119
121
  - skel/styles/iphone.css
120
122
  - skel/styles/reset-min.css
123
+ - skel/templates/.htaccess
121
124
  - skel/templates/disqus.rb
122
125
  - skel/templates/html.rb
123
126
  - spec/cg_spec.rb