radiant-go 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG +18 -0
- data/README.rdoc +49 -0
- data/Rakefile +26 -0
- data/USAGE +9 -0
- data/VERSION +1 -0
- data/bin/radiant-go +36 -0
- data/config/Gemfile +12 -0
- data/config/config.rb +11 -0
- data/lib/radiant-go.rb +27 -0
- data/lib/radiant-go/config.rb +11 -0
- data/lib/radiant-go/installers/bundler.rb +21 -0
- data/lib/radiant-go/installers/main.rb +99 -0
- data/lib/radiant-go/installers/radiant.rb +104 -0
- data/radiant-go.gemspec +71 -0
- data/spec/radiant-go/installers/bundler_spec.rb +36 -0
- data/spec/radiant-go/installers/main_spec.rb +51 -0
- data/spec/radiant-go/installers/radiant_spec.rb +98 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +10 -0
- metadata +121 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/CHANGELOG
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
== Change Log
|
2
|
+
|
3
|
+
|
4
|
+
=== 0.1.3 (August 23, 2010)
|
5
|
+
|
6
|
+
* Fixed a bug with running bootstrap multiple times on the same project [Mario Visic]
|
7
|
+
|
8
|
+
=== 0.1.2 (August 23, 2010)
|
9
|
+
|
10
|
+
* Created a generator for config files [Mario Visic]
|
11
|
+
* Generator uses a local Gemfile and config if available [Mario Visic]
|
12
|
+
|
13
|
+
=== 0.1.1 (August 22, 2010)
|
14
|
+
|
15
|
+
* Fixed a bug that caused incompatibility with newer bundler versions [Dirk Kelly, Mario Visic]
|
16
|
+
|
17
|
+
=== 0.1.0 (August 20, 2010)
|
18
|
+
* Initial Release [Mario Visic]
|
data/README.rdoc
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
= radiant-go
|
2
|
+
|
3
|
+
radiant-go is a script that creates radiant projects and automates setup tasks including:
|
4
|
+
|
5
|
+
* generating a project
|
6
|
+
* bootstrapping
|
7
|
+
* updating
|
8
|
+
* migrating
|
9
|
+
* installing required gems
|
10
|
+
* altering the config to require extensions
|
11
|
+
* updating extensions
|
12
|
+
* migrating extensions
|
13
|
+
|
14
|
+
== using the generator
|
15
|
+
|
16
|
+
to create a new project with the default settings simply run:
|
17
|
+
radiant-go projectname
|
18
|
+
|
19
|
+
== customise your setup
|
20
|
+
|
21
|
+
*in* *short*:
|
22
|
+
|
23
|
+
radiant-go --create-config projectfolder
|
24
|
+
# modify the config and gemfiles
|
25
|
+
radiant-go projectfolder
|
26
|
+
|
27
|
+
*slightly* *longer* *explaination*:
|
28
|
+
|
29
|
+
to customise the setup of radiant go, simply run the config generator:
|
30
|
+
radiant-go --create-config projectname
|
31
|
+
this generates a folder with a Gemfile that you can alter and a config file located at config/radiant-go.rb.
|
32
|
+
modify these files to your liking and then run the radiant-go generator on that project folder
|
33
|
+
radiant-go projectname
|
34
|
+
|
35
|
+
== migration order
|
36
|
+
|
37
|
+
gems will be migrated in the order they appear in the Gemfile. if you have an extension that depends on another,
|
38
|
+
put the dependency first in the Gemfile to have its migration run first.
|
39
|
+
|
40
|
+
== windows support
|
41
|
+
|
42
|
+
there is none unfortunately. radiant-go runs external generators and POSIX commands which won't work on windows
|
43
|
+
it should work fine on OS X / Linux. If you want to build windows support, please feel free to fork the project.
|
44
|
+
|
45
|
+
== vendored extensions
|
46
|
+
|
47
|
+
currently radiant-go only supports extensions as gems. this is on purpose, all radiant extensions should be moved
|
48
|
+
to gems, it's a much nicer and easier way to deal with them.
|
49
|
+
See this screencast for more information on gem extensions http://radiantcms.org/blog/archives/2010/07/01/radiantcasts-episode-18-extensions-as-gems/
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
begin
|
5
|
+
|
6
|
+
require 'jeweler' # it's here and not up, if jeweler isn't installed, the rescue below will catch (end users don't need it)
|
7
|
+
|
8
|
+
Jeweler::Tasks.new do |gem|
|
9
|
+
gem.name = "radiant-go"
|
10
|
+
gem.summary = 'a quicker and easier way to setup radiant projects'
|
11
|
+
gem.description = 'a quick an easy way to create radiant projects that are ready to use straight away, automatically perform bootstraps, migrations and updates for radiant and extensions, radiant-go is completely customizable little orphan awesome'
|
12
|
+
gem.email = 'mario@mariovisic.com'
|
13
|
+
gem.homepage = 'http://github.com/squaretalent/radiant-go'
|
14
|
+
gem.authors = ['squaretalent']
|
15
|
+
gem.add_dependency('radiant', '>= 0.9.1')
|
16
|
+
gem.add_dependency('bundler', '>= 0.9.26')
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. This is only required if you plan to package radiant-go as a gem."
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'run all specs'
|
24
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
25
|
+
t.spec_files = FileList['spec/**/*.rb']
|
26
|
+
end
|
data/USAGE
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.4
|
data/bin/radiant-go
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
current_dir = File.expand_path(File.dirname(__FILE__))
|
4
|
+
require current_dir + '/../lib/radiant-go'
|
5
|
+
|
6
|
+
if ARGV.size < 1
|
7
|
+
puts 'please specify a project name or run radiant-go --help for usage'
|
8
|
+
else
|
9
|
+
|
10
|
+
config = (ARGV[0] == '-c' || ARGV[0] == '--create-config') ? true : false
|
11
|
+
usage = ARGV.any? {|arg| arg == '-h' || arg == '--help'} ? true : false
|
12
|
+
version = ARGV.any? {|arg| arg == '-v' || arg == '--version'} ? true : false
|
13
|
+
|
14
|
+
if config == true
|
15
|
+
|
16
|
+
if ARGV.size != 2
|
17
|
+
puts 'please specify a location to create config files'
|
18
|
+
else
|
19
|
+
|
20
|
+
name = ARGV[1]
|
21
|
+
installer = RadiantGo::Installers::Main.new(name)
|
22
|
+
installer.generate_config
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
elsif usage == true
|
27
|
+
puts RadiantGo::Main.usage
|
28
|
+
elsif version == true
|
29
|
+
puts RadiantGo::Main.version
|
30
|
+
else
|
31
|
+
name = ARGV.shift
|
32
|
+
installer = RadiantGo::Installers::Main.new(name)
|
33
|
+
installer.run()
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/config/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '2.3.8'
|
4
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
5
|
+
gem 'haml', '>= 3.0.0'
|
6
|
+
gem 'compass', '>= 0.10.4'
|
7
|
+
gem 'compass-960-plugin', '>= 0.9.13'
|
8
|
+
gem 'rmagick', '>= 2.13.1'
|
9
|
+
gem 'aws-s3', '>= 0.6.2', :require => 'aws/s3'
|
10
|
+
gem 'paperclip', '>= 2.3.3'
|
11
|
+
gem 'radiant-forms-extension', '>= 2.0.1'
|
12
|
+
gem 'radiant-settings-extension', '>= 1.1.1'
|
data/config/config.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module RadiantGo
|
2
|
+
|
3
|
+
Config.database = 'sqlite3'
|
4
|
+
Config.admin_name = 'Administrator'
|
5
|
+
Config.admin_user = 'admin'
|
6
|
+
Config.admin_pass = 'radiant'
|
7
|
+
Config.database_template = 'empty.yml'
|
8
|
+
|
9
|
+
# available database templates are empty.yml, roasters.yml, simple-blog.yml, styled-blog.yml
|
10
|
+
|
11
|
+
end
|
data/lib/radiant-go.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
current_dir = File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require current_dir + '/radiant-go/config.rb'
|
8
|
+
require current_dir + '/../config/config.rb'
|
9
|
+
require current_dir + '/radiant-go/installers/main.rb'
|
10
|
+
require current_dir + '/radiant-go/installers/radiant.rb'
|
11
|
+
require current_dir + '/radiant-go/installers/bundler.rb'
|
12
|
+
|
13
|
+
module RadiantGo
|
14
|
+
|
15
|
+
class Main
|
16
|
+
|
17
|
+
def self.version
|
18
|
+
File.read(File.expand_path(File.dirname(__FILE__)) + '/../VERSION')
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.usage
|
22
|
+
File.read(File.expand_path(File.dirname(__FILE__)) + '/../USAGE')
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module RadiantGo
|
2
|
+
|
3
|
+
module Installers
|
4
|
+
|
5
|
+
class Main
|
6
|
+
|
7
|
+
def initialize(name)
|
8
|
+
|
9
|
+
@project_name = name
|
10
|
+
|
11
|
+
if File.exists? @project_name + '/config/radiant-go.rb'
|
12
|
+
require @project_name + '/config/radiant-go.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
# setup default gemfile location
|
16
|
+
if File.exists?(@project_name + '/Gemfile')
|
17
|
+
Config.gemfile_location = @project_name + '/Gemfile'
|
18
|
+
else
|
19
|
+
Config.gemfile_location = File.expand_path(File.dirname(__FILE__)) + '/../../../config/Gemfile'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
|
26
|
+
radiant = Installers::Radiant.new(@project_name, Config.database)
|
27
|
+
bundler = Installers::Bundler.new(@project_name)
|
28
|
+
|
29
|
+
puts '== generating radiant project'
|
30
|
+
radiant.create
|
31
|
+
puts '== copying gemfile'
|
32
|
+
copy_gemfile
|
33
|
+
puts '== bundler is installing gems'
|
34
|
+
bundler.install
|
35
|
+
puts '== running bootstrap'
|
36
|
+
radiant.bootstrap
|
37
|
+
puts '== updating config'
|
38
|
+
radiant.update_config
|
39
|
+
puts '== updating extensions'
|
40
|
+
radiant.update_extensions
|
41
|
+
puts '== migrating extensions'
|
42
|
+
radiant.migrate_extensions
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def copy_gemfile
|
47
|
+
|
48
|
+
# we only copy the file if it doesn't exist
|
49
|
+
if !File.exists?(@project_name + '/Gemfile')
|
50
|
+
File.new(@project_name + '/Gemfile', File::CREAT) unless File.exists?(@project_name + '/Gemfile')
|
51
|
+
|
52
|
+
source = File.open(Config.gemfile_location, 'r')
|
53
|
+
target = File.open(@project_name + '/Gemfile', 'w')
|
54
|
+
|
55
|
+
target.write( source.read(64) ) while not source.eof?
|
56
|
+
target.close
|
57
|
+
source.close
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def generate_config
|
63
|
+
|
64
|
+
puts '== creating config'
|
65
|
+
|
66
|
+
if !File.exists? @project_name
|
67
|
+
# create our directory if there isn't one
|
68
|
+
Dir.mkdir @project_name
|
69
|
+
end
|
70
|
+
|
71
|
+
if !File.exists? @project_name + '/config'
|
72
|
+
# create our config directory if it doesn't already exist!
|
73
|
+
Dir.mkdir @project_name + '/config'
|
74
|
+
end
|
75
|
+
|
76
|
+
# copy our gemfile
|
77
|
+
source = File.open(File.expand_path(File.dirname(__FILE__)) + '/../../../config/Gemfile')
|
78
|
+
target = File.open(@project_name + '/Gemfile', 'w')
|
79
|
+
target.write( source.read(64) ) while not source.eof?
|
80
|
+
target.close
|
81
|
+
source.close
|
82
|
+
|
83
|
+
# copy our config file
|
84
|
+
source = File.open(File.expand_path(File.dirname(__FILE__)) + '/../../../config/config.rb')
|
85
|
+
target = File.open(@project_name + '/config/radiant-go.rb', 'w')
|
86
|
+
target.write( source.read(64) ) while not source.eof?
|
87
|
+
target.close
|
88
|
+
source.close
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module RadiantGo
|
2
|
+
|
3
|
+
module Installers
|
4
|
+
|
5
|
+
class Radiant
|
6
|
+
|
7
|
+
def initialize(name, database)
|
8
|
+
@name = name
|
9
|
+
@database = database
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
%x[radiant #{@name} --skip --database=#{@database}]
|
14
|
+
end
|
15
|
+
|
16
|
+
def bootstrap
|
17
|
+
# we only bootstrap if there's no database!
|
18
|
+
if File.exists?(@name + '/db/development.' + Config.database + '.db') == false
|
19
|
+
Dir.chdir(@name) do
|
20
|
+
%x[rake db:bootstrap OVERWRITE=true ADMIN_NAME=#{Config.admin_name} ADMIN_USERNAME=#{Config.admin_user} ADMIN_PASSWORD=#{Config.admin_pass} DATABASE_TEMPLATE=#{Config.database_template}]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_config
|
26
|
+
|
27
|
+
Dir.chdir(@name) do
|
28
|
+
|
29
|
+
# open our config
|
30
|
+
config_file = File.open('config/environment.rb', 'r')
|
31
|
+
config_string = ''
|
32
|
+
line = ''
|
33
|
+
|
34
|
+
# read up to the part where we are loading gems
|
35
|
+
while(line.index('config.gem') == nil)
|
36
|
+
line = config_file.gets
|
37
|
+
config_string += line
|
38
|
+
end
|
39
|
+
|
40
|
+
# loop through all our radiant extensions and add the lines we need for config
|
41
|
+
all_extensions.each do |gem|
|
42
|
+
config_string += " config.gem '#{gem[:name]}', :version => '#{gem[:requirement]}', :lib => false\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
# read the rest of the config
|
46
|
+
while(line = config_file.gets)
|
47
|
+
config_string += line
|
48
|
+
end
|
49
|
+
|
50
|
+
# close the file, open it for reading and dump our string
|
51
|
+
config_file.close
|
52
|
+
config_file = File.open('config/environment.rb', 'w')
|
53
|
+
|
54
|
+
config_file.write(config_string)
|
55
|
+
config_file.close
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def update_extensions
|
62
|
+
|
63
|
+
Dir.chdir(@name) do
|
64
|
+
%x[rake radiant:extensions:update_all]
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def migrate_extensions
|
70
|
+
|
71
|
+
Dir.chdir(@name) do
|
72
|
+
all_extensions.each do |gem|
|
73
|
+
# we need to use the short name for our migration, eg forms instead of radiant-forms-extension
|
74
|
+
extension = gem[:name].scan(/^radiant-(.*)-extension$/)
|
75
|
+
%x[rake radiant:extensions:#{extension}:migrate]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def all_extensions
|
84
|
+
|
85
|
+
extensions = []
|
86
|
+
gemfile = File.open(Config.gemfile_location, 'r')
|
87
|
+
|
88
|
+
while(line = gemfile.gets)
|
89
|
+
if extension = line.match(/gem.*(radiant-.*-extension).*['"](.*)['"]/)
|
90
|
+
extensions.push(:name => extension[1], :requirement => extension[2])
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
gemfile.close
|
96
|
+
extensions
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
data/radiant-go.gemspec
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{radiant-go}
|
8
|
+
s.version = "0.1.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["squaretalent"]
|
12
|
+
s.date = %q{2010-08-23}
|
13
|
+
s.default_executable = %q{radiant-go}
|
14
|
+
s.description = %q{a quick an easy way to create radiant projects that are ready to use straight away, automatically perform bootstraps, migrations and updates for radiant and extensions, radiant-go is completely customizable little orphan awesome}
|
15
|
+
s.email = %q{mario@mariovisic.com}
|
16
|
+
s.executables = ["radiant-go"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"CHANGELOG",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"USAGE",
|
26
|
+
"VERSION",
|
27
|
+
"bin/radiant-go",
|
28
|
+
"config/Gemfile",
|
29
|
+
"config/config.rb",
|
30
|
+
"lib/radiant-go.rb",
|
31
|
+
"lib/radiant-go/config.rb",
|
32
|
+
"lib/radiant-go/installers/bundler.rb",
|
33
|
+
"lib/radiant-go/installers/main.rb",
|
34
|
+
"lib/radiant-go/installers/radiant.rb",
|
35
|
+
"radiant-go.gemspec",
|
36
|
+
"spec/radiant-go/installers/bundler_spec.rb",
|
37
|
+
"spec/radiant-go/installers/main_spec.rb",
|
38
|
+
"spec/radiant-go/installers/radiant_spec.rb",
|
39
|
+
"spec/rcov.opts",
|
40
|
+
"spec/spec.opts",
|
41
|
+
"spec/spec_helper.rb"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/squaretalent/radiant-go}
|
44
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.7}
|
47
|
+
s.summary = %q{a quicker and easier way to setup radiant projects}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/radiant-go/installers/bundler_spec.rb",
|
50
|
+
"spec/radiant-go/installers/main_spec.rb",
|
51
|
+
"spec/radiant-go/installers/radiant_spec.rb",
|
52
|
+
"spec/spec_helper.rb"
|
53
|
+
]
|
54
|
+
|
55
|
+
if s.respond_to? :specification_version then
|
56
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
57
|
+
s.specification_version = 3
|
58
|
+
|
59
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<radiant>, [">= 0.9.1"])
|
61
|
+
s.add_runtime_dependency(%q<bundler>, [">= 0.9.26"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<radiant>, [">= 0.9.1"])
|
64
|
+
s.add_dependency(%q<bundler>, [">= 0.9.26"])
|
65
|
+
end
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<radiant>, [">= 0.9.1"])
|
68
|
+
s.add_dependency(%q<bundler>, [">= 0.9.26"])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module RadiantGo
|
4
|
+
|
5
|
+
module Installers
|
6
|
+
|
7
|
+
describe Bundler do
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@bundler = Bundler.new('test')
|
11
|
+
@installer = Main.new('test')
|
12
|
+
Dir.mkdir 'test'
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
after(:all) do
|
17
|
+
FileUtils.rm_rf 'test'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should install all required gems with bundle install' do
|
21
|
+
|
22
|
+
# we shouldn't have a .bundle folder
|
23
|
+
File.directory?('test/.bundle').should be false
|
24
|
+
@installer.copy_gemfile
|
25
|
+
@bundler.install
|
26
|
+
|
27
|
+
# after running bundler we should have our .bundle directory
|
28
|
+
File.directory?('test/.bundle').should be true
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module RadiantGo
|
4
|
+
|
5
|
+
module Installers
|
6
|
+
|
7
|
+
describe Main do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Dir.mkdir 'test'
|
11
|
+
@main = Main.new('test')
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
FileUtils.rm_rf 'test'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should create a copy of the gemfile' do
|
19
|
+
@main.copy_gemfile
|
20
|
+
File.exists?('test/Gemfile').should be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have a gemfile that isn\'t empty' do
|
24
|
+
@main.copy_gemfile
|
25
|
+
File.zero?('test/Gemfile').should_not be true
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should not write over an existing gemfile' do
|
29
|
+
|
30
|
+
# we create a new gemfile and make it blank
|
31
|
+
gemfile = File.new('test/Gemfile', File::CREAT)
|
32
|
+
gemfile.close
|
33
|
+
File.size('test/Gemfile').should be 0
|
34
|
+
|
35
|
+
# we run the copy gemfile method, it shouldn't work as the file already exists
|
36
|
+
@main.copy_gemfile
|
37
|
+
File.exists?('test/Gemfile').should be true
|
38
|
+
File.size('test/Gemfile').should be 0
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should create a Gemfile and config file on generate config' do
|
42
|
+
@main.generate_config
|
43
|
+
File.exists?('test/Gemfile').should be true
|
44
|
+
File.exists?('test/config/radiant-go.rb').should be true
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module RadiantGo
|
4
|
+
|
5
|
+
module Installers
|
6
|
+
|
7
|
+
describe Radiant do
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@main = Main.new('test')
|
11
|
+
@installer = Radiant.new('test', Config.database)
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:all) do
|
15
|
+
FileUtils.rm_rf 'test'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should create a new folder and files for a new project' do
|
19
|
+
@installer.create
|
20
|
+
File.directory?('test').should be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should not write over existing project files' do
|
24
|
+
|
25
|
+
# make the README file blank (could be any radiant file instead of README)
|
26
|
+
File.delete 'test/README'
|
27
|
+
readme = File.new('test/README', File::CREAT)
|
28
|
+
readme.close
|
29
|
+
File.size('test/README').should be 0
|
30
|
+
|
31
|
+
# it shouldn't override
|
32
|
+
@installer.create
|
33
|
+
File.size('test/README').should be 0
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should create a non empty database file upon bootstrap' do
|
38
|
+
|
39
|
+
File.exists?('test/db/development.' + Config.database + '.db').should be false
|
40
|
+
@installer.bootstrap
|
41
|
+
File.exists?('test/db/development.' + Config.database + '.db').should be true
|
42
|
+
File.size('test/db/development.' + Config.database + '.db').should be > 0
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'shouldnt bootstrap if a database file already exists' do
|
47
|
+
File.exists?('test/db/development.' + Config.database + '.db').should be true
|
48
|
+
File.size('test/db/development.' + Config.database + '.db').should be > 0
|
49
|
+
|
50
|
+
# we remove our database
|
51
|
+
File.delete('test/db/development.' + Config.database + '.db')
|
52
|
+
|
53
|
+
# and replace it with a blank file
|
54
|
+
database = File.new('test/db/development.' + Config.database + '.db', File::CREAT)
|
55
|
+
database.close
|
56
|
+
|
57
|
+
# bootstap shouldn't touch the db now!
|
58
|
+
@installer.bootstrap
|
59
|
+
File.size('test/db/development.' + Config.database + '.db').should be 0
|
60
|
+
|
61
|
+
# cleanup (need a working DB for later tests)
|
62
|
+
File.delete('test/db/development.' + Config.database + '.db')
|
63
|
+
@installer.bootstrap
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should alter the configuration in the environment file' do
|
68
|
+
|
69
|
+
# the size of the file should increase after it is altered
|
70
|
+
size = File.size('test/config/environment.rb')
|
71
|
+
@installer.update_config
|
72
|
+
File.size('test/config/environment.rb').should_not be size
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should update all extensions' do
|
77
|
+
|
78
|
+
# the contents of the public folder should change
|
79
|
+
contents = %x[du test/public/]
|
80
|
+
@installer.update_extensions
|
81
|
+
%x[du test/public/].should_not be contents
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should migrate all extensions' do
|
86
|
+
|
87
|
+
# migrating should cause the database to grow
|
88
|
+
size = File.size('test/db/development.' + Config.database + '.db')
|
89
|
+
@installer.migrate_extensions
|
90
|
+
File.size('test/db/development.' + Config.database + '.db').should be > size
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
data/spec/rcov.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--exclude "spec/*,gems/*"
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
current_directory = File.dirname(__FILE__)
|
2
|
+
require 'spec/autorun'
|
3
|
+
require 'spec'
|
4
|
+
require current_directory + '/../lib/radiant-go.rb'
|
5
|
+
|
6
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
7
|
+
|
8
|
+
Spec::Runner.configure do |config|
|
9
|
+
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-go
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- squaretalent
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-23 00:00:00 +08:00
|
19
|
+
default_executable: radiant-go
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: radiant
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 57
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 1
|
34
|
+
version: 0.9.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: bundler
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 9
|
49
|
+
- 26
|
50
|
+
version: 0.9.26
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
description: a quick an easy way to create radiant projects that are ready to use straight away, automatically perform bootstraps, migrations and updates for radiant and extensions, radiant-go is completely customizable little orphan awesome
|
54
|
+
email: mario@mariovisic.com
|
55
|
+
executables:
|
56
|
+
- radiant-go
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- README.rdoc
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- CHANGELOG
|
64
|
+
- README.rdoc
|
65
|
+
- Rakefile
|
66
|
+
- USAGE
|
67
|
+
- VERSION
|
68
|
+
- bin/radiant-go
|
69
|
+
- config/Gemfile
|
70
|
+
- config/config.rb
|
71
|
+
- lib/radiant-go.rb
|
72
|
+
- lib/radiant-go/config.rb
|
73
|
+
- lib/radiant-go/installers/bundler.rb
|
74
|
+
- lib/radiant-go/installers/main.rb
|
75
|
+
- lib/radiant-go/installers/radiant.rb
|
76
|
+
- radiant-go.gemspec
|
77
|
+
- spec/radiant-go/installers/bundler_spec.rb
|
78
|
+
- spec/radiant-go/installers/main_spec.rb
|
79
|
+
- spec/radiant-go/installers/radiant_spec.rb
|
80
|
+
- spec/rcov.opts
|
81
|
+
- spec/spec.opts
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://github.com/squaretalent/radiant-go
|
85
|
+
licenses: []
|
86
|
+
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options:
|
89
|
+
- --charset=UTF-8
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.3.7
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: a quicker and easier way to setup radiant projects
|
117
|
+
test_files:
|
118
|
+
- spec/radiant-go/installers/bundler_spec.rb
|
119
|
+
- spec/radiant-go/installers/main_spec.rb
|
120
|
+
- spec/radiant-go/installers/radiant_spec.rb
|
121
|
+
- spec/spec_helper.rb
|