refinerycms-convertor 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -3,7 +3,7 @@
3
3
  Description goes here.
4
4
 
5
5
  == Note on Patches/Pull Requests
6
-
6
+
7
7
  * Fork the project.
8
8
  * Make your feature addition or bug fix.
9
9
  * Add tests for it. This is important so I don't break it in a
data/Rakefile CHANGED
@@ -5,12 +5,13 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "refinerycms-convertor"
8
- gem.summary = "Converts simple html templates into Refinerycms themes"
9
- gem.description = "This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes"
8
+ gem.summary = "Converts simple html templates into refinerycms themes."
9
+ gem.description = "This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes."
10
10
  gem.email = "steven@livingskyweb.ca"
11
11
  gem.homepage = "http://github.com/stevenheidel/refinerycms-convertor"
12
12
  gem.authors = ["stevenheidel"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_dependency "refinerycms", ">= 0.9.6.34"
14
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
16
  end
16
17
  Jeweler::GemcutterTasks.new
@@ -37,7 +38,7 @@ task :default => :spec
37
38
  require 'rake/rdoctask'
38
39
  Rake::RDocTask.new do |rdoc|
39
40
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
+
41
42
  rdoc.rdoc_dir = 'rdoc'
42
43
  rdoc.title = "refinerycms-convertor #{version}"
43
44
  rdoc.rdoc_files.include('README*')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,8 +1,22 @@
1
1
  class RefinerycmsConvertor
2
2
 
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ attr_reader :theme_dir, :original_dir
7
+
3
8
  def initialize(theme)
4
- raise ArgumentError, "Theme not found" unless File.directory?(Rails.root.join('themes', theme))
5
- raise ArgumentError, "Theme does not have an 'original' folder" unless File.directory?(Rails.root.join('themes', theme, 'original'))
9
+ raise ArgumentError, "Theme not found" unless File.directory?(@theme_dir = Rails.root.join('themes', theme))
10
+ raise ArgumentError, "Theme does not have an 'original' folder" unless File.directory?(@original_dir = Rails.root.join(@theme_dir, 'original'))
11
+ raise ArgumentError, "No 'index.html' in 'original' folder" unless File.exists?(@index_html = Rails.root.join(@original_dir, 'index.html'))
12
+
13
+ @theme = theme
14
+ end
15
+
16
+ def convert!
17
+ ['images', 'javascripts', 'stylesheets', 'views/layouts', 'views/pages', 'views/shared'].each do |dir|
18
+ mkdir_p @theme_dir + dir
19
+ end
6
20
  end
7
21
 
8
22
  end
@@ -1,11 +1,12 @@
1
1
  namespace :refinery do
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../convertor.rb')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../refinerycms-convertor.rb')
4
4
 
5
5
  desc "Convert an existing html website to refinerycms"
6
6
  task :convert do
7
7
  if (theme = ENV["theme"]).present?
8
- RefinerycmsConvertor.new(theme)
8
+ @theme = RefinerycmsConvertor.new(theme)
9
+ @theme.convert!
9
10
  else
10
11
  puts "Please specify the theme name"
11
12
  end
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{refinerycms-convertor}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["stevenheidel"]
12
- s.date = %q{2010-06-26}
13
- s.description = %q{This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes}
12
+ s.date = %q{2010-06-27}
13
+ s.description = %q{This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes.}
14
14
  s.email = %q{steven@livingskyweb.ca}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -26,6 +26,9 @@ Gem::Specification.new do |s|
26
26
  "lib/refinerycms-convertor.rb",
27
27
  "lib/tasks/refinerycms-convertor.rake",
28
28
  "refinerycms-convertor.gemspec",
29
+ "spec/fixtures/themes/theme/original/index.html",
30
+ "spec/fixtures/themes/unindexed/original/.gitinclude",
31
+ "spec/fixtures/themes/unoriginal/.gitinclude",
29
32
  "spec/refinerycms-convertor_spec.rb",
30
33
  "spec/spec.opts",
31
34
  "spec/spec_helper.rb"
@@ -34,7 +37,7 @@ Gem::Specification.new do |s|
34
37
  s.rdoc_options = ["--charset=UTF-8"]
35
38
  s.require_paths = ["lib"]
36
39
  s.rubygems_version = %q{1.3.7}
37
- s.summary = %q{Converts simple html templates into Refinerycms themes}
40
+ s.summary = %q{Converts simple html templates into refinerycms themes.}
38
41
  s.test_files = [
39
42
  "spec/refinerycms-convertor_spec.rb",
40
43
  "spec/spec_helper.rb"
@@ -46,11 +49,14 @@ Gem::Specification.new do |s|
46
49
 
47
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
51
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
52
+ s.add_runtime_dependency(%q<refinerycms>, [">= 0.9.6.34"])
49
53
  else
50
54
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
55
+ s.add_dependency(%q<refinerycms>, [">= 0.9.6.34"])
51
56
  end
52
57
  else
53
58
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
59
+ s.add_dependency(%q<refinerycms>, [">= 0.9.6.34"])
54
60
  end
55
61
  end
56
62
 
File without changes
File without changes
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe RefinerycmsConvertor do
4
4
 
5
- context "starting to convert a theme" do
5
+ context "getting ready to convert a theme" do
6
6
 
7
7
  it "should return an error if theme not found" do
8
8
  lambda { RefinerycmsConvertor.new("ghost") }.should raise_error(ArgumentError, "Theme not found")
@@ -12,6 +12,30 @@ describe RefinerycmsConvertor do
12
12
  lambda { RefinerycmsConvertor.new("unoriginal") }.should raise_error(ArgumentError, "Theme does not have an 'original' folder")
13
13
  end
14
14
 
15
+ it "should return an error if no 'index.html' in 'original' folder" do
16
+ lambda { RefinerycmsConvertor.new("unindexed") }.should raise_error(ArgumentError, "No 'index.html' in 'original' folder")
17
+ end
18
+
19
+ end
20
+
21
+ context "converting a theme" do
22
+
23
+ before(:all) do
24
+ @theme = RefinerycmsConvertor.new("theme")
25
+ @theme.convert!
26
+ end
27
+
28
+ it "should know the important directories" do
29
+ @theme.theme_dir.should == Rails.root.join('themes', 'theme')
30
+ @theme.original_dir.should == Rails.root.join('themes', 'theme', 'original')
31
+ end
32
+
33
+ it "should create a skeleton of directories" do
34
+ ['images', 'javascripts', 'stylesheets', 'views', 'views/layouts', 'views/pages', 'views/shared'].each do |dir|
35
+ File.should be_exist(Rails.root.join(@theme.theme_dir, dir))
36
+ end
37
+ end
38
+
15
39
  end
16
40
 
17
41
  end
data/spec/spec.opts CHANGED
@@ -1 +1,2 @@
1
1
  --color
2
+ --format specdoc
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-convertor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - stevenheidel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-26 00:00:00 -06:00
18
+ date: 2010-06-27 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,24 @@ dependencies:
34
34
  version: 1.2.9
35
35
  type: :development
36
36
  version_requirements: *id001
37
- description: This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes
37
+ - !ruby/object:Gem::Dependency
38
+ name: refinerycms
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 91
46
+ segments:
47
+ - 0
48
+ - 9
49
+ - 6
50
+ - 34
51
+ version: 0.9.6.34
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ description: This gem makes it very easy to create beautiful looking websites with refinerycms by taking out all of the repetition of making refinerycms themes.
38
55
  email: steven@livingskyweb.ca
39
56
  executables: []
40
57
 
@@ -53,6 +70,9 @@ files:
53
70
  - lib/refinerycms-convertor.rb
54
71
  - lib/tasks/refinerycms-convertor.rake
55
72
  - refinerycms-convertor.gemspec
73
+ - spec/fixtures/themes/theme/original/index.html
74
+ - spec/fixtures/themes/unindexed/original/.gitinclude
75
+ - spec/fixtures/themes/unoriginal/.gitinclude
56
76
  - spec/refinerycms-convertor_spec.rb
57
77
  - spec/spec.opts
58
78
  - spec/spec_helper.rb
@@ -89,7 +109,7 @@ rubyforge_project:
89
109
  rubygems_version: 1.3.7
90
110
  signing_key:
91
111
  specification_version: 3
92
- summary: Converts simple html templates into Refinerycms themes
112
+ summary: Converts simple html templates into refinerycms themes.
93
113
  test_files:
94
114
  - spec/refinerycms-convertor_spec.rb
95
115
  - spec/spec_helper.rb