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.
- data/data/site_template/pages.yaml +0 -2
- data/data/site_template/rakefile +7 -0
- data/data/site_template/sources/default.css.sass +10 -0
- data/lib/static_cms/commands.rb +1 -1
- data/lib/static_cms/helpers.rb +5 -0
- data/lib/static_cms/page.rb +2 -1
- data/lib/static_cms/site.rb +4 -0
- data/lib/static_cms/version.rb +1 -1
- data/test/test_upload.rb +12 -0
- metadata +11 -9
data/data/site_template/rakefile
CHANGED
@@ -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
|
data/lib/static_cms/commands.rb
CHANGED
@@ -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 =
|
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}
|
data/lib/static_cms/helpers.rb
CHANGED
data/lib/static_cms/page.rb
CHANGED
@@ -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
|
-
|
92
|
+
::StaticCms::Helpers.puts_system "sass #{source} > #{target}"
|
92
93
|
else
|
93
94
|
raise NotImplementedError, file
|
94
95
|
end
|
data/lib/static_cms/site.rb
CHANGED
data/lib/static_cms/version.rb
CHANGED
data/test/test_upload.rb
ADDED
@@ -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.
|
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: &
|
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: *
|
24
|
+
version_requirements: *80380990
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sass
|
27
|
-
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: *
|
35
|
+
version_requirements: *80169360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ruby_patch
|
38
|
-
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: *
|
46
|
+
version_requirements: *80167890
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: thor
|
49
|
-
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: *
|
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:
|