Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 9021 Bytes
1 | # Only define freeze and unfreeze tasks in instance mode |
2 | unless File.directory? "#{RAILS_ROOT}/app" |
3 | namespace :radiant do |
4 | namespace :freeze do |
5 | desc "Lock this application to the current gems (by unpacking them into vendor/radiant)" |
6 | task :gems do |
7 | require 'rubygems' |
8 | require 'rubygems/gem_runner' |
9 | |
10 | radiant = (version = ENV['VERSION']) ? |
11 | Gem.cache.search('radiant', "= #{version}").first : |
12 | Gem.cache.search('radiant').sort_by { |g| g.version }.last |
13 | |
14 | version ||= radiant.version |
15 | |
16 | unless radiant |
17 | puts "No radiant gem #{version} is installed. Do 'gem list radiant' to see what you have available." |
18 | exit |
19 | end |
20 | |
21 | puts "Freezing to the gems for Radiant #{radiant.version}" |
22 | rm_rf "vendor/radiant" |
23 | |
24 | chdir("vendor") do |
25 | Gem::GemRunner.new.run(["unpack", "radiant", "--version", "=#{version}"]) |
26 | FileUtils.mv(Dir.glob("radiant*").first, "radiant") |
27 | end |
28 | end |
29 | |
30 | desc "Lock to latest Edge Radiant or a specific revision with REVISION=X (ex: REVISION=245484e), a tag with TAG=Y (ex: TAG=0.6.6), or a branch with BRANCH=Z (ex: BRANCH=mental)" |
31 | task :edge do |
32 | $verbose = false |
33 | unless system "git --version" |
34 | $stderr.puts "ERROR: Must have git available in the PATH to lock this application to Edge Radiant" |
35 | exit 1 |
36 | end |
37 | |
38 | radiant_git = "git://github.com/radiant/radiant.git" |
39 | |
40 | if File.exist?("vendor/radiant/.git/HEAD") |
41 | system "cd vendor/radiant; git checkout master; git pull origin master" |
42 | else |
43 | system "git clone #{radiant_git} vendor/radiant" |
44 | end |
45 | |
46 | case |
47 | when ENV['TAG'] |
48 | system "cd vendor/radiant; git checkout -b v#{ENV['TAG']} #{ENV['TAG']}" |
49 | when ENV['BRANCH'] |
50 | system "cd vendor/radiant; git checkout --track -b #{ENV['BRANCH']} origin/#{ENV['BRANCH']}" |
51 | when ENV['REVISION'] |
52 | system "cd vendor/radiant; git checkout -b REV_#{ENV['REVISION']} #{ENV['REVISION']}" |
53 | end |
54 | |
55 | system "cd vendor/radiant; git submodule init; git submodule update" |
56 | end |
57 | end |
58 | |
59 | desc "Unlock this application from freeze of gems or edge and return to a fluid use of system gems" |
60 | task :unfreeze do |
61 | rm_rf "vendor/radiant" |
62 | end |
63 | |
64 | desc "Update configs, scripts, sass, stylesheets and javascripts from Radiant." |
65 | task :update do |
66 | tasks = %w{scripts javascripts configs initializers images sass stylesheets cached_assets} |
67 | tasks = tasks & ENV['ONLY'].split(',') if ENV['ONLY'] |
68 | tasks = tasks - ENV['EXCEPT'].split(',') if ENV['EXCEPT'] |
69 | tasks.each do |task| |
70 | puts "* Updating #{task}" |
71 | Rake::Task["radiant:update:#{task}"].invoke |
72 | end |
73 | end |
74 | |
75 | namespace :update do |
76 | desc "Add new scripts to the instance script/ directory" |
77 | task :scripts do |
78 | local_base = "script" |
79 | edge_base = "#{File.dirname(__FILE__)}/../../script" |
80 | |
81 | local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) } |
82 | edge = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) } |
83 | edge = edge.reject { |f| f =~ /(generate|plugin|destroy)$/ } |
84 | |
85 | edge.each do |script| |
86 | base_name = script[(edge_base.length+1)..-1] |
87 | next if local.detect { |path| base_name == path[(local_base.length+1)..-1] } |
88 | if !File.directory?("#{local_base}/#{File.dirname(base_name)}") |
89 | mkdir_p "#{local_base}/#{File.dirname(base_name)}" |
90 | end |
91 | install script, "#{local_base}/#{base_name}", :mode => 0755 |
92 | end |
93 | install "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_generate", "#{local_base}/generate", :mode => 0755 |
94 | end |
95 | |
96 | desc "Update your javascripts from your current radiant install" |
97 | task :javascripts do |
98 | FileUtils.mkdir_p("#{RAILS_ROOT}/public/javascripts/admin/") |
99 | copy_javascripts = proc do |project_dir, scripts| |
100 | scripts.reject!{|s| File.basename(s) == 'overrides.js'} if File.exists?(project_dir + 'overrides.js') |
101 | FileUtils.cp(scripts, project_dir) |
102 | end |
103 | copy_javascripts[RAILS_ROOT + '/public/javascripts/', Dir["#{File.dirname(__FILE__)}/../../public/javascripts/*.js"]] |
104 | copy_javascripts[RAILS_ROOT + '/public/javascripts/admin/', Dir["#{File.dirname(__FILE__)}/../../public/javascripts/admin/*.js"]] |
105 | end |
106 | |
107 | desc "Update the cached assets for the admin UI" |
108 | task :cached_assets do |
109 | TaskSupport.cache_admin_js |
110 | end |
111 | |
112 | desc "Update config/boot.rb from your current radiant install" |
113 | task :configs do |
114 | require 'erb' |
115 | FileUtils.cp("#{File.dirname(__FILE__)}/../generators/instance/templates/instance_boot.rb", RAILS_ROOT + '/config/boot.rb') |
116 | instances = { |
117 | :env => "#{RAILS_ROOT}/config/environment.rb", |
118 | :development => "#{RAILS_ROOT}/config/environments/development.rb", |
119 | :test => "#{RAILS_ROOT}/config/environments/test.rb", |
120 | :production => "#{RAILS_ROOT}/config/environments/production.rb" |
121 | } |
122 | tmps = { |
123 | :env => "#{RAILS_ROOT}/config/environment.tmp", |
124 | :development => "#{RAILS_ROOT}/config/environments/development.tmp", |
125 | :test => "#{RAILS_ROOT}/config/environments/test.tmp", |
126 | :production => "#{RAILS_ROOT}/config/environments/production.tmp" |
127 | } |
128 | gens = { |
129 | :env => "#{File.dirname(__FILE__)}/../generators/instance/templates/instance_environment.rb", |
130 | :development => "#{File.dirname(__FILE__)}/../../config/environments/development.rb", |
131 | :test => "#{File.dirname(__FILE__)}/../../config/environments/test.rb", |
132 | :production => "#{File.dirname(__FILE__)}/../../config/environments/production.rb" |
133 | } |
134 | backups = { |
135 | :env => "#{RAILS_ROOT}/config/environment.bak", |
136 | :development => "#{RAILS_ROOT}/config/environments/development.bak", |
137 | :test => "#{RAILS_ROOT}/config/environments/test.bak", |
138 | :production => "#{RAILS_ROOT}/config/environments/production.bak" |
139 | } |
140 | @warning_start = "** WARNING ** |
141 | The following files have been changed in Radiant. Your originals have |
142 | been backed up with .bak extensions. Please copy your customizations to |
143 | the new files:" |
144 | [:env, :development, :test, :production].each do |env_type| |
145 | File.open(tmps[env_type], 'w') do |f| |
146 | app_name = File.basename(File.expand_path(RAILS_ROOT)) |
147 | f.write ERB.new(File.read(gens[env_type])).result(binding) |
148 | end |
149 | unless FileUtils.compare_file(instances[env_type], tmps[env_type]) |
150 | FileUtils.cp(instances[env_type], backups[env_type]) |
151 | FileUtils.cp(tmps[env_type], instances[env_type]) |
152 | @warnings ||= "" |
153 | case env_type |
154 | when :env |
155 | @warnings << " |
156 | - config/environment.rb" |
157 | else |
158 | @warnings << " |
159 | - config/environments/#{env_type.to_s}.rb" |
160 | end |
161 | end |
162 | FileUtils.rm(tmps[env_type]) |
163 | end |
164 | if @warnings |
165 | puts @warning_start + @warnings |
166 | end |
167 | end |
168 | |
169 | desc "Update admin images from your current radiant install" |
170 | task :images do |
171 | project_dir = RAILS_ROOT + '/public/images/admin/' |
172 | images = Dir["#{File.dirname(__FILE__)}/../../public/images/admin/*"] |
173 | FileUtils.cp(images, project_dir) |
174 | end |
175 | |
176 | desc "Update admin stylesheets from your current radiant install" |
177 | task :stylesheets do |
178 | project_dir = RAILS_ROOT + '/public/stylesheets/admin/' |
179 | |
180 | copy_stylesheets = proc do |project_dir, styles| |
181 | styles.reject!{|s| File.basename(s) == 'overrides.css'} if File.exists?(project_dir + 'overrides.css') |
182 | FileUtils.cp(styles, project_dir) |
183 | end |
184 | copy_stylesheets[RAILS_ROOT + '/public/stylesheets/admin/',Dir["#{File.dirname(__FILE__)}/../../public/stylesheets/admin/*.css"]] |
185 | end |
186 | |
187 | desc "Update admin sass files from your current radiant install" |
188 | task :sass do |
189 | copy_sass = proc do |project_dir, sass_files| |
190 | sass_files.reject!{|s| File.basename(s) == 'overrides.sass'} if File.exists?(project_dir + 'overrides.sass') || File.exists?(project_dir + '../overrides.css') |
191 | FileUtils.mkpath(project_dir) |
192 | FileUtils.cp_r(sass_files, project_dir) |
193 | end |
194 | copy_sass[RAILS_ROOT + '/public/stylesheets/sass/admin/', Dir["#{RADIANT_ROOT}/public/stylesheets/sass/admin/*"]] |
195 | end |
196 | |
197 | desc "Update initializers from your current radiant install" |
198 | task :initializers do |
199 | project_dir = RAILS_ROOT + '/config/initializers/' |
200 | FileUtils.mkpath project_dir |
201 | initializers = Dir["#{File.dirname(__FILE__)}/../../config/initializers/*.rb"] |
202 | FileUtils.cp(initializers, project_dir) |
203 | end |
204 | end |
205 | end |
206 | end |