Permalink
Browse files

cucumber support files use modules instead of polluting root namespace

  • Loading branch information...
1 parent 429c869 commit d8564a58bcab7c3c065d499637ca042afda0fea1 @drnic drnic committed Mar 17, 2009
View
@@ -1,3 +1,8 @@
-def newgem_cmd
- File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
+module CliHelpers
+ def newgem_cmd
+ File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
+ end
end
+
+World { |world| world.extend CliHelpers }
+
View
@@ -1,25 +1,29 @@
-def in_tmp_folder(&block)
- FileUtils.chdir(@tmp_root, &block)
-end
+module CommonHelpers
+ def in_tmp_folder(&block)
+ FileUtils.chdir(@tmp_root, &block)
+ end
-def in_project_folder(&block)
- project_folder = @active_project_folder || @tmp_root
- FileUtils.chdir(project_folder, &block)
-end
+ def in_project_folder(&block)
+ project_folder = @active_project_folder || @tmp_root
+ FileUtils.chdir(project_folder, &block)
+ end
-def in_home_folder(&block)
- FileUtils.chdir(@home_path, &block)
-end
+ def in_home_folder(&block)
+ FileUtils.chdir(@home_path, &block)
+ end
-def force_local_lib_override(project_name = @project_name)
- rakefile = File.read(File.join(project_name, 'Rakefile'))
- File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
- f << "$:.unshift('#{@lib_path}')\n"
- f << rakefile
+ def force_local_lib_override(project_name = @project_name)
+ rakefile = File.read(File.join(project_name, 'Rakefile'))
+ File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
+ f << "$:.unshift('#{@lib_path}')\n"
+ f << rakefile
+ end
end
-end
-def setup_active_project_folder project_name
- @active_project_folder = File.join(@tmp_root, project_name)
- @project_name = project_name
+ def setup_active_project_folder project_name
+ @active_project_folder = File.join(@tmp_root, project_name)
+ @project_name = project_name
+ end
end
+
+World { |world| world.extend CommonHelpers }
@@ -1,25 +1,29 @@
-def in_tmp_folder(&block)
- FileUtils.chdir(@tmp_root, &block)
-end
+module CommonHelpers
+ def in_tmp_folder(&block)
+ FileUtils.chdir(@tmp_root, &block)
+ end
-def in_project_folder(&block)
- project_folder = @active_project_folder || @tmp_root
- FileUtils.chdir(project_folder, &block)
-end
+ def in_project_folder(&block)
+ project_folder = @active_project_folder || @tmp_root
+ FileUtils.chdir(project_folder, &block)
+ end
-def in_home_folder(&block)
- FileUtils.chdir(@home_path, &block)
-end
+ def in_home_folder(&block)
+ FileUtils.chdir(@home_path, &block)
+ end
-def force_local_lib_override(project_name = @project_name)
- rakefile = File.read(File.join(project_name, 'Rakefile'))
- File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
- f << "$:.unshift('#{@lib_path}')\n"
- f << rakefile
+ def force_local_lib_override(project_name = @project_name)
+ rakefile = File.read(File.join(project_name, 'Rakefile'))
+ File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
+ f << "$:.unshift('#{@lib_path}')\n"
+ f << rakefile
+ end
end
-end
-def setup_active_project_folder project_name
- @active_project_folder = File.join(@tmp_root, project_name)
- @project_name = project_name
+ def setup_active_project_folder project_name
+ @active_project_folder = File.join(@tmp_root, project_name)
+ @project_name = project_name
+ end
end
+
+World { |world| world.extend CommonHelpers }

0 comments on commit d8564a5

Please sign in to comment.