gemsonrails 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/README.txt +5 -0
- data/Rakefile +2 -0
- data/bin/gemsonrails +3 -4
- data/lib/gemsonrails/version.rb +1 -1
- data/templates/init.rb +1 -1
- data/templates/tasks_gems_freeze.rake +9 -2
- data/templates/tasks_gems_link.rake +24 -15
- data/website/index.html +16 -3
- data/website/index.txt +12 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
+++ 0.6.0 2007-05-11
|
2
|
+
|
3
|
+
+ 1 major enhancement:
|
4
|
+
+ Linked/frozen gems can be loaded only for certain RAILS_ENVs using ONLY env variable, e.g.
|
5
|
+
rake gems:freeze GEM=helper ONLY=development,test
|
6
|
+
+ 1 minor enhancement:
|
7
|
+
+ Reinstalling gemsonrails does not delete the original (and its svn meta-data), just overwrites the files
|
8
|
+
|
1
9
|
+++ 0.5.0 2007-05-06
|
2
10
|
|
3
11
|
+ 1 major enhancement:
|
data/README.txt
CHANGED
@@ -8,3 +8,8 @@ Then run either:
|
|
8
8
|
'rake gems:freeze GEM=<gemname> [VERSION=<versionnum>]' to freeze a gem, or
|
9
9
|
'rake gems:link GEM=<gemname>' to link to whatever latest gem release is available at runtime.
|
10
10
|
|
11
|
+
You can restrict which RAILS_ENVs the gem will be loaded for, using ONLY; e.g.
|
12
|
+
|
13
|
+
'rake gems:freeze GEM=<gemname> ONLY=development' only in 'development' mode will the gem be loaded, or
|
14
|
+
'rake gems:link GEM=<gemname> ONLY=production,staging' only in 'production' or 'staging' mode will the gem be loaded from the deployment gem server
|
15
|
+
|
data/Rakefile
CHANGED
@@ -77,6 +77,8 @@ task :website => [:website_generate, :website_upload]
|
|
77
77
|
desc 'Release the website and new gem version'
|
78
78
|
task :deploy => [:check_version, :website, :release]
|
79
79
|
|
80
|
+
task :local_deploy => [:website_generate, :install_gem]
|
81
|
+
|
80
82
|
task :check_version do
|
81
83
|
unless ENV['VERSION']
|
82
84
|
puts 'Must pass a VERSION=x.y.z release version'
|
data/bin/gemsonrails
CHANGED
@@ -32,20 +32,19 @@ gems_path = File.join(plugins, 'gemsonrails')
|
|
32
32
|
tasks_path = File.join(gems_path, 'tasks')
|
33
33
|
task_templates = Dir[File.join(templates, '*.rake')]
|
34
34
|
|
35
|
-
FileUtils.
|
35
|
+
FileUtils.mkdir_p gems_path
|
36
36
|
|
37
|
-
Dir.mkdir gems_path
|
38
37
|
Dir.chdir gems_path do
|
39
38
|
template = File.open(templates + 'init.rb','r') {|f| f.readlines.join}
|
40
39
|
File.open('init.rb', 'w') {|file| file << template }
|
41
40
|
end
|
42
41
|
|
43
|
-
|
42
|
+
FileUtils.mkdir_p tasks_path
|
44
43
|
Dir.chdir tasks_path do
|
45
44
|
task_templates.each do |template_name|
|
46
45
|
task_name = File.basename(template_name).sub(/\Atasks_/,'')
|
47
46
|
template = File.open(template_name,'r') {|f| f.readlines.join}
|
48
|
-
File.open(task_name, 'w') {|file| file << template }
|
47
|
+
File.open(task_name, 'w') { |file| file << template }
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
data/lib/gemsonrails/version.rb
CHANGED
data/templates/init.rb
CHANGED
@@ -6,11 +6,17 @@ namespace :gems do
|
|
6
6
|
Parameters:
|
7
7
|
GEM Name of gem (required)
|
8
8
|
VERSION Version of gem to freeze (optional)
|
9
|
+
ONLY RAILS_ENVs for which the GEM will be active (optional)
|
9
10
|
|
10
11
|
eos
|
11
12
|
break
|
12
13
|
end
|
13
14
|
|
15
|
+
# ONLY=development[,test] etc
|
16
|
+
only_list = (ENV['ONLY'] || "").split(',')
|
17
|
+
only_if_begin = only_list.size == 0 ? "" : "if %w[#{only_list.join(' ')}].include?(ENV['RAILS_ENV'])"
|
18
|
+
only_if_end = only_list.size == 0 ? "" : "end"
|
19
|
+
|
14
20
|
require 'rubygems'
|
15
21
|
Gem.manage_gems
|
16
22
|
|
@@ -39,8 +45,9 @@ eos
|
|
39
45
|
if !File.exists?('init.rb')
|
40
46
|
File.open('init.rb', 'w') do |file|
|
41
47
|
file << <<-eos
|
42
|
-
#
|
43
|
-
require File.join(File.dirname(__FILE__), 'lib', '#{gem_name}')
|
48
|
+
#{only_if_begin}
|
49
|
+
require File.join(File.dirname(__FILE__), 'lib', '#{gem_name}')
|
50
|
+
#{only_if_end}
|
44
51
|
eos
|
45
52
|
end
|
46
53
|
end
|
@@ -5,12 +5,17 @@ namespace :gems do
|
|
5
5
|
puts <<-eos
|
6
6
|
Parameters:
|
7
7
|
GEM Name of gem (required)
|
8
|
-
|
8
|
+
ONLY RAILS_ENVs for which the GEM will be active (optional)
|
9
9
|
|
10
10
|
eos
|
11
11
|
break
|
12
12
|
end
|
13
13
|
|
14
|
+
# ONLY=development[,test] etc
|
15
|
+
only_list = (ENV['ONLY'] || "").split(',')
|
16
|
+
only_if_begin = only_list.size == 0 ? "" : "if %w[#{only_list.join(' ')}].include?(ENV['RAILS_ENV'])"
|
17
|
+
only_if_end = only_list.size == 0 ? "" : "end"
|
18
|
+
|
14
19
|
require 'rubygems'
|
15
20
|
Gem.manage_gems
|
16
21
|
|
@@ -32,26 +37,30 @@ eos
|
|
32
37
|
chdir target_dir, :verbose => false do
|
33
38
|
File.open('init.rb', 'w') do |file|
|
34
39
|
file << <<-eos
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
#{only_if_begin}
|
41
|
+
require 'rubygems'
|
42
|
+
Gem.manage_gems
|
43
|
+
gem = Gem.cache.search('#{gem.name}').sort_by { |g| g.version }.last
|
44
|
+
if gem.autorequire
|
45
|
+
require gem.autorequire
|
46
|
+
else
|
47
|
+
require '#{gem.name}'
|
48
|
+
end
|
49
|
+
#{only_if_end}
|
43
50
|
eos
|
44
51
|
end
|
45
52
|
File.open(File.join('tasks', 'load_tasks.rake'), 'w') do |file|
|
46
53
|
file << <<-eos
|
47
54
|
# This file does not include any Rake files, but loads up the
|
48
55
|
# tasks in the /vendor/gems/ folders
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
#{only_if_begin}
|
57
|
+
require 'rubygems'
|
58
|
+
Gem.manage_gems
|
59
|
+
gem = Gem.cache.search('#{gem.name}').sort_by { |g| g.version }.last
|
60
|
+
raise \"Gem '#{gem.name}' is not installed\" if gem.nil?
|
61
|
+
path = gem.full_gem_path
|
62
|
+
Dir[File.join(path, "/**/tasks/**/*.rake")].sort.each { |ext| load ext }
|
63
|
+
#{only_if_end}
|
55
64
|
eos
|
56
65
|
end
|
57
66
|
puts "Linked #{gem_name} (currently #{version}) via 'vendor/gems/#{target_dir}'"
|
data/website/index.html
CHANGED
@@ -64,7 +64,7 @@ $ gemsonrails</pre>
|
|
64
64
|
<p>This installs some rake tasks into your app to help you freeze or link gems:</p>
|
65
65
|
|
66
66
|
|
67
|
-
<pre>$ rake -T | grep "gems:"
|
67
|
+
<pre syntax="ruby">$ rake -T | grep "gems:"
|
68
68
|
rake gems:freeze # Freeze a RubyGem into this Rails application; init.rb will be loaded on startup.
|
69
69
|
rake gems:link # Link a RubyGem into this Rails application; init.rb will be loaded on startup.
|
70
70
|
rake gems:unfreeze # Unfreeze/unlink a RubyGem from this Rails application
|
@@ -73,7 +73,7 @@ rake gems:unfreeze # Unfreeze/unlink a RubyGem from this Rails application
|
|
73
73
|
<p>Finally, for each gem your application uses you can either freeze a version into the app (only for gems that do not require native compilation), or link a gem with your app (useful for gems that require native compilation)</p>
|
74
74
|
|
75
75
|
|
76
|
-
<pre>$ rake gems:freeze GEM=map_by_method
|
76
|
+
<pre syntax="ruby">$ rake gems:freeze GEM=map_by_method
|
77
77
|
Unpacked map_by_method 0.6.0 to 'map_by_method-0.6.0'
|
78
78
|
|
79
79
|
$ ls vendor/gems/map_by_method-0.6.0/
|
@@ -83,6 +83,19 @@ $ cat vendor/gems/map_by_method-0.6.0/init.rb
|
|
83
83
|
require File.join(File.dirname(__FILE__), 'lib', 'map_by_method')
|
84
84
|
</pre>
|
85
85
|
|
86
|
+
<h2>Restricting which environments a gem is loaded into</h2>
|
87
|
+
|
88
|
+
|
89
|
+
<p>You can restrict which <span class="caps">RAILS</span>_ENVs the gem will be loaded for, using <span class="caps">ONLY</span>; e.g.</p>
|
90
|
+
|
91
|
+
|
92
|
+
<pre syntax="ruby">$ rake gems:freeze GEM=<gemname> ONLY=development
|
93
|
+
$ rake gems:link GEM=<gemname> ONLY=production,staging
|
94
|
+
</pre>
|
95
|
+
|
96
|
+
<p>In the former, only in <strong>development</strong> mode will the gem be loaded. In the latter, only in <strong>production</strong> or <strong>staging</strong> mode will the gem be loaded from the deployment gem server</p>
|
97
|
+
|
98
|
+
|
86
99
|
<h2>Upgrading from old GemsOnRails versions</h2>
|
87
100
|
|
88
101
|
|
@@ -106,7 +119,7 @@ require File.join(File.dirname(__FILE__), 'lib', 'map_by_method')
|
|
106
119
|
|
107
120
|
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
|
108
121
|
<p class="coda">
|
109
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
122
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 11th May 2007<br>
|
110
123
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
111
124
|
</p>
|
112
125
|
</div>
|
data/website/index.txt
CHANGED
@@ -21,7 +21,7 @@ $ gemsonrails</pre>
|
|
21
21
|
|
22
22
|
This installs some rake tasks into your app to help you freeze or link gems:
|
23
23
|
|
24
|
-
<pre>$ rake -T | grep "gems:"
|
24
|
+
<pre syntax="ruby">$ rake -T | grep "gems:"
|
25
25
|
rake gems:freeze # Freeze a RubyGem into this Rails application; init.rb will be loaded on startup.
|
26
26
|
rake gems:link # Link a RubyGem into this Rails application; init.rb will be loaded on startup.
|
27
27
|
rake gems:unfreeze # Unfreeze/unlink a RubyGem from this Rails application
|
@@ -29,7 +29,7 @@ rake gems:unfreeze # Unfreeze/unlink a RubyGem from this Rails application
|
|
29
29
|
|
30
30
|
Finally, for each gem your application uses you can either freeze a version into the app (only for gems that do not require native compilation), or link a gem with your app (useful for gems that require native compilation)
|
31
31
|
|
32
|
-
<pre>$ rake gems:freeze GEM=map_by_method
|
32
|
+
<pre syntax="ruby">$ rake gems:freeze GEM=map_by_method
|
33
33
|
Unpacked map_by_method 0.6.0 to 'map_by_method-0.6.0'
|
34
34
|
|
35
35
|
$ ls vendor/gems/map_by_method-0.6.0/
|
@@ -39,6 +39,16 @@ $ cat vendor/gems/map_by_method-0.6.0/init.rb
|
|
39
39
|
require File.join(File.dirname(__FILE__), 'lib', 'map_by_method')
|
40
40
|
</pre>
|
41
41
|
|
42
|
+
h2. Restricting which environments a gem is loaded into
|
43
|
+
|
44
|
+
You can restrict which RAILS_ENVs the gem will be loaded for, using ONLY; e.g.
|
45
|
+
|
46
|
+
<pre syntax="ruby">$ rake gems:freeze GEM=<gemname> ONLY=development
|
47
|
+
$ rake gems:link GEM=<gemname> ONLY=production,staging
|
48
|
+
</pre>
|
49
|
+
|
50
|
+
In the former, only in *development* mode will the gem be loaded. In the latter, only in *production* or *staging* mode will the gem be loaded from the deployment gem server
|
51
|
+
|
42
52
|
h2. Upgrading from old GemsOnRails versions
|
43
53
|
|
44
54
|
All the freezing and linking functionality is in the plugin installed by the <code>gemsonrails</code> command. To upgrade, simple install the new gem version, and re-run the <code>gemsonrails</code> command. You application will now have the newest rake tasks and functionality.
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: gemsonrails
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2007-05-11 00:00:00 +02:00
|
8
8
|
summary: Link or freeze RubyGems into your rails apps, instead of plugins
|
9
9
|
require_paths:
|
10
10
|
- lib
|