rails2_rubygems2_compatibility 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTJmYmYwMzJkNmNjNTdiZjQ4YTQ4NjNjNTMyMmQ4Y2YzYjdjMjcyYg==
5
+ data.tar.gz: !binary |-
6
+ YTBlMTllNzdjNGIyYmNhYjQwNzU3NjJmMzAxZWE0NTQ4YjlmMzJiZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZmQxNzJmNGI4Mjg0MDY1MzFlZTk3MzliMDU1MTQxY2Q0Yzg5ZGI1NmE2YTAw
10
+ NGY2ZDJhZGI0MDMzM2I1YTJiNzA0MDllMmZhNDlkNjgzNjljMDk5NTVmMjNk
11
+ NGJlZDY0ZmFlMTc5MGNmZGE0OGYxZjUwMWE0MGE3MDZmOWFiY2E=
12
+ data.tar.gz: !binary |-
13
+ MmJhYWM1YjQ5MGI3YzFhNTZmYjQxYzI1OTRhZTE1ZDI5NjcyZjE5OWE0NzYz
14
+ MWQwOTk1OTdiZjExZDc4MTNkMGZkYzkxOWY1ZjU4NzEwYTgzYjhiNDAyNjkz
15
+ MzEyOGRiZmFmMDBiZTVkOGNiZGUyYzU4MmZlZGVhYWNjYTYwZmY=
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Tom Preston-Werner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ Rails 2 Rubygem 2 Compatibility
2
+ ===============================
3
+
4
+ # DESCRIPTION
5
+
6
+
7
+ # INSTALLATION
8
+
9
+ ```ruby
10
+ gem install rails2_rubygems2_compatibility
11
+ ```
12
+
13
+ or add to your Gemfile:
14
+ ```ruby
15
+ gem 'rails2_rubygems2_compatibility'
16
+ ```
17
+
18
+ or link to edge:
19
+ ```ruby
20
+ gem 'rails2_rubygems2_compatibility', github: 'sealink/rails2_rubygems2_compatibility'
21
+ ```
22
+
23
+ # SYNOPSIS
24
+
25
+ Add the following to your config/preinitializer.rb (or wherever, immediately after Bundler.setup):
26
+ ```ruby
27
+ require 'rails2_rubygems2_compatibility'
28
+ ```
data/Rakefile ADDED
@@ -0,0 +1,125 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ def date
21
+ Date.today.to_s
22
+ end
23
+
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
+ end
39
+
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ desc "Open an irb session preloaded with this library"
47
+ task :console do
48
+ sh "irb -rubygems -r ./lib/#{name}.rb"
49
+ end
50
+
51
+ #############################################################################
52
+ #
53
+ # Custom tasks (add your own tasks here)
54
+ #
55
+ #############################################################################
56
+
57
+ task :default => :build
58
+
59
+ #############################################################################
60
+ #
61
+ # Packaging tasks
62
+ #
63
+ #############################################################################
64
+
65
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
66
+ task :release => :build do
67
+ unless `git branch` =~ /^\* master$/
68
+ puts "You must be on the master branch to release!"
69
+ exit!
70
+ end
71
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
72
+ sh "git tag v#{version}"
73
+ sh "git push origin master"
74
+ sh "git push origin v#{version}"
75
+ sh "gem push pkg/#{name}-#{version}.gem"
76
+ end
77
+
78
+ desc "Build #{gem_file} into the pkg directory"
79
+ task :build => :gemspec do
80
+ sh "mkdir -p pkg"
81
+ sh "gem build #{gemspec_file}"
82
+ sh "mv #{gem_file} pkg"
83
+ end
84
+
85
+ desc "Generate #{gemspec_file}"
86
+ task :gemspec => :validate do
87
+ # read spec file and split out manifest section
88
+ spec = File.read(gemspec_file)
89
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
90
+
91
+ # replace name version and date
92
+ replace_header(head, :name)
93
+ replace_header(head, :version)
94
+ replace_header(head, :date)
95
+ #comment this out if your rubyforge_project has a different name
96
+ replace_header(head, :rubyforge_project)
97
+
98
+ # determine file list from git ls-files
99
+ files = `git ls-files`.
100
+ split("\n").
101
+ sort.
102
+ reject { |file| file =~ /^\./ }.
103
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
104
+ map { |file| " #{file}" }.
105
+ join("\n")
106
+
107
+ # piece file back together and write
108
+ manifest = " s.files = %w[\n#{files}\n ]\n"
109
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
110
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
111
+ puts "Updated #{gemspec_file}"
112
+ end
113
+
114
+ desc "Validate #{gemspec_file}"
115
+ task :validate do
116
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
117
+ unless libfiles.empty?
118
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
119
+ exit!
120
+ end
121
+ unless Dir['VERSION*'].empty?
122
+ puts "A `VERSION` file at root level violates Gem best practices."
123
+ exit!
124
+ end
125
+ end
@@ -0,0 +1,28 @@
1
+ module Rails2Rubygems2Compatibility
2
+ VERSION = '0.0.1'
3
+ end
4
+
5
+ # monkey patch. Will ignore vendor gems.
6
+ # Sources:
7
+ # http://djellemah.com/blog/2013/02/27/rails-23-with-ruby-20/
8
+ # http://stackoverflow.com/questions/15349869/undefined-method-source-index-for-gemmodule-nomethoderror
9
+ if Gem::VERSION >= '2.0.0'
10
+ module Gem
11
+ def self.source_index
12
+ sources
13
+ end
14
+
15
+ def self.cache
16
+ sources
17
+ end
18
+
19
+ SourceIndex = Specification
20
+
21
+ class SourceList
22
+ # If you want vendor gems, this is where to start writing code.
23
+ def search( *args ); []; end
24
+ def each( &block ); end
25
+ include Enumerable
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,71 @@
1
+ ## This is the rakegem gemspec template. Make sure you read and understand
2
+ ## all of the comments. Some sections require modification, and others can
3
+ ## be deleted if you don't need them. Once you understand the contents of
4
+ ## this file, feel free to delete any comments that begin with two hash marks.
5
+ ## You can find comprehensive Gem::Specification documentation, at
6
+ ## http://docs.rubygems.org/read/chapter/20
7
+ Gem::Specification.new do |s|
8
+ s.specification_version = 2 if s.respond_to? :specification_version=
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.rubygems_version = '1.3.5'
11
+
12
+ ## Leave these as is they will be modified for you by the rake gemspec task.
13
+ ## If your rubyforge_project name is different, then edit it and comment out
14
+ ## the sub! line in the Rakefile
15
+ s.name = 'rails2_rubygems2_compatibility'
16
+ s.version = '0.0.1'
17
+ s.date = '2013-07-12'
18
+
19
+ ## Make sure your summary is short. The description may be as long
20
+ ## as you like.
21
+ s.summary = "Provides compatibility for rails2 apps to use rubygems2."
22
+ s.description = "See README for full details on how to install, use, etc."
23
+
24
+ ## List the primary authors. If there are a bunch of authors, it's probably
25
+ ## better to set the email to an email list or something. If you don't have
26
+ ## a custom homepage, consider using your GitHub URL or the like.
27
+ s.authors = ["Michael Noack"]
28
+ s.email = 'development@travellink.com.au'
29
+ s.homepage = 'http://github.com/sealink/rails2_rubygems2_compatibility'
30
+
31
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
32
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
33
+ s.require_paths = %w[lib]
34
+
35
+ ## This sections is only necessary if you have C extensions.
36
+ # s.require_paths << 'ext'
37
+ # s.extensions = %w[ext/extconf.rb]
38
+
39
+ ## If your gem includes any executables, list them here.
40
+ # s.executables = ["name"]
41
+
42
+ ## Specify any RDoc options here. You'll want to add your README and
43
+ ## LICENSE files to the extra_rdoc_files list.
44
+ s.rdoc_options = ["--charset=UTF-8"]
45
+ s.extra_rdoc_files = %w[README.md LICENSE]
46
+
47
+ ## List your runtime dependencies here. Runtime dependencies are those
48
+ ## that are needed for an end user to actually USE your code.
49
+
50
+ ## List your development dependencies here. Development dependencies are
51
+ ## those that are only needed during development
52
+ # s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
53
+
54
+ ## Leave this section as-is. It will be automatically generated from the
55
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
56
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
57
+ # = MANIFEST =
58
+ s.files = %w[
59
+ Gemfile
60
+ LICENSE
61
+ README.md
62
+ Rakefile
63
+ lib/rails2_rubygems2_compatibility.rb
64
+ rails2_rubygems2_compatibility.gemspec
65
+ ]
66
+ # = MANIFEST =
67
+
68
+ ## Test files will be grabbed from the file list. Make sure the path glob
69
+ ## matches what you actually use.
70
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
71
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails2_rubygems2_compatibility
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Noack
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: See README for full details on how to install, use, etc.
14
+ email: development@travellink.com.au
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files:
18
+ - README.md
19
+ - LICENSE
20
+ files:
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - Rakefile
25
+ - lib/rails2_rubygems2_compatibility.rb
26
+ - rails2_rubygems2_compatibility.gemspec
27
+ homepage: http://github.com/sealink/rails2_rubygems2_compatibility
28
+ licenses: []
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options:
32
+ - --charset=UTF-8
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.0.4
48
+ signing_key:
49
+ specification_version: 2
50
+ summary: Provides compatibility for rails2 apps to use rubygems2.
51
+ test_files: []