newjs 1.7.2 → 1.7.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/Manifest.txt +13 -2
- data/Rakefile +11 -20
- data/app_generators/newjs/templates/test/assets/jsunittest.js +173 -135
- data/app_generators/newjs_iphone/templates/Html/test/assets/jsunittest.js +173 -135
- data/app_generators/newjs_screwunit/USAGE +5 -0
- data/app_generators/newjs_screwunit/newjs_screwunit_generator.rb +61 -0
- data/app_generators/newjs_screwunit/templates/Rakefile.erb +34 -0
- data/bin/newjs_screwunit +17 -0
- data/features/development.feature +5 -5
- data/features/imported_files_for_generators.feature +2 -2
- data/features/newjs_screwunit.feature +18 -0
- data/features/step_definitions/cli_steps.rb +9 -0
- data/features/{steps/common.rb → step_definitions/common_steps.rb} +39 -81
- data/features/step_definitions/file_comparison_steps.rb +10 -0
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +15 -0
- data/features/support/matchers.rb +11 -0
- data/lib/newjs.rb +1 -1
- data/rack_generators/javascript_test/templates/assets/jsunittest.js +173 -135
- data/rails_generators/javascript_test/templates/assets/jsunittest.js +173 -135
- data/test/test_newjs_screwunit_generator.rb +43 -0
- data/vendor/jsunittest/History.txt +9 -0
- data/vendor/jsunittest/Rakefile +1 -1
- data/vendor/jsunittest/dist/jsunittest-0.7.3.js +1042 -0
- data/vendor/jsunittest/dist/jsunittest.js +173 -135
- data/vendor/jsunittest/src/ajax.js +2 -1
- data/vendor/jsunittest/src/assertions.js +49 -78
- data/vendor/jsunittest/src/common.js +83 -24
- data/vendor/jsunittest/src/jsunittest.js +7 -998
- data/vendor/jsunittest/src/logger.js +6 -6
- data/vendor/jsunittest/src/message_template.js +1 -1
- data/vendor/jsunittest/src/prototype/event.js +2 -2
- data/vendor/jsunittest/src/prototype/template.js +7 -6
- data/vendor/jsunittest/src/runner.js +13 -12
- data/vendor/jsunittest/src/test_case.js +11 -6
- data/vendor/jsunittest/test/unit/assertions_test.html +9 -1
- data/vendor/jsunittest/test/unit/common_test.html +9 -1
- data/vendor/jsunittest/test/unit/logger_test.html +2 -2
- data/vendor/jsunittest/test/unit/message_template_test.html +2 -2
- data/vendor/jsunittest/test/unit/runner_test.html +2 -2
- data/vendor/jsunittest/test/unit/template_test.html +2 -2
- data/vendor/jsunittest/test/unit/test_case_test.html +24 -3
- data/vendor/jsunittest/website/images/logo_bundle.png +0 -0
- data/vendor/jsunittest/website/index.html +3 -3
- data/vendor/jsunittest/website/index.txt +1 -1
- data/vendor/jsunittest/website/stylesheets/screen.css +3 -0
- data/vendor/jsunittest/website/tmbundle/JavaScript Unit Testing.tmbundle.tar.gz +0 -0
- metadata +20 -14
- data/features/steps/env.rb +0 -6
@@ -0,0 +1,61 @@
|
|
1
|
+
class NewjsScrewunitGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :src_folder => 'src'
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
attr_reader :src_folder
|
10
|
+
attr_reader :greasemonkey
|
11
|
+
|
12
|
+
def initialize(runtime_args, runtime_options = {})
|
13
|
+
super
|
14
|
+
usage if args.empty?
|
15
|
+
@destination_root = File.expand_path(args.shift)
|
16
|
+
@name = base_name
|
17
|
+
extract_options
|
18
|
+
end
|
19
|
+
|
20
|
+
def manifest
|
21
|
+
record do |m|
|
22
|
+
m.directory '.'
|
23
|
+
m.directory src_folder
|
24
|
+
m.directory 'spec/fixtures'
|
25
|
+
m.directory 'vendor/plugins'
|
26
|
+
|
27
|
+
# Create stubs
|
28
|
+
m.template "Rakefile.erb", "Rakefile"
|
29
|
+
# m.template_copy_each %w[Rakefile]
|
30
|
+
# m.file "file", "some_file_copied"
|
31
|
+
# m.file_copy_each ["path/to/file", "path/to/file2"]
|
32
|
+
|
33
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'newjs_screwunit'],
|
34
|
+
:shebang => options[:shebang], :collision => :force
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
def banner
|
40
|
+
<<-EOS
|
41
|
+
Creates a ...
|
42
|
+
|
43
|
+
USAGE: #{spec.name} name
|
44
|
+
EOS
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_options!(opts)
|
48
|
+
opts.separator ''
|
49
|
+
opts.separator 'Options:'
|
50
|
+
# For each option below, place the default
|
51
|
+
# at the top of the file next to "default_options"
|
52
|
+
opts.on("--src=folder", String,
|
53
|
+
"Folder for development of JavaScript source files",
|
54
|
+
"Default: src") { |o| options[:src_folder] = o }
|
55
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
56
|
+
end
|
57
|
+
|
58
|
+
def extract_options
|
59
|
+
@src_folder = options[:src_folder]
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
APP_VERSION = '1.0.0'
|
6
|
+
APP_NAME = '<%= name %>'
|
7
|
+
APP_FILE_NAME= '<%= name %>.js'
|
8
|
+
|
9
|
+
APP_ROOT = File.expand_path(File.dirname(__FILE__))
|
10
|
+
APP_SRC_DIR = File.join(APP_ROOT, '<%= src_folder %>')
|
11
|
+
APP_DIST_DIR = File.join(APP_ROOT, 'website', 'dist')
|
12
|
+
|
13
|
+
|
14
|
+
task :default => [:dist, :package, :clean_package_source]
|
15
|
+
|
16
|
+
desc "Builds the distribution"
|
17
|
+
task :dist => [:build] do
|
18
|
+
mkdir_p(APP_DIST_DIR)
|
19
|
+
sh "cp -R #{APP_SRC_DIR}/* #{APP_DIST_DIR}/"
|
20
|
+
end
|
21
|
+
|
22
|
+
<% if greasemonkey -%>
|
23
|
+
desc "Builds the compiled JS file that is downloaded by greasemonkey script"
|
24
|
+
task :build do
|
25
|
+
files = %w[jquery jquery.noConflict threaded_gtalk threaded_gtalk_theme]
|
26
|
+
content = files.map { |file| File.read(File.join(APP_SRC_DIR, file + ".js")) }.join("\n\n")
|
27
|
+
File.open(File.join(APP_SRC_DIR, "threaded_gtalk_complete.js"), "w") do |file|
|
28
|
+
file << content
|
29
|
+
end
|
30
|
+
end
|
31
|
+
<% else -%>
|
32
|
+
task :build do
|
33
|
+
end
|
34
|
+
<% end -%>
|
data/bin/newjs_screwunit
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'newjs_screwunit/version'
|
8
|
+
puts "#{File.basename($0)} #{NewjsScrewunit::VERSION}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application,
|
14
|
+
File.join(File.dirname(__FILE__), "../app_generators"))
|
15
|
+
RubiGen::Base.reset_sources
|
16
|
+
RubiGen::Base.append_sources source
|
17
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'newjs_screwunit')
|
@@ -6,8 +6,8 @@ Feature: Development processes of newgem itself (rake tasks)
|
|
6
6
|
|
7
7
|
Scenario: Generate RubyGem
|
8
8
|
Given this project is active project folder
|
9
|
-
And
|
10
|
-
When task
|
11
|
-
Then folder
|
12
|
-
And file with name matching
|
13
|
-
And gem spec key
|
9
|
+
And "pkg" folder is deleted
|
10
|
+
When I invoke task "rake gem"
|
11
|
+
Then folder "pkg" is created
|
12
|
+
And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
|
13
|
+
And gem spec key "rdoc_options" contains /--mainREADME.rdoc/
|
@@ -5,7 +5,7 @@ Feature: Apply the latest distribution files from vendored projects into generat
|
|
5
5
|
|
6
6
|
Scenario: Copy across jsunittest into generators
|
7
7
|
Given this project is active project folder
|
8
|
-
When task
|
8
|
+
When I invoke task "rake vendor:update:jsunittest"
|
9
9
|
Then file 'app_generators/newjs/templates/test/assets/jsunittest.js' is same as file 'vendor/jsunittest/dist/jsunittest.js'
|
10
10
|
Then file 'app_generators/newjs/templates/test/assets/unittest.css' is same as file 'vendor/jsunittest/dist/unittest.css'
|
11
11
|
Then file 'app_generators/newjs_iphone/templates/Html/test/assets/jsunittest.js' is same as file 'vendor/jsunittest/dist/jsunittest.js'
|
@@ -15,6 +15,6 @@ Feature: Apply the latest distribution files from vendored projects into generat
|
|
15
15
|
|
16
16
|
Scenario: Copy across jshoulda into generators
|
17
17
|
Given this project is active project folder
|
18
|
-
When task
|
18
|
+
When I invoke task "rake vendor:update:jshoulda"
|
19
19
|
Then file 'rails_generators/javascript_test/templates/assets/jshoulda.js' is same as file 'vendor/jshoulda/dist/jshoulda.js'
|
20
20
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Newjs encapsulating screwunit and blue-ridge
|
2
|
+
In order to reduce the cost of starting a new JS project using Screw.Unit and blue-ridge
|
3
|
+
As a JavaScript developer
|
4
|
+
I want a generator
|
5
|
+
|
6
|
+
Scenario: Generate a new JavaScript project using Screw.Unit/Blue-ridge for testing
|
7
|
+
When I run newjs_screwunit for project "my_project" with options ""
|
8
|
+
Then folder "src" is created
|
9
|
+
And folder "spec/fixtures" is created
|
10
|
+
And folder "vendor/plugin/blue-ridge" is created
|
11
|
+
And Rakefile can display tasks successfully
|
12
|
+
|
13
|
+
Scenario: Generate a new JavaScript project with source code in public folder
|
14
|
+
When I run newjs_screwunit for project "my_project" with options "--src=public"
|
15
|
+
Then folder "public" is created
|
16
|
+
Then folder "src" is not created
|
17
|
+
And folder "spec/fixtures" is created
|
18
|
+
And Rakefile can display tasks successfully
|
@@ -0,0 +1,9 @@
|
|
1
|
+
When /^I run newjs_screwunit for project "(.*)" with options "(.*)"$/ do |project_name, arguments|
|
2
|
+
@cmd = File.expand_path(File.dirname(__FILE__) + "/../../bin/newjs_screwunit")
|
3
|
+
setup_active_project_folder(project_name)
|
4
|
+
in_tmp_folder do
|
5
|
+
@stdout = File.expand_path("cli.out")
|
6
|
+
system "ruby #{@cmd} #{arguments} #{project_name} > #{@stdout}"
|
7
|
+
force_local_lib_override
|
8
|
+
end
|
9
|
+
end
|
@@ -1,51 +1,18 @@
|
|
1
|
-
|
2
|
-
project_folder = @active_project_folder || @tmp_root
|
3
|
-
FileUtils.chdir(project_folder, &block)
|
4
|
-
end
|
5
|
-
|
6
|
-
def in_home_folder(&block)
|
7
|
-
FileUtils.chdir(@home_path, &block)
|
8
|
-
end
|
9
|
-
|
10
|
-
Given %r{^a safe folder} do
|
11
|
-
FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
12
|
-
FileUtils.mkdir_p @tmp_root
|
13
|
-
FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
|
14
|
-
@lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
15
|
-
Given "env variable $HOME set to '#{@home_path}'"
|
16
|
-
end
|
17
|
-
|
18
|
-
Given %r{^this project is active project folder} do
|
19
|
-
Given "a safe folder"
|
1
|
+
Given /^this project is active project folder/ do
|
20
2
|
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
21
3
|
end
|
22
4
|
|
23
|
-
Given
|
5
|
+
Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
|
24
6
|
ENV[env_var] = value
|
25
7
|
end
|
26
8
|
|
27
|
-
|
28
|
-
|
29
|
-
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
30
|
-
f << "$:.unshift('#{@lib_path}')\n"
|
31
|
-
f << rakefile
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def setup_active_project_folder project_name
|
36
|
-
@active_project_folder = File.join(@tmp_root, project_name)
|
37
|
-
@project_name = project_name
|
9
|
+
Given /"(.*)" folder is deleted/ do |folder|
|
10
|
+
in_project_folder { FileUtils.rm_rf folder }
|
38
11
|
end
|
39
12
|
|
40
|
-
|
41
|
-
in_project_folder do
|
42
|
-
FileUtils.rm_rf folder
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, arguments|
|
13
|
+
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
47
14
|
@stdout = StringIO.new
|
48
|
-
|
15
|
+
in_project_folder do
|
49
16
|
if Object.const_defined?("APP_ROOT")
|
50
17
|
APP_ROOT.replace(FileUtils.pwd)
|
51
18
|
else
|
@@ -59,21 +26,21 @@ When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, argu
|
|
59
26
|
end
|
60
27
|
end
|
61
28
|
|
62
|
-
When
|
29
|
+
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
63
30
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
64
31
|
in_project_folder do
|
65
32
|
system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
66
33
|
end
|
67
34
|
end
|
68
35
|
|
69
|
-
When
|
36
|
+
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
70
37
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
71
38
|
in_project_folder do
|
72
39
|
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
73
40
|
end
|
74
41
|
end
|
75
42
|
|
76
|
-
When
|
43
|
+
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
77
44
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
78
45
|
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
79
46
|
in_project_folder do
|
@@ -81,43 +48,41 @@ When %r{run local executable '(.*)' with arguments '(.*)'} do |executable, argum
|
|
81
48
|
end
|
82
49
|
end
|
83
50
|
|
84
|
-
When
|
51
|
+
When /^I invoke task "rake (.*)"/ do |task|
|
85
52
|
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
86
|
-
|
53
|
+
in_project_folder do
|
87
54
|
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
88
55
|
end
|
89
56
|
end
|
90
57
|
|
91
|
-
Then
|
58
|
+
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
92
59
|
in_project_folder do
|
93
60
|
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
94
61
|
end
|
95
62
|
end
|
96
63
|
|
97
|
-
Then
|
64
|
+
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
98
65
|
in_project_folder do
|
99
66
|
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
100
67
|
end
|
101
68
|
end
|
102
69
|
|
103
|
-
Then
|
70
|
+
Then /^file with name matching "(.*)" is created/ do |pattern|
|
104
71
|
in_project_folder do
|
105
72
|
Dir[pattern].should_not be_empty
|
106
73
|
end
|
107
74
|
end
|
108
75
|
|
109
|
-
Then
|
76
|
+
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
110
77
|
in_project_folder do
|
111
|
-
File.
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
file1_contents.should == file2_contents
|
78
|
+
actual_output = File.read(file)
|
79
|
+
(does == 'does') ?
|
80
|
+
actual_output.should(match(/#{regex}/)) :
|
81
|
+
actual_output.should_not(match(/#{regex}/))
|
116
82
|
end
|
117
83
|
end
|
118
84
|
|
119
|
-
|
120
|
-
Then %r{gem file '(.*)' and generated file '(.*)' should be the same} do |gem_file, project_file|
|
85
|
+
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
121
86
|
File.exists?(gem_file).should be_true
|
122
87
|
File.exists?(project_file).should be_true
|
123
88
|
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
@@ -125,77 +90,70 @@ Then %r{gem file '(.*)' and generated file '(.*)' should be the same} do |gem_fi
|
|
125
90
|
project_file_contents.should == gem_file_contents
|
126
91
|
end
|
127
92
|
|
128
|
-
Then
|
129
|
-
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
130
|
-
actual_output = File.read(@stdout)
|
131
|
-
actual_output.should == expected_output
|
132
|
-
end
|
133
|
-
|
134
|
-
Then %r{^(does|does not) invoke generator '(.*)'$} do |does_invoke, generator|
|
93
|
+
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
135
94
|
actual_output = File.read(@stdout)
|
136
95
|
does_invoke == "does" ?
|
137
96
|
actual_output.should(match(/dependency\s+#{generator}/)) :
|
138
97
|
actual_output.should_not(match(/dependency\s+#{generator}/))
|
139
98
|
end
|
140
99
|
|
141
|
-
Then
|
100
|
+
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
142
101
|
actual_output = File.read(@stdout)
|
143
102
|
actual_output.should match(/#{opt1}/)
|
144
103
|
actual_output.should match(/#{opt2}/)
|
145
104
|
end
|
146
105
|
|
147
|
-
Then
|
106
|
+
Then /^I should see$/ do |text|
|
148
107
|
actual_output = File.read(@stdout)
|
149
|
-
(
|
150
|
-
actual_output.should(match(/#{regex}/)) :
|
151
|
-
actual_output.should_not(match(/#{regex}/))
|
108
|
+
actual_output.should contain(text)
|
152
109
|
end
|
153
110
|
|
154
|
-
Then
|
155
|
-
|
156
|
-
|
157
|
-
(does == 'does') ?
|
158
|
-
actual_output.should(match(/#{regex}/)) :
|
159
|
-
actual_output.should_not(match(/#{regex}/))
|
160
|
-
end
|
111
|
+
Then /^I should not see$/ do |text|
|
112
|
+
actual_output = File.read(@stdout)
|
113
|
+
actual_output.should_not contain(text)
|
161
114
|
end
|
162
115
|
|
163
|
-
Then
|
116
|
+
Then /^I should see exactly$/ do |text|
|
117
|
+
actual_output = File.read(@stdout)
|
118
|
+
actual_output.should == text
|
119
|
+
end
|
120
|
+
|
121
|
+
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
164
122
|
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
165
123
|
actual_output = File.read(@stdout)
|
166
124
|
actual_output.should match(expected)
|
167
125
|
end
|
168
126
|
|
169
|
-
Then
|
127
|
+
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
170
128
|
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
171
129
|
actual_output = File.read(@stdout)
|
172
130
|
actual_output.should match(expected)
|
173
131
|
end
|
174
132
|
|
175
|
-
Then
|
133
|
+
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
176
134
|
in_project_folder do
|
177
135
|
yaml = eval yaml
|
178
136
|
YAML.load(File.read(file)).should == yaml
|
179
137
|
end
|
180
138
|
end
|
181
139
|
|
182
|
-
Then
|
140
|
+
Then /^Rakefile can display tasks successfully/ do
|
183
141
|
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
184
|
-
|
142
|
+
in_project_folder do
|
185
143
|
system "rake -T > #{@stdout} 2> #{@stdout}"
|
186
144
|
end
|
187
145
|
actual_output = File.read(@stdout)
|
188
146
|
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
189
147
|
end
|
190
148
|
|
191
|
-
Then
|
149
|
+
Then /^task "rake (.*)" is executed successfully/ do |task|
|
192
150
|
@stdout.should_not be_nil
|
193
151
|
actual_output = File.read(@stdout)
|
194
152
|
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
195
153
|
actual_output.should_not match(/Error/i)
|
196
154
|
end
|
197
155
|
|
198
|
-
Then
|
156
|
+
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
199
157
|
in_project_folder do
|
200
158
|
gem_file = Dir["pkg/*.gem"].first
|
201
159
|
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CommonHelpers
|
2
|
+
def in_tmp_folder(&block)
|
3
|
+
FileUtils.chdir(@tmp_root, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def in_project_folder(&block)
|
7
|
+
project_folder = @active_project_folder || @tmp_root
|
8
|
+
FileUtils.chdir(project_folder, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def in_home_folder(&block)
|
12
|
+
FileUtils.chdir(@home_path, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def force_local_lib_override(project_name = @project_name)
|
16
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
+
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
+
f << rakefile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_active_project_folder project_name
|
24
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
+
@project_name = project_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World(CommonHelpers)
|