Hokkaido 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -3
- data/lib/Hokkaido.rb +0 -1
- data/lib/Hokkaido/version.rb +1 -1
- data/lib/gem_modifier.rb +29 -0
- metadata +1 -1
data/Gemfile
CHANGED
data/lib/Hokkaido.rb
CHANGED
data/lib/Hokkaido/version.rb
CHANGED
data/lib/gem_modifier.rb
CHANGED
@@ -2,6 +2,8 @@ require 'ruby_parser'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'tempfile'
|
4
4
|
|
5
|
+
require 'pry'
|
6
|
+
|
5
7
|
# require removal only
|
6
8
|
|
7
9
|
class File
|
@@ -82,6 +84,33 @@ module Hokkaido
|
|
82
84
|
# comment it out
|
83
85
|
current_file += "# #{line}"
|
84
86
|
next
|
87
|
+
elsif line.strip =~ /^autoload/
|
88
|
+
# same as require
|
89
|
+
parser = RubyParser.new
|
90
|
+
sexp = parser.parse(line)
|
91
|
+
call = sexp[2]
|
92
|
+
|
93
|
+
unless call == :autoload
|
94
|
+
# WEIRD SHIT IS HAPPENING
|
95
|
+
current_file += line
|
96
|
+
next
|
97
|
+
end
|
98
|
+
|
99
|
+
require_type = sexp[3][2][0]
|
100
|
+
library = sexp[3][2][1]
|
101
|
+
|
102
|
+
full_rb_path = File.join([@lib_folder, "#{library}.rb"])
|
103
|
+
unless @require_libs.include?(full_rb_path)
|
104
|
+
file_index = @require_libs.index(init_lib)
|
105
|
+
insert_index = file_index
|
106
|
+
@require_libs.insert insert_index, full_rb_path
|
107
|
+
parse_gem(full_rb_path)
|
108
|
+
end
|
109
|
+
# comment it out
|
110
|
+
current_file += "# #{line}"
|
111
|
+
next
|
112
|
+
|
113
|
+
#binding.pry
|
85
114
|
elsif line.strip =~ /^eval/
|
86
115
|
# comment it out
|
87
116
|
current_file += "# FIXME: #eval is not available in motion\n"
|