portal_gun 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +151 -0
- data/Rakefile +6 -0
- data/SampleGemfile +53 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/portal_gun +7 -0
- data/lib/portal_gun.rb +10 -0
- data/lib/portal_gun/firing.rb +91 -0
- data/lib/portal_gun/ruby_versions.rb +228 -0
- data/lib/portal_gun/version.rb +3 -0
- data/portal_gun.gemspec +41 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0fc023ff877369dea61a8b085bb9dffdce425748
|
4
|
+
data.tar.gz: a09ebf2c8556db2721a2e2dc0a13468e3df52486
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b79a71a2e521c58b4316a3deb5abd3eef7f42083134b8bf0e32382ae24a97e1eaa846d59ccc79f6b5fdafa44a9d75e16ade7d57068e6bfec8b117a6ac60dc71
|
7
|
+
data.tar.gz: 6a976831e69e381f44928883e2dbd3e9a7d7ece50bb13e6ba189bb19fd6daf4dcf0597e39f469bdd487616f7723a89e511d7975404eea465d83308260e53dc65
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at nick.schwaderer@oceanshq.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Nick Schwaderer
|
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,151 @@
|
|
1
|
+
# PortalGun (Not Live - Yet)
|
2
|
+
|
3
|
+
PortalGun allows developers to regenerate an entire Gemfile with the latest Gem
|
4
|
+
versions based on a particular point in history.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install portal_gun
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
This gem will allow you to fire up old Rails applications immediately out of
|
13
|
+
the box, impress your friends, or enjoy casual inter-dimensional-ruby-based-time-travel.
|
14
|
+
|
15
|
+
Here's the simplest use case you can try today.
|
16
|
+
|
17
|
+
If you were to generate a vanilla Rails application right now, this
|
18
|
+
would be your Gemfile out of the box:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
source 'https://rubygems.org'
|
22
|
+
|
23
|
+
git_source(:github) do |repo_name|
|
24
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
25
|
+
"https://github.com/#{repo_name}.git"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
30
|
+
gem 'rails', '~> 5.0.2'
|
31
|
+
# Use sqlite3 as the database for Active Record
|
32
|
+
gem 'sqlite3'
|
33
|
+
# Use Puma as the app server
|
34
|
+
gem 'puma', '~> 3.0'
|
35
|
+
# Use SCSS for stylesheets
|
36
|
+
gem 'sass-rails', '~> 5.0'
|
37
|
+
# Use Uglifier as compressor for JavaScript assets
|
38
|
+
gem 'uglifier', '>= 1.3.0'
|
39
|
+
# Use CoffeeScript for .coffee assets and views
|
40
|
+
gem 'coffee-rails', '~> 4.2'
|
41
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
42
|
+
# gem 'therubyracer', platforms: :ruby
|
43
|
+
|
44
|
+
# Use jquery as the JavaScript library
|
45
|
+
gem 'jquery-rails'
|
46
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
47
|
+
gem 'turbolinks', '~> 5'
|
48
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
49
|
+
gem 'jbuilder', '~> 2.5'
|
50
|
+
# Use Redis adapter to run Action Cable in production
|
51
|
+
# gem 'redis', '~> 3.0'
|
52
|
+
# Use ActiveModel has_secure_password
|
53
|
+
# gem 'bcrypt', '~> 3.1.7'
|
54
|
+
|
55
|
+
# Use Capistrano for deployment
|
56
|
+
# gem 'capistrano-rails', group: :development
|
57
|
+
|
58
|
+
group :development, :test do
|
59
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
60
|
+
gem 'byebug', platform: :mri
|
61
|
+
end
|
62
|
+
|
63
|
+
group :development do
|
64
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
65
|
+
gem 'web-console', '>= 3.3.0'
|
66
|
+
gem 'listen', '~> 3.0.5'
|
67
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
68
|
+
gem 'spring'
|
69
|
+
end
|
70
|
+
|
71
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
72
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
73
|
+
```
|
74
|
+
|
75
|
+
After you've installed PortalGun, all you need to do is cd into the application's directory, and run `portal_gun 3.years.ago /path/to/Gemfile`.
|
76
|
+
|
77
|
+
In the file `Rails.root/GemfileYYYYMMDD` you now have:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
#This Gemfile has been generated by PortalGun. If you have any issues please report to https://github.com/schwad/github
|
81
|
+
#These are the most stable versions of the three latest minor ruby releases as of this point in time. Uncomment the one you wish to use.
|
82
|
+
|
83
|
+
#ruby 1.9.3-p547
|
84
|
+
#ruby 2.1.2
|
85
|
+
#ruby 2.0.0-p481
|
86
|
+
|
87
|
+
|
88
|
+
source 'https://rubygems.org'
|
89
|
+
|
90
|
+
git_source(:github) do |repo_name|
|
91
|
+
repo_name = '#{repo_name}/#{repo_name}' unless repo_name.include?('/')
|
92
|
+
'https://github.com/#{repo_name}.git'
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
97
|
+
gem 'rails', '~> 4.1.0.rc2'
|
98
|
+
# Use sqlite3 as the database for Active Record
|
99
|
+
gem 'sqlite3', '~> 1.3.9'
|
100
|
+
# Use Puma as the app server
|
101
|
+
gem 'puma', '~> 2.8.1'
|
102
|
+
# Use SCSS for stylesheets
|
103
|
+
gem 'sass-rails', '~> 4.0.3'
|
104
|
+
# Use Uglifier as compressor for JavaScript assets
|
105
|
+
gem 'uglifier', '~> 2.5.0'
|
106
|
+
# Use CoffeeScript for .coffee assets and views
|
107
|
+
gem 'coffee-rails', '~> 4.0.1'
|
108
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
109
|
+
# gem 'therubyracer', platforms: :ruby
|
110
|
+
|
111
|
+
# Use jquery as the JavaScript library
|
112
|
+
gem 'jquery-rails', '~> 3.1.0'
|
113
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
114
|
+
gem 'turbolinks', '~> 2.2.2'
|
115
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
116
|
+
gem 'jbuilder', '~> 2.0.5'
|
117
|
+
# Use Redis adapter to run Action Cable in production
|
118
|
+
# gem 'redis', '~> 3.0'
|
119
|
+
# Use ActiveModel has_secure_password
|
120
|
+
# gem 'bcrypt', '~> 3.1.7'
|
121
|
+
|
122
|
+
# Use Capistrano for deployment
|
123
|
+
# gem 'capistrano-rails', group: :development
|
124
|
+
|
125
|
+
group :development, :test do
|
126
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
127
|
+
gem 'byebug', '~> 2.7.0'
|
128
|
+
end
|
129
|
+
|
130
|
+
group :development do
|
131
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
132
|
+
gem 'web-console', '~> 1.0.4'
|
133
|
+
gem 'listen', '~> 2.7.1'
|
134
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
135
|
+
gem 'spring', '~> 1.1.2'
|
136
|
+
end
|
137
|
+
|
138
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
139
|
+
gem 'tzinfo-data', '~> 1.2014.2'
|
140
|
+
```
|
141
|
+
|
142
|
+
One handy little thing it does there is generate the latest stable versions of the most recent three ruby minor versions
|
143
|
+
for you to play with (i.e. as of writing it would be `2.4`, `2.3`, `2.2`) to run your application on.
|
144
|
+
|
145
|
+
Note that this test case is run against an existing "new" application's gemfile. Where this would really shine is against
|
146
|
+
an older Rails application with a decent number of Gems not pointing to specific versions, but a code base that relies on
|
147
|
+
the older versions of those gems.
|
148
|
+
|
149
|
+
## License
|
150
|
+
|
151
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/SampleGemfile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) do |repo_name|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
+
"https://github.com/#{repo_name}.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
10
|
+
gem 'rails', '~> 5.0.2'
|
11
|
+
# Use sqlite3 as the database for Active Record
|
12
|
+
gem 'sqlite3'
|
13
|
+
# Use Puma as the app server
|
14
|
+
gem 'puma', '~> 3.0'
|
15
|
+
# Use SCSS for stylesheets
|
16
|
+
gem 'sass-rails', '~> 5.0'
|
17
|
+
# Use Uglifier as compressor for JavaScript assets
|
18
|
+
gem 'uglifier', '>= 1.3.0'
|
19
|
+
# Use CoffeeScript for .coffee assets and views
|
20
|
+
gem 'coffee-rails', '~> 4.2'
|
21
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
22
|
+
# gem 'therubyracer', platforms: :ruby
|
23
|
+
|
24
|
+
# Use jquery as the JavaScript library
|
25
|
+
gem 'jquery-rails'
|
26
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
27
|
+
gem 'turbolinks', '~> 5'
|
28
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
29
|
+
gem 'jbuilder', '~> 2.5'
|
30
|
+
# Use Redis adapter to run Action Cable in production
|
31
|
+
# gem 'redis', '~> 3.0'
|
32
|
+
# Use ActiveModel has_secure_password
|
33
|
+
# gem 'bcrypt', '~> 3.1.7'
|
34
|
+
|
35
|
+
# Use Capistrano for deployment
|
36
|
+
# gem 'capistrano-rails', group: :development
|
37
|
+
|
38
|
+
group :development, :test do
|
39
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
40
|
+
gem 'byebug', platform: :mri
|
41
|
+
end
|
42
|
+
|
43
|
+
group :development do
|
44
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
45
|
+
gem 'web-console', '>= 3.3.0'
|
46
|
+
gem 'listen', '~> 3.0.5'
|
47
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
48
|
+
gem 'spring'
|
49
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
53
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "portal_gun"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/portal_gun
ADDED
data/lib/portal_gun.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
module PortalGun
|
2
|
+
class Firing
|
3
|
+
require 'date'
|
4
|
+
require 'mechanize'
|
5
|
+
require 'active_support/all'
|
6
|
+
|
7
|
+
def start(date=nil, gem_file_source=nil, ruby_versions=nil)
|
8
|
+
date = eval(date) unless date.nil?
|
9
|
+
gem_file_source ||= "Gemfile"
|
10
|
+
puts "I don't know about this Rick...."
|
11
|
+
date ||= (Date.today - 365)
|
12
|
+
write_line(intro_block)
|
13
|
+
|
14
|
+
write_line("#These are the most stable versions of the three latest minor ruby releases as of this point in time. Uncomment the one you wish to use.\n")
|
15
|
+
ruby_versions.each do |rv|
|
16
|
+
write_line "#ruby #{rv}"
|
17
|
+
end
|
18
|
+
write_line("\n")
|
19
|
+
read_gem_file(gem_file_source).each do |line|
|
20
|
+
if valid_gem_line(line)
|
21
|
+
puts "Now processing: #{line}"
|
22
|
+
write_line(find_latest_by_date(date, line))
|
23
|
+
else
|
24
|
+
write_line(line)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def intro_block
|
32
|
+
"#This Gemfile has been generated by PortalGun. If you have any issues please report to https://github.com/schwad/github"
|
33
|
+
end
|
34
|
+
|
35
|
+
def read_gem_file(input_file)
|
36
|
+
lines = []
|
37
|
+
File.open(input_file).each do |line|
|
38
|
+
lines << line.gsub("\n", "").gsub("\"", "'")
|
39
|
+
end
|
40
|
+
lines
|
41
|
+
end
|
42
|
+
|
43
|
+
def track_whitespace(line)
|
44
|
+
@whitespace_line = /(\s*).*/.match(line)[1]
|
45
|
+
end
|
46
|
+
|
47
|
+
def cleanup_gemline(gemline)
|
48
|
+
gemline.scan(/\s*gem '(.*)[',|']/)[0][0].split(",")[0].gsub("'", "")
|
49
|
+
end
|
50
|
+
|
51
|
+
def valid_gem_line(line)
|
52
|
+
if ((/\s*gem/ =~ line) == 0)
|
53
|
+
track_whitespace(line)
|
54
|
+
true
|
55
|
+
else
|
56
|
+
track_whitespace("")
|
57
|
+
false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def no_specification_valid_gem_line(line)
|
62
|
+
(/,|~>|>=/ =~ line).nil? && /^gem/ =~ line
|
63
|
+
end
|
64
|
+
|
65
|
+
def find_latest_by_date(date, input)
|
66
|
+
current_gem = cleanup_gemline(input)
|
67
|
+
rubygem_page = Mechanize.new
|
68
|
+
latest = nil
|
69
|
+
rubygem_page = rubygem_page.get("https://rubygems.org/gems/#{current_gem}/versions")
|
70
|
+
rubygem_page.search("li.gem__version-wrap").each do |possible_version|
|
71
|
+
if inspect_date(possible_version.search("small.gem__version__date")[0].text, date)
|
72
|
+
latest = possible_version.search("a.t-list__item")[0].text
|
73
|
+
puts "PORTAL GUN FIRE! Version as of #{date} for #{current_gem} is #{latest}"
|
74
|
+
break
|
75
|
+
end
|
76
|
+
end
|
77
|
+
"gem \'#{current_gem}\', \'~> #{latest}\'"
|
78
|
+
end
|
79
|
+
|
80
|
+
def inspect_date(input, date)
|
81
|
+
Date.parse(input[2..-1]) < date
|
82
|
+
end
|
83
|
+
|
84
|
+
def write_line(line)
|
85
|
+
File.open("Portal_Gemfile", "a") do |file|
|
86
|
+
file.write "#{@whitespace_line}#{line}\n"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
# start(Date.today - 150, "SampleGemfile")
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
module PortalGun
|
2
|
+
RUBY_VERSIONS = [
|
3
|
+
['1995-12-21', '0.95'],
|
4
|
+
['1996-12-25', '1.0-961225'],
|
5
|
+
['1997-12-25', '1.0-971225'],
|
6
|
+
['1998-07-17', '1.1c0'],
|
7
|
+
['1998-07-24', '1.1c1'],
|
8
|
+
['1998-08-11', '1.1c2'],
|
9
|
+
['1998-08-27', '1.1c3'],
|
10
|
+
['1998-09-03', '1.1c4'],
|
11
|
+
['1998-09-08', '1.1c5'],
|
12
|
+
['1998-10-05', '1.1c6'],
|
13
|
+
['1998-11-09', '1.1c7'],
|
14
|
+
['1998-11-19', '1.1c8'],
|
15
|
+
['1998-11-26', '1.1c9'],
|
16
|
+
['1998-12-25', '1.2'],
|
17
|
+
['1999-01-11', '1.2.1'],
|
18
|
+
['1999-01-12', '1.2.1'],
|
19
|
+
['1999-01-21', '1.2.2'],
|
20
|
+
['1999-02-16', '1.2.3'],
|
21
|
+
['1999-04-09', '1.2.4'],
|
22
|
+
['1999-04-13', '1.2.5'],
|
23
|
+
['1999-06-21', '1.2.6'],
|
24
|
+
['1999-08-13', '1.4.0'],
|
25
|
+
['1999-09-16', '1.4.1'],
|
26
|
+
['1999-09-17', '1.4.2'],
|
27
|
+
['1999-12-07', '1.4.3'],
|
28
|
+
['2000-04-14', '1.4.4'],
|
29
|
+
['2000-06-23', '1.4.5'],
|
30
|
+
['2000-08-16', '1.4.6'],
|
31
|
+
['2000-09-19', '1.6.0'],
|
32
|
+
['2000-09-27', '1.6.1'],
|
33
|
+
['2000-12-25', '1.6.2'],
|
34
|
+
['2001-03-20', '1.6.3'],
|
35
|
+
['2001-06-04', '1.6.4'],
|
36
|
+
['2001-09-19', '1.6.5'],
|
37
|
+
['2001-12-26', '1.6.6'],
|
38
|
+
['2002-03-01', '1.6.7'],
|
39
|
+
['2002-12-24', '1.6.8'],
|
40
|
+
['2003-08-04', '1.8.0'],
|
41
|
+
['2003-12-25', '1.8.1'],
|
42
|
+
['2004-12-25', '1.8.2'],
|
43
|
+
['2005-09-21', '1.8.3'],
|
44
|
+
['2005-12-24', '1.8.4'],
|
45
|
+
['2006-08-25', '1.8.5'],
|
46
|
+
['2006-12-04', '1.8.5-p2'],
|
47
|
+
['2006-12-25', '1.8.5-p12'],
|
48
|
+
['2007-03-13', '1.8.5-p35'],
|
49
|
+
['2007-03-13', '1.8.6'],
|
50
|
+
['2007-06-09', '1.8.5-p52'],
|
51
|
+
['2007-06-09', '1.8.6-p36'],
|
52
|
+
['2007-09-23', '1.8.5-p113'],
|
53
|
+
['2007-09-23', '1.8.6-p110'],
|
54
|
+
['2007-10-04', '1.8.5-p114'],
|
55
|
+
['2007-10-04', '1.8.6-p111'],
|
56
|
+
['2007-12-26', '1.9.0-0'],
|
57
|
+
['2008-03-03', '1.8.5-p115'],
|
58
|
+
['2008-03-03', '1.8.6-p114'],
|
59
|
+
['2008-06-01', '1.8.7'],
|
60
|
+
['2008-06-09', '1.8.7-p17'],
|
61
|
+
['2008-06-20', '1.8.5-p231'],
|
62
|
+
['2008-06-20', '1.8.6-p230'],
|
63
|
+
['2008-06-20', '1.8.7-p22'],
|
64
|
+
['2008-08-08', '1.8.6-p286'],
|
65
|
+
['2008-08-08', '1.8.7-p71'],
|
66
|
+
['2008-08-11', '1.8.6-p287'],
|
67
|
+
['2008-08-11', '1.8.7-p72'],
|
68
|
+
['2009-01-31', '1.9.1-p0'],
|
69
|
+
['2009-03-31', '1.8.6-p368'],
|
70
|
+
['2009-04-09', '1.8.7-p160'],
|
71
|
+
['2009-05-12', '1.9.1-p129'],
|
72
|
+
['2009-06-10', '1.8.6-p369'],
|
73
|
+
['2009-06-10', '1.8.7-p173'],
|
74
|
+
['2009-06-16', '1.8.7-p174'],
|
75
|
+
['2009-07-19', '1.9.1-p243'],
|
76
|
+
['2009-08-04', '1.8.6-p383'],
|
77
|
+
['2009-12-07', '1.9.1-p376'],
|
78
|
+
['2009-12-25', '1.8.7-p248'],
|
79
|
+
['2010-01-10', '1.8.7-p249'],
|
80
|
+
['2010-01-10', '1.9.1-p378'],
|
81
|
+
['2010-01-11', '1.8.6-p388'],
|
82
|
+
['2010-02-04', '1.8.6-p398'],
|
83
|
+
['2010-02-05', '1.8.6-p399'],
|
84
|
+
['2010-06-23', '1.8.7-p299'],
|
85
|
+
['2010-06-24', '1.8.7-p299'],
|
86
|
+
['2010-07-02', '1.9.1-p429'],
|
87
|
+
['2010-08-16', '1.9.1-p430'],
|
88
|
+
['2010-08-16', '1.8.7-p301'],
|
89
|
+
['2010-08-19', '1.9.2-p0'],
|
90
|
+
['2010-09-24', '1.8.6-p420'],
|
91
|
+
['2010-12-24', '1.8.7-p330'],
|
92
|
+
['2010-12-25', '1.9.2-p136'],
|
93
|
+
['2011-02-18', '1.9.1-p431'],
|
94
|
+
['2011-02-18', '1.9.2-p180'],
|
95
|
+
['2011-02-18', '1.8.7-p334'],
|
96
|
+
['2011-07-02', '1.8.7-p352'],
|
97
|
+
['2011-07-15', '1.9.2-p290'],
|
98
|
+
['2011-10-30', '1.9.3-p0'],
|
99
|
+
['2011-12-28', '1.8.7-p357'],
|
100
|
+
['2012-02-17', '1.9.3-p125'],
|
101
|
+
['2012-02-18', '1.9.2-p318'],
|
102
|
+
['2012-04-20', '1.9.3-p194'],
|
103
|
+
['2012-04-22', '1.9.2-p320'],
|
104
|
+
['2012-06-29', '1.8.7-p370'],
|
105
|
+
['2012-10-12', '1.8.7-p371'],
|
106
|
+
['2012-10-12', '1.9.3-p286'],
|
107
|
+
['2012-11-10', '1.9.3-p327'],
|
108
|
+
['2012-12-25', '1.9.3-p362'],
|
109
|
+
['2013-01-17', '1.9.3-p374'],
|
110
|
+
['2013-02-06', '1.9.3-p385'],
|
111
|
+
['2013-02-22', '1.9.3-p392'],
|
112
|
+
['2013-02-24', '2.0.0-p0'],
|
113
|
+
['2013-05-14', '1.9.3-p426'],
|
114
|
+
['2013-05-14', '2.0.0-p195'],
|
115
|
+
['2013-05-15', '1.9.3-p429'],
|
116
|
+
['2013-06-27', '1.8.7-p374'],
|
117
|
+
['2013-06-27', '1.9.3-p448'],
|
118
|
+
['2013-06-27', '2.0.0-p247'],
|
119
|
+
['2013-11-22', '1.9.3-p484'],
|
120
|
+
['2013-11-22', '2.0.0-p353'],
|
121
|
+
['2013-12-26', '2.1.0'],
|
122
|
+
['2014-02-24', '1.9.3-p545'],
|
123
|
+
['2014-02-24', '2.0.0-p451'],
|
124
|
+
['2014-02-24', '2.1.1'],
|
125
|
+
['2014-03-09', '2.0.0-p481'],
|
126
|
+
['2014-03-09', '2.1.2'],
|
127
|
+
['2014-03-16', '1.9.3-p547'],
|
128
|
+
['2014-08-19', '1.9.2-p330'],
|
129
|
+
['2014-09-19', '2.0.0-p576'],
|
130
|
+
['2014-09-19', '2.1.3'],
|
131
|
+
['2014-10-27', '1.9.3-p550'],
|
132
|
+
['2014-10-27', '2.0.0-p594'],
|
133
|
+
['2014-10-27', '2.1.4'],
|
134
|
+
['2014-11-13', '1.9.3-p551'],
|
135
|
+
['2014-11-13', '2.0.0-p598'],
|
136
|
+
['2014-11-13', '2.1.5'],
|
137
|
+
['2014-12-25', '2.2.0'],
|
138
|
+
['2015-02-25', '2.0.0-p643'],
|
139
|
+
['2015-02-26', '2.2.1'],
|
140
|
+
['2015-04-13', '2.0.0-p645'],
|
141
|
+
['2015-04-13', '2.1.6'],
|
142
|
+
['2015-04-13', '2.2.2'],
|
143
|
+
['2015-08-18', '2.0.0-p647'],
|
144
|
+
['2015-08-18', '2.1.7'],
|
145
|
+
['2015-08-18', '2.2.3'],
|
146
|
+
['2015-12-16', '2.0.0-p648'],
|
147
|
+
['2015-12-16', '2.1.8'],
|
148
|
+
['2015-12-16', '2.2.4'],
|
149
|
+
['2016-04-26', '2.2.5'],
|
150
|
+
['2016-04-26', '2.3.1'],
|
151
|
+
['2016-11-15', '2.2.6'],
|
152
|
+
['2016-11-15', '2.3.2'],
|
153
|
+
['2016-11-21', '2.3.3'],
|
154
|
+
['2016-12-24', '2.4.0'],
|
155
|
+
['2017-03-22', '2.4.1'],
|
156
|
+
['2017-03-28', '2.2.7'],
|
157
|
+
['2017-03-30', '2.3.4']
|
158
|
+
]
|
159
|
+
|
160
|
+
def self.latest?(supplied_date, inspected_date)
|
161
|
+
inspected_date < supplied_date
|
162
|
+
end
|
163
|
+
|
164
|
+
def self.has_p?(input)
|
165
|
+
input.include?('p')
|
166
|
+
end
|
167
|
+
|
168
|
+
def self.minor(input)
|
169
|
+
input[0..2]
|
170
|
+
end
|
171
|
+
|
172
|
+
def self.minor_already_present?(minors, new)
|
173
|
+
result = false
|
174
|
+
minors.each do |el|
|
175
|
+
if el.include?(new)
|
176
|
+
result = true
|
177
|
+
end
|
178
|
+
end
|
179
|
+
result
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.correct_date?(supplied_date)
|
183
|
+
begin
|
184
|
+
if eval(supplied_date).to_date.is_a?(Date)
|
185
|
+
true
|
186
|
+
else
|
187
|
+
false
|
188
|
+
end
|
189
|
+
rescue
|
190
|
+
false
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.run_versions(supplied_date)
|
195
|
+
unless correct_date?(supplied_date)
|
196
|
+
puts "\n\n\nINVALID DATE FORMAT. Try '2.days.ago' or '2012-03-12'\n\n\n\n"
|
197
|
+
exit
|
198
|
+
end
|
199
|
+
supplied_date = eval(supplied_date)
|
200
|
+
minors = []
|
201
|
+
versions = []
|
202
|
+
|
203
|
+
PortalGun::RUBY_VERSIONS.reverse_each do |el|
|
204
|
+
if latest?(supplied_date, Date.parse(el[0]))
|
205
|
+
unless minor_already_present?(minors, minor(el[1]))
|
206
|
+
minors << minor(el[1])
|
207
|
+
versions << el[1]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
break if versions.length == 3
|
211
|
+
end
|
212
|
+
|
213
|
+
# puts "Here are the minor releases that were the most valid as of #{supplied_date}:"
|
214
|
+
# versions.each_with_index do |version, index|
|
215
|
+
# puts "[#{index}]: #{version}"
|
216
|
+
# end
|
217
|
+
# result = 'invalid'
|
218
|
+
# while result == 'invalid'
|
219
|
+
# puts 'Please enter which version you wish to use:'
|
220
|
+
# result = gets.chomp
|
221
|
+
# unless [0,1,2].include?(result.to_i)
|
222
|
+
# result = 'invalid'
|
223
|
+
# end
|
224
|
+
# end
|
225
|
+
# versions[result.to_i]
|
226
|
+
versions
|
227
|
+
end
|
228
|
+
end
|
data/portal_gun.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'portal_gun/version'
|
5
|
+
require 'portal_gun/firing'
|
6
|
+
require 'portal_gun/ruby_versions'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "portal_gun"
|
10
|
+
spec.version = PortalGun::VERSION
|
11
|
+
spec.authors = ["Nick Schwaderer"]
|
12
|
+
spec.email = ["nick.schwaderer@oceanshq.com"]
|
13
|
+
|
14
|
+
spec.summary = %q{Whip out your portal gun and take your Gemfile to any point in history.}
|
15
|
+
spec.description = %q{This gem allows you to run a Terminal command with a supplied date in ruby format and generate a gemfile with gems specified to the most recent versions before that date.}
|
16
|
+
spec.homepage = "https://github.com/schwad/portal_gun"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
+
if spec.respond_to?(:metadata)
|
22
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
29
|
+
f.match(%r{^(test|spec|features)/})
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "pry"
|
39
|
+
spec.add_dependency "mechanize"
|
40
|
+
spec.add_dependency "activesupport"
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: portal_gun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Schwaderer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mechanize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: This gem allows you to run a Terminal command with a supplied date in
|
98
|
+
ruby format and generate a gemfile with gems specified to the most recent versions
|
99
|
+
before that date.
|
100
|
+
email:
|
101
|
+
- nick.schwaderer@oceanshq.com
|
102
|
+
executables:
|
103
|
+
- portal_gun
|
104
|
+
extensions: []
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- ".gitignore"
|
108
|
+
- ".rspec"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CODE_OF_CONDUCT.md
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- SampleGemfile
|
116
|
+
- bin/console
|
117
|
+
- bin/setup
|
118
|
+
- exe/portal_gun
|
119
|
+
- lib/portal_gun.rb
|
120
|
+
- lib/portal_gun/firing.rb
|
121
|
+
- lib/portal_gun/ruby_versions.rb
|
122
|
+
- lib/portal_gun/version.rb
|
123
|
+
- portal_gun.gemspec
|
124
|
+
homepage: https://github.com/schwad/portal_gun
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata:
|
128
|
+
allowed_push_host: https://rubygems.org
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.8
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Whip out your portal gun and take your Gemfile to any point in history.
|
149
|
+
test_files: []
|