static_cms 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,6 @@
6
6
  - short_profile
7
7
  statics:
8
8
  - ht_files/top/.htaccess
9
- sources:
10
- - default.css.sass
11
9
  stylesheets:
12
10
  title: Stylesheets
13
11
  template: blank
@@ -3,11 +3,18 @@ require 'static_cms'
3
3
  ::SITE = StaticCms::Site.new
4
4
 
5
5
  task default: :generate
6
+
6
7
  desc "Generate all pages."
7
8
  task generate: SITE.page_alist.keys
8
9
 
9
10
  ::SITE.page_alist.each{|name, page|
11
+ desc "\0\tGenerate #{name}"
10
12
  task name do
11
13
  page.generate
12
14
  end
13
15
  }
16
+
17
+ desc "Upload files."
18
+ task :upload do
19
+ ::SITE.upload
20
+ end
@@ -5,3 +5,13 @@ img
5
5
  &.e_mail_address
6
6
  width: 27ex
7
7
  vertical-align: middle
8
+ table
9
+ border:
10
+ style: solid
11
+ collapse: collapse
12
+ > thead, > tbody, > tfoot
13
+ border-style: solid
14
+ > tr
15
+ border-style: solid
16
+ > th, > td
17
+ border-style: solid
@@ -9,7 +9,7 @@ module ::StaticCms::Commands
9
9
  FileUtils.mkdir_p(dir)
10
10
  success = false
11
11
  FileUtils.cd(dir){|dir|
12
- success = system <<-EOS
12
+ success = ::StaticCms::Helpers.puts_system <<-EOS
13
13
  git init > #{File::NULL}
14
14
  git commit --allow-empty -m 'Empty commit.' > #{File::NULL}
15
15
  cp -r #{File.join(SITE_TEMPLATE_DIR, '*')} . > #{File::NULL}
@@ -25,4 +25,9 @@ module ::StaticCms::Helpers
25
25
  pre_text = to_plain(text)
26
26
  "<pre class='code'><code class='#{lang}'>#{pre_text}</code></pre>"
27
27
  end
28
+
29
+ def puts_system(command)
30
+ puts "\n" + command
31
+ system command
32
+ end
28
33
  end
@@ -35,6 +35,7 @@ class ::StaticCms::Page
35
35
 
36
36
  def generate
37
37
  FileUtils.mkdir_p(@dir)
38
+ FileUtils.chmod(0755, @dir)
38
39
 
39
40
  if @visible
40
41
  @statics.each{|file| cp_if_new(file)}
@@ -88,7 +89,7 @@ class ::StaticCms::Page
88
89
 
89
90
  case ext
90
91
  when /\A\.sass\z/
91
- system "sass #{source} > #{target}"
92
+ ::StaticCms::Helpers.puts_system "sass #{source} > #{target}"
92
93
  else
93
94
  raise NotImplementedError, file
94
95
  end
@@ -28,4 +28,8 @@ class ::StaticCms::Site
28
28
  @page_alist[name] = ::StaticCms::Page.new(self, name, params)
29
29
  }
30
30
  end
31
+
32
+ def upload(dir = @dir)
33
+ ::StaticCms::Helpers.puts_system "rsync -avu root/ #{dir}"
34
+ end
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module ::StaticCms
2
- VERSION = '1.2.1'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'helper_for_test'
2
+
3
+ class TestUpLoad < ::MiniTest::Unit::TestCase
4
+ require 'tmpdir'
5
+
6
+ def test_upload
7
+ FileUtils.cd(File.join(__DIR__, '../data/site_template')){
8
+ system "rake -I ../../lib"
9
+ assert ::StaticCms::Site.new.upload(Dir.mktmpdir)
10
+ }
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: static_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
16
- requirement: &79450410 !ruby/object:Gem::Requirement
16
+ requirement: &80380990 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79450410
24
+ version_requirements: *80380990
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sass
27
- requirement: &79238900 !ruby/object:Gem::Requirement
27
+ requirement: &80169360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *79238900
35
+ version_requirements: *80169360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby_patch
38
- requirement: &79237630 !ruby/object:Gem::Requirement
38
+ requirement: &80167890 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.1'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *79237630
46
+ version_requirements: *80167890
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thor
49
- requirement: &79236320 !ruby/object:Gem::Requirement
49
+ requirement: &80166550 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0.16'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *79236320
57
+ version_requirements: *80166550
58
58
  description: Simple static contents management system based on Haml and Sass.
59
59
  email:
60
60
  executables:
@@ -93,6 +93,7 @@ files:
93
93
  - test/test_generate.rb
94
94
  - test/test_init.rb
95
95
  - test/test_update.rb
96
+ - test/test_upload.rb
96
97
  homepage:
97
98
  licenses: []
98
99
  post_install_message:
@@ -121,4 +122,5 @@ test_files:
121
122
  - test/test_generate.rb
122
123
  - test/test_init.rb
123
124
  - test/test_update.rb
125
+ - test/test_upload.rb
124
126
  has_rdoc: