Hokkaido 0.1.3 → 0.1.4

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.
@@ -53,6 +53,8 @@ module Term
53
53
  end
54
54
  self.coloring = true
55
55
 
56
+ eval("puts 'hi'")
57
+
56
58
  ATTRIBUTES.each do |c, v|
57
59
  eval %Q{
58
60
  def #{c}(string = nil)
@@ -8,6 +8,18 @@ RUBYMOTION_GEM_CONFIG = <<-HEREDOC
8
8
  Motion::Project::App.setup do |app|
9
9
  MAIN_CONFIG_FILES
10
10
  end
11
+ HEREDOC
12
+
13
+ EVAL_HACK = <<-HEREDOC
14
+ def eval(&block)
15
+ if self.is_a?(Class)
16
+ class_eval(&block)
17
+ elsif self.is_a?(Module)
18
+ module_eval(&block)
19
+ elsif self.is_a?(Object)
20
+ instance_eval(&block)
21
+ end
22
+ end
11
23
  HEREDOC
12
24
 
13
25
  INCLUDE_STRING = " app.files << File.expand_path(File.join(File.dirname(__FILE__),'RELATIVE_LIBRARY_PATH'))"
@@ -29,7 +41,7 @@ HEREDOC
29
41
  end
30
42
 
31
43
  def produced_eval_fixme
32
- File.read(@true_path).include?("FIXME: #eval")
44
+ File.read(@true_path).include?("FIXME: ")
33
45
  end
34
46
  end
35
47
 
@@ -1,3 +1,3 @@
1
1
  module Hokkaido
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -4,7 +4,15 @@ require 'tempfile'
4
4
 
5
5
  require 'pry'
6
6
 
7
- # require removal only
7
+ # remove #require
8
+ # remove #autoload
9
+ # generate and add manifest to front of file
10
+ # add version.rb and config.rb files
11
+
12
+ # convert eval to module, instance or class eval
13
+ # eval def to define method
14
+
15
+ # #binding not support
8
16
 
9
17
  class File
10
18
  def self.prepend(path, string)
@@ -110,12 +118,32 @@ module Hokkaido
110
118
  current_file += "# #{line}"
111
119
  next
112
120
 
113
- #binding.pry
121
+
114
122
  elsif line.strip =~ /^eval/
115
- # comment it out
116
- current_file += "# FIXME: #eval is not available in motion\n"
117
- current_file += "# #{line}"
118
- next
123
+ # reprint as a block
124
+ # parser = RubyParser.new
125
+ # sexp = parser.parse(line)
126
+ # code_str = sexp[3][1][1]
127
+ # new_eval = "eval do\n #{code_str}\nend\n"
128
+ # current_file += "#{new_eval}"
129
+ # next
130
+
131
+ # produce a fixme
132
+
133
+ current_file += "# FIXME: Cannot eval strings in RubyMotion. \n"
134
+ current_file += "# Rewrite to use a block.. inbuilt hack will run \n"
135
+ current_file += "# Change this: \n"
136
+ current_file += "# eval %Q{ \n"
137
+ current_file += '# def #{c}(string = nil) ' + "\n"
138
+ current_file += "# To this \n"
139
+ current_file += "# eval do \n"
140
+ current_file += "# define_method(c) do |string| \n"
141
+ current_file += "#{line}"
142
+ next
143
+ elsif line.strip =~ /^binding/
144
+ current_file += "# FIXME: binding is not supported in RubyMotion.\n"
145
+ current_file += "#{line}"
146
+ next
119
147
  end
120
148
 
121
149
  # dont intefere
@@ -144,6 +172,8 @@ module Hokkaido
144
172
 
145
173
  File.prepend(File.join(@lib_folder, @init_lib), @manifest)
146
174
 
175
+ File.prepend(File.join(@lib_folder, @init_lib), EVAL_HACK)
176
+
147
177
  end
148
178
 
149
179
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Hokkaido
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-11 00:00:00.000000000 Z
13
+ date: 2012-10-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec