motion-bundler 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.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,10 @@
1
1
  = MotionBundler CHANGELOG
2
2
 
3
+ == Version 0.1.4 (May 29, 2013)
4
+
5
+ * Not using colorize as gem dependency anymore: defining String#yellow, String#green, String#red in MotionBundler itself
6
+ * Fixed `duplicate symbol` error caused when requiring a file within `Dir["app/**/*.rb"]`
7
+
3
8
  == Version 0.1.3 (May 28, 2013)
4
9
 
5
10
  * Altered `simulator?` (and thus `device?`) determination (in simulator when ARGV is empty)
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
3
  require "rake/testtask"
4
- require "colorize"
5
4
 
6
5
  task :default => "test/unit"
7
6
 
@@ -16,11 +15,11 @@ task "test/motion" do
16
15
  if ENV["BUNDLE_GEMFILE"] == "foo"
17
16
  FileList["test/motion/**/test_*.rb"].each_with_index do |test_file, index|
18
17
  puts if index > 0 || ARGV.include?("test/unit")
19
- puts "#{test_file}:\n".green
18
+ puts "\e[0;32;49m#{test_file}:\n\e[0m"
20
19
  test_file = File.expand_path test_file
21
20
  system "cd #{File.dirname test_file} && ruby #{File.basename test_file}"
22
21
  end
23
22
  else
24
- puts "Please use `.rake` to run motion tests".red
23
+ puts "\e[0;31;49mPlease use `.rake` to run motion tests\e[0m"
25
24
  end
26
25
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -10,6 +10,7 @@ module Kernel
10
10
  def autoload(mod, filename)
11
11
  end
12
12
  end
13
+
13
14
  class Object
14
15
  def require(name)
15
16
  end
@@ -18,6 +19,7 @@ class Object
18
19
  def load(filename, wrap=false)
19
20
  end
20
21
  end
22
+
21
23
  class Module
22
24
  def autoload(mod, filename)
23
25
  end
@@ -1,3 +1,4 @@
1
+ require "set"
1
2
  require "motion-bundler/require/ripper/builder"
2
3
 
3
4
  module MotionBundler
@@ -33,20 +34,28 @@ module MotionBundler
33
34
 
34
35
  builder = Builder.new source
35
36
  builder.requires.each do |method, args|
36
- (@files_dependencies[source] ||= []) << begin
37
- (method == :require_relative ? File.expand_path("../#{args[0]}.rb", source) : Require.resolve(args[0])).tap do |file|
38
- @files << source
39
- @files << file
40
- unless @sources.any?{|x| File.expand_path(x) == File.expand_path(file)}
41
- if file.include?(File.expand_path("."))
42
- added_sources << file
43
- else
44
- MotionBundler.app_require file
45
- end
46
- end
37
+ (@requires[source] ||= []) << args[0]
38
+
39
+ file = begin
40
+ if method == :require_relative
41
+ File.expand_path("../#{args[0]}.rb", source)
42
+ else
43
+ Require.resolve(args[0])
47
44
  end
48
45
  end
49
- (@requires[source] ||= []) << args[0]
46
+
47
+ next if @sources.any?{|x| File.expand_path(x) == File.expand_path(file)}
48
+
49
+ if file.include?(File.expand_path("."))
50
+ added_sources << file
51
+ else
52
+ MotionBundler.app_require file
53
+ end
54
+
55
+ @files << source
56
+ @files << file
57
+
58
+ (@files_dependencies[source] ||= []) << file
50
59
  end
51
60
 
52
61
  unless added_sources.empty?
@@ -1,3 +1,2 @@
1
1
  require_relative "core_ext"
2
- require "colorize"
3
2
  require_relative "console"
@@ -48,4 +48,20 @@ class Module
48
48
  end
49
49
  end
50
50
 
51
+ end
52
+
53
+ class String
54
+ def yellow
55
+ colorize 33
56
+ end
57
+ def green
58
+ colorize 32
59
+ end
60
+ def red
61
+ colorize 31
62
+ end
63
+ private
64
+ def colorize(color)
65
+ "\e[0;#{color};49m#{self}\e[0m"
66
+ end
51
67
  end
@@ -1,7 +1,7 @@
1
1
  module MotionBundler #:nodoc:
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 3
4
+ TINY = 4
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
@@ -18,6 +18,4 @@ Gem::Specification.new do |gem|
18
18
  gem.add_development_dependency "minitest", "4.6.2"
19
19
  gem.add_development_dependency "mocha", "0.13.2"
20
20
  gem.add_development_dependency "rake"
21
-
22
- gem.add_dependency "colorize"
23
21
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "foo/bar"
2
+ require_relative './../app/controllers/app_controller'
2
3
  require "cgi"
3
4
 
4
5
  module Foo
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/paulengel/Sources/motion-bundler
3
3
  specs:
4
- motion-bundler (0.1.2)
5
- colorize
4
+ motion-bundler (0.1.3)
6
5
 
7
6
  PATH
8
7
  remote: /Users/paulengel/Sources/motion-bundler/test/gems/slot_machine
@@ -12,7 +11,6 @@ PATH
12
11
  GEM
13
12
  remote: https://rubygems.org/
14
13
  specs:
15
- colorize (0.5.8)
16
14
 
17
15
  PLATFORMS
18
16
  ruby
@@ -17,8 +17,6 @@ module Motion
17
17
  SlotMachine
18
18
  end
19
19
 
20
- colorize = "#{Bundler.load.specs.detect{|x| x.name == "colorize"}.full_gem_path}/lib/colorize.rb"
21
-
22
20
  Motion::Project::App.any_instance.expects(:files).returns %w(
23
21
  /Users/paulengel/foo.rb
24
22
  /Users/paulengel/bar.rb
@@ -28,7 +26,6 @@ module Motion
28
26
  MotionBundler::MOTION_BUNDLER_FILE,
29
27
  motion_bundler_file("motion-bundler/simulator/boot.rb"),
30
28
  motion_bundler_file("motion-bundler/simulator/core_ext.rb"),
31
- colorize,
32
29
  motion_bundler_file("motion-bundler/simulator/console.rb"),
33
30
  gem_path("slot_machine/lib/slot_machine.rb"),
34
31
  gem_path("slot_machine/lib/slot_machine/version.rb"),
@@ -47,7 +44,6 @@ module Motion
47
44
  Motion::Project::App.any_instance.expects(:files_dependencies).with(
48
45
  motion_bundler_file("motion-bundler/simulator/boot.rb") => [
49
46
  motion_bundler_file("motion-bundler/simulator/core_ext.rb"),
50
- colorize,
51
47
  motion_bundler_file("motion-bundler/simulator/console.rb")
52
48
  ],
53
49
  gem_path("slot_machine/lib/slot_machine.rb") => [
@@ -16,7 +16,8 @@ module Unit
16
16
  foo_builder = mock "object"
17
17
  foo_builder.expects(:requires).returns [
18
18
  [:require, ["baz"]],
19
- [:require_relative, ["qux"]]
19
+ [:require_relative, ["qux"]],
20
+ [:require_relative, ["bar"]]
20
21
  ]
21
22
  MotionBundler::Require::Ripper::Builder.expects(:new).with("./app/controllers/foo_controller.rb").returns foo_builder
22
23
 
@@ -26,7 +27,11 @@ module Unit
26
27
 
27
28
  qux_builder = mock "object"
28
29
  qux_builder.expects(:requires).returns []
29
- MotionBundler::Require::Ripper::Builder.expects(:new).with(File.expand_path("./app/controllers/qux.rb")).returns qux_builder
30
+ MotionBundler::Require::Ripper::Builder.expects(:new).with("./app/controllers/qux.rb").returns qux_builder
31
+
32
+ bar_builder = mock "object"
33
+ bar_builder.expects(:requires).returns []
34
+ MotionBundler::Require::Ripper::Builder.expects(:new).with(File.expand_path("./app/controllers/bar.rb")).returns bar_builder
30
35
 
31
36
  MotionBundler::Require.expects(:resolve).with("stringio").returns("stdlib/stringio.rb")
32
37
  MotionBundler::Require.expects(:resolve).with("strscan").returns("mocks/strscan.rb")
@@ -35,7 +40,8 @@ module Unit
35
40
  ripper = MotionBundler::Require::Ripper.new(
36
41
  "./app/controllers/app_controller.rb",
37
42
  "./app/controllers/foo_controller.rb",
38
- "./app/controllers/baz_controller.rb"
43
+ "./app/controllers/baz_controller.rb",
44
+ "./app/controllers/qux.rb"
39
45
  )
40
46
 
41
47
  assert_equal([
@@ -44,7 +50,7 @@ module Unit
44
50
  "mocks/strscan.rb",
45
51
  "./app/controllers/foo_controller.rb",
46
52
  "lib/baz.rb",
47
- File.expand_path("app/controllers/qux.rb")
53
+ File.expand_path("app/controllers/bar.rb")
48
54
  ], ripper.files)
49
55
  assert_equal({
50
56
  "./app/controllers/app_controller.rb" => [
@@ -53,7 +59,7 @@ module Unit
53
59
  ],
54
60
  "./app/controllers/foo_controller.rb" => [
55
61
  "lib/baz.rb",
56
- File.expand_path("app/controllers/qux.rb")
62
+ File.expand_path("app/controllers/bar.rb")
57
63
  ]
58
64
  }, ripper.files_dependencies)
59
65
  assert_equal({
@@ -64,6 +70,7 @@ module Unit
64
70
  "./app/controllers/foo_controller.rb" => %w(
65
71
  baz
66
72
  qux
73
+ bar
67
74
  )
68
75
  }, ripper.requires)
69
76
  end
@@ -42,6 +42,24 @@ module Unit
42
42
  assert_equal false, Kernel.respond_to?(:console)
43
43
  assert_equal false, Kernel.respond_to?(:_ruby_require)
44
44
  end
45
+
46
+ it "should be able to colorize messages" do
47
+ string = "MESSAGE"
48
+
49
+ assert_equal "\e[0;1982;49mMESSAGE\e[0m", string.send(:colorize, 1982)
50
+ assert_equal "\e[0;33;49mMESSAGE\e[0m", string.yellow
51
+ assert_equal "\e[0;32;49mMESSAGE\e[0m", string.green
52
+ assert_equal "\e[0;31;49mMESSAGE\e[0m", string.red
53
+
54
+ string.expects(:colorize).with(33)
55
+ string.yellow
56
+
57
+ string.expects(:colorize).with(32)
58
+ string.green
59
+
60
+ string.expects(:colorize).with(31)
61
+ string.red
62
+ end
45
63
  end
46
64
 
47
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-bundler
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:
@@ -59,22 +59,6 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: colorize
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
62
  description: Use Ruby gems and mock require statements within RubyMotion applications
79
63
  email:
80
64
  - paul.engel@holder.nl
@@ -199,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
183
  version: '0'
200
184
  segments:
201
185
  - 0
202
- hash: 2773472459803331263
186
+ hash: 3894260479550083785
203
187
  required_rubygems_version: !ruby/object:Gem::Requirement
204
188
  none: false
205
189
  requirements:
@@ -208,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
192
  version: '0'
209
193
  segments:
210
194
  - 0
211
- hash: 2773472459803331263
195
+ hash: 3894260479550083785
212
196
  requirements: []
213
197
  rubyforge_project:
214
198
  rubygems_version: 1.8.25