frozen_gems_generator 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
Binary file
data/History.txt ADDED
@@ -0,0 +1,7 @@
1
+ === 0.4.0 / 2008-03-03
2
+
3
+ * conversion from plugin to gem
4
+
5
+ === 0.3.0 / 2008-02-29
6
+
7
+ * first public release
data/Manifest.txt ADDED
@@ -0,0 +1,10 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ ToDo.txt
6
+ generators/frozen_gems/USAGE
7
+ generators/frozen_gems/frozen_gems_generator.rb
8
+ generators/frozen_gems/templates/gem
9
+ generators/frozen_gems/templates/gems.rb
10
+ test/test_frozen_gems_generator.rb
data/README.txt ADDED
@@ -0,0 +1,81 @@
1
+ = frozen_gems_generator
2
+
3
+ http://opensource.thinkrelevance.com/wiki/FrozenGemsGenerator
4
+
5
+ == DESCRIPTION:
6
+
7
+ The frozen_gems generator gives your Rails application its own
8
+ private gem library, in vendor/gems, and a script/gem command for
9
+ managing that library.
10
+
11
+ To enable, run
12
+
13
+ script/generate frozen_gems
14
+
15
+ Scripts and tasks that load environment.rb will have access to the
16
+ application's gem library. Gems in the system-wide gem library are
17
+ still accessible to your app, but gems in the private library will
18
+ be found first. (One consequence of this is that 'script/gem list'
19
+ will show all of the gems installed in both libraries.)
20
+
21
+ == FEATURES/PROBLEMS:
22
+
23
+ Gems that have binary components install the binary components in
24
+ the system-wide Ruby lib directories. Thus, when such gems are
25
+ frozen and deployed, they will be incomplete. I recommend that you
26
+ install such gems in the system-wide gem library on development
27
+ machines and the deployment machine alike. Suggestions for a
28
+ satisfactory solution to this problem are welcome.
29
+
30
+ == SYNOPSIS:
31
+
32
+ To manage your app's gems, use the script/gem command (which is
33
+ just a wrapper for the standard gem command and uses the same
34
+ syntax). For example:
35
+
36
+ $ script/gem install xml-simple
37
+ Executing 'gem install' with --no-rdoc and --no-ri options
38
+ Bulk updating Gem source index for: http://gems.rubyforge.org
39
+ Successfully installed xml-simple-1.0.11
40
+
41
+ Gems are installed without RDoc and ri documentation; other than
42
+ that, the behavior should be the same as the standard gem command.
43
+ (Due to a bug in some versions of RubyGems, the first attempted
44
+ installation may fail; subsequent attempts should succeed.)
45
+
46
+ == REQUIREMENTS:
47
+
48
+ FrozenGems assumes Rails 2.0 or greater, due to its dependency on
49
+ preinitializer.rb. If you're using an earlier version of Rails,
50
+ you can copy the contents of config/preinitializer.rb into
51
+ config/environment.rb, just prior to the call to Rails::Initializer.run.
52
+
53
+ == INSTALL:
54
+
55
+ * sudo gem install frozen_gems_generator
56
+ * script/generate frozen_gems
57
+
58
+ == LICENSE:
59
+
60
+ (The MIT License)
61
+
62
+ Copyright (c) 2008 Glenn Vanderburg
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining
65
+ a copy of this software and associated documentation files (the
66
+ 'Software'), to deal in the Software without restriction, including
67
+ without limitation the rights to use, copy, modify, merge, publish,
68
+ distribute, sublicense, and/or sell copies of the Software, and to
69
+ permit persons to whom the Software is furnished to do so, subject to
70
+ the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be
73
+ included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
76
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
77
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
78
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
79
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
80
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
81
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ gem 'rails'
6
+ require 'rails_generator'
7
+ require 'generators/frozen_gems/frozen_gems_generator.rb'
8
+
9
+ Hoe.new('frozen_gems_generator', FrozenGemsGenerator::VERSION) do |p|
10
+ p.rubyforge_name = 'thinkrelevance'
11
+ p.author = 'Glenn Vanderburg'
12
+ p.email = ['glenn@thinkrelevance.com', 'glv@vanderburg.org']
13
+ p.summary = 'Application-specific gem libraries for Rails projects.'
14
+ p.description = p.paragraphs_of('README.txt', 3..5).join("\n\n")
15
+ p.url = p.paragraphs_of('README.txt', 1).first.split(/\n/)[0]
16
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
+ p.extra_deps = %w{rails}
18
+ p.spec_extras = {
19
+ :require_paths => ['generators/frozen_gems'],
20
+ :has_rdoc => false
21
+ }
22
+ end
23
+
24
+ # vim: syntax=Ruby
data/ToDo.txt ADDED
@@ -0,0 +1,2 @@
1
+ * handle gems with binary components
2
+ * add --frozen option (analogous to --local) to restrict operations to *only* the frozen repository.
@@ -0,0 +1,12 @@
1
+ Description:
2
+ Installs and patches files to provide a frozen, application-specific gem library.
3
+
4
+ Example:
5
+ ./script/generate frozen_gems
6
+
7
+ This will create:
8
+ script/gem
9
+ config/gems.rb
10
+
11
+ and create or patch (as necessary):
12
+ config/preinitializer.rb
@@ -0,0 +1,81 @@
1
+ class FrozenGemsGenerator < Rails::Generator::Base
2
+ VERSION = '0.4.0'
3
+
4
+ def manifest
5
+ record do |m|
6
+ m.file 'gem', 'script/gem', :chmod => 0755, :shebang => '/usr/bin/env ruby'
7
+ m.file 'gems.rb', 'config/gems.rb'
8
+
9
+ m.preinitialize <<-EOFRAG
10
+ # Before plugins get loaded, activate FrozenGems private gem library
11
+ require 'rubygems'
12
+ require File.join(File.dirname(__FILE__), 'gems')
13
+ EOFRAG
14
+ end
15
+ end
16
+ end
17
+
18
+ require 'rails_generator/simple_logger'
19
+
20
+ module Rails
21
+ module Generator
22
+ module Commands
23
+
24
+ class Base
25
+ protected
26
+
27
+ def match_in_file(file, regexp)
28
+ File.read(file) =~ regexp
29
+ end
30
+ end
31
+
32
+ class Create
33
+ def preinitialize(fragment)
34
+ pre_path = "config/preinitializer.rb"
35
+ full_path = destination_path(pre_path)
36
+ destination_exists = File.exists?(full_path)
37
+
38
+ if destination_exists && match_in_file(full_path, /(#{Regexp.escape(fragment)})/mi)
39
+ logger.exists "#{pre_path} (patch)"
40
+ return
41
+ elsif destination_exists
42
+ logger.patch pre_path
43
+ else
44
+ logger.create pre_path
45
+ end
46
+ unless options[:pretend]
47
+ File.open(full_path, "w+") do |pre_file|
48
+ pre_file.puts
49
+ pre_file.puts fragment
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ class Destroy
56
+ def preinitialize(fragment)
57
+ pre_path = "config/preinitializer.rb"
58
+ full_path = destination_path(pre_path)
59
+ patch_re = /(#{Regexp.escape(fragment)})/mi
60
+
61
+ if File.exists?(full_path) && match_in_file(full_path, patch_re)
62
+ logger.unpatch pre_path
63
+ else
64
+ logger.skip pre_path
65
+ return
66
+ end
67
+
68
+ gsub_file pre_path, patch_re, ''
69
+ end
70
+ end
71
+
72
+ class List
73
+ def preinitialize(fragment)
74
+ resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
75
+ logger.preinit "config/preinitializer.rb (patch)"
76
+ end
77
+ end
78
+
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # Part of FrozenGems
3
+ FROZEN_GEMS_SCRIPT_GEM = true
4
+
5
+ require File.dirname(__FILE__) + '/../config/gems'
6
+ args = ARGV.dup
7
+ args.each_with_index do |arg, i|
8
+ unless arg =~ /^-/ # find subcommand
9
+ if arg =~ /^(install|update)$/
10
+ args.insert(i+1, '--no-rdoc', '--no-ri')
11
+ puts "Executing 'gem #{$1}' with --no-rdoc and --no-ri options"
12
+ end
13
+ break
14
+ end
15
+ end
16
+
17
+ system('gem', *args)
@@ -0,0 +1,23 @@
1
+ # Part of FrozenGems
2
+ local_gem_repos = File.expand_path(File.dirname(__FILE__) + '/../vendor/gems')
3
+
4
+ gems_loaded = Gem::RubyGemsVersion rescue false
5
+
6
+ if Object.const_defined? :FROZEN_GEMS_SCRIPT_GEM || !gems_loaded
7
+ sep = File::PATH_SEPARATOR
8
+ existing_gem_path = `gem environment gempath`.chomp.gsub($/, sep)
9
+ ENV['GEM_HOME'] = local_gem_repos
10
+ ENV['GEM_PATH'] = local_gem_repos + sep + existing_gem_path
11
+ else
12
+ paths = Gem.path.dup
13
+ paths.insert(0, local_gem_repos)
14
+ Gem.use_paths local_gem_repos, paths
15
+ module Gem
16
+ def self.reset_searcher
17
+ MUTEX.synchronize do
18
+ @searcher = nil
19
+ end
20
+ end
21
+ end
22
+ Gem.reset_searcher
23
+ end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ class TestFrozenGemsGenerator < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_this_generator
6
+ flunk
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: frozen_gems_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Glenn Vanderburg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDRDCCAiygAwIBAgIBADANBgkqhkiG9w0BAQUFADBIMQ4wDAYDVQQDDAVnbGVu
14
+ bjEeMBwGCgmSJomT8ixkARkWDnRoaW5rcmVsZXZhbmNlMRYwFAYKCZImiZPyLGQB
15
+ GRYGY29tZ2x2MB4XDTA4MDMwNDIwNDIzNFoXDTA5MDMwNDIwNDIzNFowSDEOMAwG
16
+ A1UEAwwFZ2xlbm4xHjAcBgoJkiaJk/IsZAEZFg50aGlua3JlbGV2YW5jZTEWMBQG
17
+ CgmSJomT8ixkARkWBmNvbWdsdjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBALXdD5Y00ZMPO/dL8sj1IcfomhezB+9rsO/FoCnR9TJyaOGPBAJBEfyA3SkP
19
+ hpbCkkUDpNlRR2sQHrtqBJovpw2oX6zakrG8PnDQQPU1oo0tWkiDtPFQc9lgDJOA
20
+ S/nQiS2D9rusOmpj84KpC6DUN80M+ap9z04Xadobuv7Cer/dTOfs4skUBiN/aonA
21
+ qtaRNOlOPGyPGiCa8tUQd53fVml2hSKIgt/+HfBHHWZkHs9UQRsqd7GICFi5R24i
22
+ ZNXbaRzw4637eCcjBhlEes9KMJOwayZ1KXHWzOdSzRJUI6nT4AQjw3GCyuXBmCY0
23
+ LFrbGOLYuqfiv/zr+Z+qqyI3Ul0CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8E
24
+ BAMCBLAwHQYDVR0OBBYEFOsd6jtw384ogcRecKkFdFpm9SQkMA0GCSqGSIb3DQEB
25
+ BQUAA4IBAQBokYH6Pe63OU1O9t4z6jEom2NDieUlLWD9PTshI4UXUjxd83mjmg/Y
26
+ Cer/yqFHqQEW6BLNRmH6l2lw2Rb8CZdlh7K8Q8F/94M+actty2UvMgTyVEtOnyh/
27
+ QU8nqEil5vl7ppCwDeSF32cebsQoimkgAamOxVZVe5ipP1+UIO+Eu92Jt5k0hrnd
28
+ 1Fz3W+wrffm45P2X/6Z36dXgZKn8dlHuYtsqgpQxBC92oE7UqHXvwAu3FFe+1EV7
29
+ LrV1pr2EyieDotJOooYNz/E+9ZeL14MBhDOVmPr4KHTTK4VwdxFtAKu2QK/NfAAl
30
+ zrNa6ECLh1VS/pV78rYbAO1ZXsg3l7bY
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2008-03-04 00:00:00 -06:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rails
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: hoe
47
+ version_requirement:
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.5.0
53
+ version:
54
+ description: The frozen_gems generator gives your Rails application its own private gem library, in vendor/gems, and a script/gem command for managing that library. To enable, run script/generate frozen_gems
55
+ email:
56
+ - glenn@thinkrelevance.com
57
+ - glv@vanderburg.org
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - History.txt
64
+ - Manifest.txt
65
+ - README.txt
66
+ - ToDo.txt
67
+ files:
68
+ - History.txt
69
+ - Manifest.txt
70
+ - README.txt
71
+ - Rakefile
72
+ - ToDo.txt
73
+ - generators/frozen_gems/USAGE
74
+ - generators/frozen_gems/frozen_gems_generator.rb
75
+ - generators/frozen_gems/templates/gem
76
+ - generators/frozen_gems/templates/gems.rb
77
+ - test/test_frozen_gems_generator.rb
78
+ has_rdoc: false
79
+ homepage: http://opensource.thinkrelevance.com/wiki/FrozenGemsGenerator
80
+ post_install_message:
81
+ rdoc_options:
82
+ - --main
83
+ - README.txt
84
+ require_paths:
85
+ - generators/frozen_gems
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
97
+ version:
98
+ requirements: []
99
+
100
+ rubyforge_project: thinkrelevance
101
+ rubygems_version: 1.0.1
102
+ signing_key:
103
+ specification_version: 2
104
+ summary: Application-specific gem libraries for Rails projects.
105
+ test_files:
106
+ - test/test_frozen_gems_generator.rb
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ �&|^��-Q�^���;rp�H�v��˥�V�r:�[B�m�PVW�� ��o�(�ϔ�pܭ�?Ow� �:98� ق4������$v�}�EN�CV
2
+ B�^� c�w�w��I�Q�������=ְ�J~ܪ��Ik�k�Se��hF�_��z@]�Ʈ���-O{=&�Ck�J=CN�t��YJ��?��U���|�X�