jumpstart 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :jumpstart_version_major: 0
3
3
  :jumpstart_version_minor: 3
4
- :jumpstart_version_patch: 7
4
+ :jumpstart_version_patch: 8
@@ -317,7 +317,7 @@ module JumpStart
317
317
  # Displays output for the "jumpstart default template options menu"
318
318
  def set_default_template_menu
319
319
  puts "\n\n******************************************************************************************************************************************\n\n"
320
- puts " SELECT A DEFAULT JUMPSTART TEMPLATE\n\n".purple
320
+ puts " SELECT A DEFAULT JUMPSTART TEMPLATE\n".purple
321
321
  display_existing_templates
322
322
  puts "\n b".yellow + " Back to main menu.\n\n"
323
323
  puts " x".yellow + " Exit jumpstart\n\n"
@@ -347,9 +347,10 @@ module JumpStart
347
347
  # Displays output for the "jumpstart templates directory options" menu.
348
348
  def templates_dir_menu
349
349
  puts "\n\n******************************************************************************************************************************************\n\n"
350
- puts " JUMPSTART TEMPLATES DIRECTORY OPTIONS\n\n".purple
351
- puts " 1".yellow + " Set templates directory.\n"
352
- puts " 2".yellow + " Reset templates directory to default\n\n"
350
+ puts " JUMPSTART TEMPLATES DIRECTORY OPTIONS\n".purple
351
+ puts " The JumpStart template directory is currently: " + JumpStart.templates_path.green
352
+ puts "\n 1".yellow + " Change the templates directory.\n"
353
+ puts " 2".yellow + " Reset the templates directory to default\n\n"
353
354
  puts " b".yellow + " Back to main menu.\n\n"
354
355
  puts " x".yellow + " Exit jumpstart\n\n"
355
356
  puts "******************************************************************************************************************************************\n\n"
data/test/helper.rb CHANGED
@@ -10,7 +10,7 @@ require 'jumpstart'
10
10
  class Test::Unit::TestCase
11
11
 
12
12
  def reset_global_defaults
13
- JumpStart.module_eval do
13
+ JumpStart.module_eval do
14
14
  @jumpstart_setup_yaml = YAML.load_file("#{JumpStart::CONFIG_PATH}/jumpstart_setup.yml")
15
15
  @jumpstart_version_yaml = YAML.load_file("#{JumpStart::CONFIG_PATH}/jumpstart_version.yml")
16
16
  @templates_path = nil
@@ -20,11 +20,11 @@ class Test::Unit::TestCase
20
20
  end
21
21
 
22
22
  module JumpStart
23
-
23
+
24
24
  class Base
25
25
 
26
26
  # Added monkeypatch for exit methods back until I find a more elegant way to stop generated jumpstarts (jumpstarts that are started programatically during testing) from actually running the exit method.
27
- # Tests that use this patch:
27
+ # Tests that use this patch:
28
28
  # new_project_from_template_options tests. Starting around line 478 of test_base.rb
29
29
  def exit_with_success
30
30
  puts "\n\n Exiting JumpStart...".purple
@@ -32,14 +32,14 @@ module JumpStart
32
32
  puts "******************************************************************************************************************************************\n"
33
33
  project = nil
34
34
  end
35
-
35
+
36
36
  def exit_normal
37
37
  puts "\n\n Exiting JumpStart...".purple
38
38
  puts "\n Goodbye!\n\n"
39
39
  puts "******************************************************************************************************************************************\n"
40
40
  project = nil
41
41
  end
42
-
42
+
43
43
  end
44
-
45
- end
44
+
45
+ end
@@ -604,7 +604,7 @@ class TestJumpstartBase < Test::Unit::TestCase
604
604
  @test_project.stubs(:set_default_template_options)
605
605
  @test_project.expects(:set_default_template_options).once
606
606
  @test_project.instance_eval {set_default_template_menu}
607
- assert_equal "\n\n******************************************************************************************************************************************\n\n\e[1m\e[35m SELECT A DEFAULT JUMPSTART TEMPLATE\n\n\e[0m\n \e[1m\e[33m1\e[0m \e[32mtest_template_1\e[0m\n \e[1m\e[33m2\e[0m \e[32mtest_template_2\e[0m\n \e[1m\e[33m3\e[0m \e[32mtest_template_3\e[0m\n\e[1m\e[33m\n b\e[0m Back to main menu.\n\n\e[1m\e[33m x\e[0m Exit jumpstart\n\n******************************************************************************************************************************************\n\n", @test_project.output.string
607
+ assert_equal "\n\n******************************************************************************************************************************************\n\n\e[1m\e[35m SELECT A DEFAULT JUMPSTART TEMPLATE\n\e[0m\n \e[1m\e[33m1\e[0m \e[32mtest_template_1\e[0m\n \e[1m\e[33m2\e[0m \e[32mtest_template_2\e[0m\n \e[1m\e[33m3\e[0m \e[32mtest_template_3\e[0m\n\e[1m\e[33m\n b\e[0m Back to main menu.\n\n\e[1m\e[33m x\e[0m Exit jumpstart\n\n******************************************************************************************************************************************\n\n", @test_project.output.string
608
608
  end
609
609
 
610
610
  end
@@ -654,7 +654,7 @@ class TestJumpstartBase < Test::Unit::TestCase
654
654
  @test_project.stubs(:templates_dir_options)
655
655
  @test_project.expects(:templates_dir_options).once
656
656
  @test_project.instance_eval {templates_dir_menu}
657
- assert_equal "\n\n******************************************************************************************************************************************\n\n\e[1m\e[35m JUMPSTART TEMPLATES DIRECTORY OPTIONS\n\n\e[0m\n\e[1m\e[33m 1\e[0m Set templates directory.\n\e[1m\e[33m 2\e[0m Reset templates directory to default\n\n\e[1m\e[33m b\e[0m Back to main menu.\n\n\e[1m\e[33m x\e[0m Exit jumpstart\n\n******************************************************************************************************************************************\n\n", @test_project.output.string
657
+ assert_equal "\n\n******************************************************************************************************************************************\n\n\e[1m\e[35m JUMPSTART TEMPLATES DIRECTORY OPTIONS\n\e[0m\n The JumpStart template directory is currently: \e[32m/Users/i0n/Sites/jumpstart/test/test_jumpstart_templates\e[0m\n\e[1m\e[33m\n 1\e[0m Change the templates directory.\n\e[1m\e[33m 2\e[0m Reset the templates directory to default\n\n\e[1m\e[33m b\e[0m Back to main menu.\n\n\e[1m\e[33m x\e[0m Exit jumpstart\n\n******************************************************************************************************************************************\n\n", @test_project.output.string
658
658
  end
659
659
 
660
660
  end
@@ -1,37 +1,37 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestJumpstartFileTools < Test::Unit::TestCase
4
-
4
+
5
5
  context "Testing JumpStart::FileUtils#append_after_line class method.\n" do
6
-
6
+
7
7
  setup do
8
8
  FileUtils.remove_lines("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt", :pattern => "Inserted by append_after_line method test.")
9
9
  end
10
-
10
+
11
11
  should "insert specified line at line number 4 of target file" do
12
12
  FileUtils.append_after_line("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt", "Line from check_source_type.txt. Line number: 3", "Inserted by append_after_line method test.")
13
13
  file = IO.readlines("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt")
14
14
  assert_equal 4, (file.find_index("Inserted by append_after_line method test.\n").to_i + 1)
15
15
  end
16
-
16
+
17
17
  should "fail because new line is not specified." do
18
18
  assert_raises(ArgumentError) {FileUtils.append_after_line("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt", "Line from check_source_type.txt. Line number: 3")}
19
19
  end
20
-
20
+
21
21
  should "fail because the target file does not exist" do
22
22
  assert_raises(Errno::ENOENT) {FileUtils.append_after_line("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/this_file_does_not_exist.txt", "Line from check_source_type.txt. Line number: 3", "Inserted by append_after_line method test.")}
23
23
  end
24
-
24
+
25
25
  end
26
-
26
+
27
27
  context "Testing JumpStart::FileUtils#append_to_end_of_file class method.\n" do
28
-
28
+
29
29
  setup do
30
30
  @file_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_test.txt"
31
31
  FileUtils.remove_lines(@file_path, :pattern => "TEST LINE INSERTED")
32
32
  FileUtils.remove_lines(@file_path, :pattern => "TEST LINE INSERTED FROM FILE")
33
33
  end
34
-
34
+
35
35
  should "add the string passed in the method call to the specified file" do
36
36
  FileUtils.append_to_end_of_file("TEST LINE INSERTED", @file_path)
37
37
  file = IO.readlines(@file_path)
@@ -46,7 +46,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
46
46
  assert_equal "TEST LINE INSERTED\n", file.last
47
47
  assert_equal 6, file.count
48
48
  end
49
-
49
+
50
50
  should "add the contents of the file passed in the method call to the specified file" do
51
51
  FileUtils.append_to_end_of_file("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_source.txt", @file_path)
52
52
  file = IO.readlines(@file_path)
@@ -61,15 +61,15 @@ class TestJumpstartFileTools < Test::Unit::TestCase
61
61
  assert_equal "TEST LINE INSERTED FROM FILE\n", file.last
62
62
  assert_equal 6, file.count
63
63
  end
64
-
64
+
65
65
  should "fail because no target file is specified" do
66
66
  assert_raises(ArgumentError) {FileUtils.append_to_end_of_file("TEST LINE INSERTED")}
67
67
  end
68
-
68
+
69
69
  should "fail because target file does not exist" do
70
70
  assert_raises(Errno::ENOENT) {FileUtils.append_to_end_of_file("TEST LINE INSERTED", "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/does_not_exist/file.txt")}
71
71
  end
72
-
72
+
73
73
  end
74
74
 
75
75
  context "Testing JumpStart::FileUtils#insert_text_at_line_number class method.\n" do
@@ -79,25 +79,25 @@ class TestJumpstartFileTools < Test::Unit::TestCase
79
79
  @source_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/insert_text_at_line_number_source.txt"
80
80
  FileUtils.remove_lines(@file_path, :pattern => "TEST LINE INSERTED")
81
81
  end
82
-
82
+
83
83
  should "insert text from string into target file at line 3" do
84
84
  FileUtils.insert_text_at_line_number("TEST LINE INSERTED", @file_path, 3)
85
85
  file = IO.readlines(@file_path)
86
86
  assert_equal "TEST LINE INSERTED\n", file[2]
87
87
  assert_equal 5, file.count
88
88
  end
89
-
89
+
90
90
  should "insert text from source file into target file at line 2" do
91
91
  FileUtils.insert_text_at_line_number(@source_path, @file_path, 2)
92
92
  file = IO.readlines(@file_path)
93
93
  assert_equal "TEST LINE INSERTED FROM FILE\n", file[1]
94
94
  assert_equal 5, file.count
95
95
  end
96
-
96
+
97
97
  should "raise an exception if a line number is not passed to the method" do
98
98
  assert_raises(ArgumentError) {FileUtils.insert_text_at_line_number(@source_path, @file_path)}
99
99
  end
100
-
100
+
101
101
  should "raise an exception if the line number is not 1 or higher" do
102
102
  assert_raises(ArgumentError) {FileUtils.insert_text_at_line_number(@source_path, @file_path, 0)}
103
103
  assert_raises(ArgumentError) {FileUtils.insert_text_at_line_number(@source_path, @file_path, -10)}
@@ -106,7 +106,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
106
106
  end
107
107
 
108
108
  context "Testing JumpStart::FileUtils#remove_files class method.\n" do
109
-
109
+
110
110
  setup do
111
111
  @file_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils"
112
112
  FileUtils.touch("#{@file_path}/remove_files_test_1.txt")
@@ -114,14 +114,14 @@ class TestJumpstartFileTools < Test::Unit::TestCase
114
114
  FileUtils.touch("#{@file_path}/remove_files_test_3.txt")
115
115
  @file_array = []
116
116
  end
117
-
117
+
118
118
  should "delete the file remove_files_test_1.txt" do
119
119
  file = FileUtils.join_paths(@file_path, "/remove_files_test_1.txt")
120
120
  @file_array << file
121
121
  FileUtils.remove_files(@file_array)
122
122
  assert !File.exists?("#{@file_path}/remove_files_test_1.txt")
123
123
  end
124
-
124
+
125
125
  should "delete all three test files" do
126
126
  @file_array << "/remove_files_test_1.txt" << "/remove_files_test_2.txt" << "/remove_files_test_3.txt"
127
127
  @file_array.map!{|x| FileUtils.join_paths(@file_path, x)}
@@ -130,15 +130,15 @@ class TestJumpstartFileTools < Test::Unit::TestCase
130
130
  assert !File.exists?("#{@file_path}/remove_files_test_2.txt")
131
131
  assert !File.exists?("#{@file_path}/remove_files_test_3.txt")
132
132
  end
133
-
133
+
134
134
  end
135
-
135
+
136
136
  context "Testing JumpStart::FileUtils#remove_lines class method.\n" do
137
-
137
+
138
138
  setup do
139
139
  @file_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/remove_lines_test.txt"
140
140
  end
141
-
141
+
142
142
  should "remove line 5 from the test file using the :lines argument" do
143
143
  FileUtils.remove_lines(@file_path, :lines => [5])
144
144
  file = IO.readlines(@file_path)
@@ -146,7 +146,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
146
146
  assert_equal "6\n", file.fetch(4)
147
147
  FileUtils.insert_text_at_line_number("5", @file_path, 5)
148
148
  end
149
-
149
+
150
150
  should "remove lines 5 & 9 from the test file using the :lines argument" do
151
151
  FileUtils.remove_lines(@file_path, :lines => [1,10])
152
152
  file = IO.readlines(@file_path)
@@ -154,7 +154,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
154
154
  FileUtils.insert_text_at_line_number("1", @file_path, 1)
155
155
  FileUtils.insert_text_at_line_number("10", @file_path, 10)
156
156
  end
157
-
157
+
158
158
  should "remove line 5 from the test file using the :line argument" do
159
159
  FileUtils.remove_lines(@file_path, :line => 5)
160
160
  file = IO.readlines(@file_path)
@@ -162,11 +162,11 @@ class TestJumpstartFileTools < Test::Unit::TestCase
162
162
  assert_equal "6\n", file.fetch(4)
163
163
  FileUtils.insert_text_at_line_number("5", @file_path, 5)
164
164
  end
165
-
165
+
166
166
  should "return an argument error as :lines and :line cannot be specified at the same time." do
167
167
  assert_raises(ArgumentError) {FileUtils.remove_lines(@file_path, :line => 5, :lines => [6,7])}
168
168
  end
169
-
169
+
170
170
  should "remove line 5 from the test file using the :pattern argument" do
171
171
  FileUtils.remove_lines(@file_path, :pattern => "5")
172
172
  file = IO.readlines(@file_path)
@@ -174,7 +174,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
174
174
  assert_equal "6\n", file.fetch(4)
175
175
  FileUtils.insert_text_at_line_number("5", @file_path, 5)
176
176
  end
177
-
177
+
178
178
  should "remove line 5 from the test file using the pattern argument, and remove line 9 from the file using the :line argument" do
179
179
  FileUtils.remove_lines(@file_path, :pattern => "5", :line => 9)
180
180
  file = IO.readlines(@file_path)
@@ -196,44 +196,44 @@ class TestJumpstartFileTools < Test::Unit::TestCase
196
196
  FileUtils.insert_text_at_line_number("8", @file_path, 8)
197
197
  FileUtils.insert_text_at_line_number("9", @file_path, 9)
198
198
  end
199
-
199
+
200
200
  end
201
201
 
202
202
  context "Testing JumpStart::FileUtils#config_nginx class method.\n" do
203
-
203
+
204
204
  setup do
205
205
  @source_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/config_nginx_source.txt"
206
206
  @target_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/config_nginx_test.txt"
207
207
  @project_name = "test_project"
208
208
  FileUtils.remove_lines(@target_path, :pattern => "LINE ADDED BY TEST")
209
209
  end
210
-
210
+
211
211
  should "copy nginx source file into target path" do
212
212
  FileUtils.config_nginx(@source_path, @target_path, @project_name)
213
213
  file = IO.readlines(@target_path)
214
214
  assert_equal "LINE ADDED BY TEST\n", file[80]
215
215
  end
216
-
216
+
217
217
  end
218
218
 
219
219
  context "Testing JumpStart::FileUtils#config_hosts class method.\n" do
220
-
220
+
221
221
  setup do
222
222
  @project_name = "test_project"
223
223
  @target_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/hosts_test"
224
224
  FileUtils.remove_lines(@target_path, :pattern => "127.0.0.1 test_project.local")
225
225
  end
226
-
226
+
227
227
  should "add line for test_project.local to hosts_test file" do
228
228
  FileUtils.config_hosts(@target_path, @project_name)
229
229
  file = IO.readlines(@target_path)
230
230
  assert_equal "127.0.0.1 test_project.local\n", file[10]
231
231
  end
232
-
232
+
233
233
  end
234
234
 
235
235
  context "Testing JumpStart::FileUtils#replace_strings class method.\n" do
236
-
236
+
237
237
  setup do
238
238
  @target_file = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/config_capistrano_test.rb"
239
239
  @app_name = "test_project"
@@ -243,7 +243,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
243
243
  file.puts @source_file
244
244
  end
245
245
  end
246
-
246
+
247
247
  should "replace strings with replace_strings method" do
248
248
  FileUtils.replace_strings(@target_file, :app_name => 'test_app', :REMOTE_SERVER => 'remote_box')
249
249
  file = IO.readlines(@target_file)
@@ -251,53 +251,53 @@ class TestJumpstartFileTools < Test::Unit::TestCase
251
251
  assert_equal "set :domain, 'remote_box'\n", file[1]
252
252
  assert_equal "run \"\#{sudo} nginx_auto_config /usr/local/bin/nginx.remote.conf /opt/nginx/conf/nginx.conf test_app\"\n", file[44]
253
253
  end
254
-
254
+
255
255
  end
256
256
 
257
257
  context "Testing JumpStart::FileUtils#check_source_type class method.\n" do
258
-
258
+
259
259
  should "return source as a string" do
260
260
  assert_equal "source_as_a_string", FileUtils.check_source_type("source_as_a_string")
261
261
  end
262
-
262
+
263
263
  should "return source as an array" do
264
264
  assert_equal ["Line from check_source_type.txt. Line number: 1\n",
265
- "Line from check_source_type.txt. Line number: 2\n",
266
- "Line from check_source_type.txt. Line number: 3\n",
267
- "Line from check_source_type.txt. Line number: 4\n",
268
- "Line from check_source_type.txt. Line number: 5\n",
269
- "Line from check_source_type.txt. Line number: 6\n",
270
- "Line from check_source_type.txt. Line number: 7\n",
271
- "Line from check_source_type.txt. Line number: 8\n",
272
- "Line from check_source_type.txt. Line number: 9\n",
273
- "Line from check_source_type.txt. Line number: 10"], FileUtils.check_source_type("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/check_source_type.txt")
274
- end
275
-
265
+ "Line from check_source_type.txt. Line number: 2\n",
266
+ "Line from check_source_type.txt. Line number: 3\n",
267
+ "Line from check_source_type.txt. Line number: 4\n",
268
+ "Line from check_source_type.txt. Line number: 5\n",
269
+ "Line from check_source_type.txt. Line number: 6\n",
270
+ "Line from check_source_type.txt. Line number: 7\n",
271
+ "Line from check_source_type.txt. Line number: 8\n",
272
+ "Line from check_source_type.txt. Line number: 9\n",
273
+ "Line from check_source_type.txt. Line number: 10"], FileUtils.check_source_type("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/check_source_type.txt")
274
+ end
275
+
276
276
  should "return source as an array, even without a file extension." do
277
277
  assert_equal ["Line from check_source_type.txt. Line number: 1\n",
278
- "Line from check_source_type.txt. Line number: 2\n",
279
- "Line from check_source_type.txt. Line number: 3\n",
280
- "Line from check_source_type.txt. Line number: 4\n",
281
- "Line from check_source_type.txt. Line number: 5"], FileUtils.check_source_type("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/check_source_type")
278
+ "Line from check_source_type.txt. Line number: 2\n",
279
+ "Line from check_source_type.txt. Line number: 3\n",
280
+ "Line from check_source_type.txt. Line number: 4\n",
281
+ "Line from check_source_type.txt. Line number: 5"], FileUtils.check_source_type("#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/check_source_type")
282
282
  end
283
-
283
+
284
284
  end
285
-
285
+
286
286
  context "Testing JumpStart::#join_paths class method.\n" do
287
-
287
+
288
288
  should "return the relative path passed to it unaltered." do
289
289
  assert_equal "path/to/file.txt", FileUtils.join_paths("path/to/file.txt")
290
290
  end
291
-
291
+
292
292
  should "return the absolute path passed to it unaltered." do
293
293
  assert_equal "/path/to/file.txt", FileUtils.join_paths("/path/to/file.txt")
294
294
  end
295
-
295
+
296
296
  should "return the path even if it is passed as a variable" do
297
297
  string = "/path/to/file.txt"
298
298
  assert_equal string, FileUtils.join_paths(string)
299
299
  end
300
-
300
+
301
301
  should "return a valid path if too many forward slashes are entered as an array" do
302
302
  a = %w[this/ //array/// /of/ /paths/ /has// /far/ //too/ ////many/ /forward// /slashes.txt]
303
303
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a)
@@ -307,7 +307,7 @@ class TestJumpstartFileTools < Test::Unit::TestCase
307
307
  a,b,c,d,e,f,g,h,i,j = 'this/', '//array///', '/of/', '/paths/', '/has//', '/far/', '//too/', '////many/', '/forward//', '/slashes.txt'
308
308
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g,h,i,j)
309
309
  end
310
-
310
+
311
311
  should "return a valid path if paths are missing forward slashes and entered as an array" do
312
312
  a = %w[this array of paths has far too many forward slashes.txt]
313
313
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a)
@@ -322,12 +322,12 @@ class TestJumpstartFileTools < Test::Unit::TestCase
322
322
  a,b,c,d,e,f,g = 'this/', '//array///', %w[/of/], '/paths/', %w[/has// /far/], '//too/', %w[////many/ /forward// /slashes.txt]
323
323
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g)
324
324
  end
325
-
325
+
326
326
  should "return a valid path some paths have too many forward slashes and some don't. Some arguments are passed in arrays, some as strings, mixed with nil values" do
327
327
  a,b,c,d,e,f,g,h,i,j = 'this/', '//array///', nil, %w[/of/], '/paths/', %w[/has// /far/], nil, '//too/', nil, %w[////many/ /forward// /slashes.txt]
328
328
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g,h,i,j)
329
329
  end
330
-
330
+
331
331
  should "return a valid path, even if path ends with many forward slashes" do
332
332
  a,b,c,d,e,f,g,h,i,j,k = 'this/', '//array///', nil, %w[/of/], '/paths/', %w[/has// /far/], nil, '//too/', nil, %w[////many/ /forward// /slashes.txt/////]
333
333
  assert_equal "this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g,h,i,j)
@@ -337,20 +337,20 @@ class TestJumpstartFileTools < Test::Unit::TestCase
337
337
  a,b,c,d,e,f,g,h,i,j,k = "////", ' this/array///', nil, %w[/of/], '/paths/ ', %w[/has// /far/], nil, "//too/\n", nil, ["////many/\n", " /forward// ", "\n /slashes.txt\n\n\n"]
338
338
  assert_equal "/this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g,h,i,j,k)
339
339
  end
340
-
340
+
341
341
  should "return an absolute path with symbols included in the values entered." do
342
342
  a,b,c,d,e,f,g,h,i,j = "///this/\n", ' //array///', nil, %w[/of/], :paths, %w[/has// /far/], nil, "//too/\n", nil, ["////many/\n", :forward, "\n /slashes.txt\n\n\n"]
343
343
  assert_equal "/this/array/of/paths/has/far/too/many/forward/slashes.txt", FileUtils.join_paths(a,b,c,d,e,f,g,h,i,j)
344
344
  end
345
-
345
+
346
346
  end
347
-
347
+
348
348
  context "Testing JumpStart::FileUtils#sort_contained_files_and_dirs class method" do
349
-
349
+
350
350
  setup do
351
351
  @path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test"
352
352
  end
353
-
353
+
354
354
  should "seperate files and dirs contained in the directory specified and output the collections in a hash" do
355
355
  results = FileUtils.sort_contained_files_and_dirs(@path)
356
356
  assert_equal ["/file_1.txt",
@@ -364,17 +364,17 @@ class TestJumpstartFileTools < Test::Unit::TestCase
364
364
  "/folder_1/folder_2/folder_3",
365
365
  "/folder_1/folder_2/folder_4"], results[:dirs].sort
366
366
  end
367
-
367
+
368
368
  should "return an empty hash when passed nil" do
369
369
  results = FileUtils.sort_contained_files_and_dirs(nil)
370
370
  assert_equal( {:files => [], :dirs => []}, results)
371
371
  end
372
-
372
+
373
373
  should "return an empty hash when passed a path that does not exist" do
374
374
  results = FileUtils.sort_contained_files_and_dirs("#{@path}/the_mighty_zargs_imaginary_path")
375
375
  assert_equal( {:files => [], :dirs => []}, results)
376
376
  end
377
-
377
+
378
378
  end
379
-
380
- end
379
+
380
+ end
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestJumpstartStringTools < Test::Unit::TestCase
4
-
4
+
5
5
  context "Tests for JumpStart::StringTools instance methods." do
6
6
 
7
7
  setup do
@@ -25,37 +25,37 @@ class TestJumpstartStringTools < Test::Unit::TestCase
25
25
  assert_equal "\e[32mhello\e[0m" , @string.green
26
26
  end
27
27
  end
28
-
28
+
29
29
  context "Test for JumpStart::StringTools#green_bold instance method." do
30
30
  should "alter string to add green_bold colour code and reset back to normal at the end." do
31
31
  assert_equal "\e[1m\e[32mhello\e[0m" , @string.green_bold
32
32
  end
33
33
  end
34
-
34
+
35
35
  context "Test for JumpStart::StringTools#yellow instance method." do
36
36
  should "alter string to add yellow colour code and reset back to normal at the end." do
37
37
  assert_equal "\e[1m\e[33mhello\e[0m" , @string.yellow
38
38
  end
39
39
  end
40
-
40
+
41
41
  context "Test for JumpStart::StringTools#blue instance method." do
42
42
  should "alter string to add blue colour code and reset back to normal at the end." do
43
43
  assert_equal "\e[34mhello\e[0m" , @string.blue
44
44
  end
45
45
  end
46
-
46
+
47
47
  context "Test for JumpStart::StringTools#blue_bold instance method." do
48
48
  should "alter string to add blue_bold colour code and reset back to normal at the end." do
49
49
  assert_equal "\e[1m\e[34mhello\e[0m" , @string.blue_bold
50
50
  end
51
51
  end
52
-
52
+
53
53
  context "Test for JumpStart::StringTools#purple instance method." do
54
54
  should "alter string to add purple colour code and reset back to normal at the end." do
55
55
  assert_equal "\e[1m\e[35mhello\e[0m" , @string.purple
56
56
  end
57
57
  end
58
-
58
+
59
59
  context "Test for JumpStart::StringTools#colourise instance method." do
60
60
  should "insert colour_code value before text and then end with reset output." do
61
61
  assert_equal "blue_colour_code hello\e[0m", @string.colourise(@string, "blue_colour_code ")
@@ -63,5 +63,5 @@ class TestJumpstartStringTools < Test::Unit::TestCase
63
63
  end
64
64
 
65
65
  end
66
-
67
- end
66
+
67
+ end
@@ -5,14 +5,14 @@ class TestJumpStartWithDefaultTemplateSet < Test::Unit::TestCase
5
5
  context "JumpStart::Setup.templates_path is set to and JumpStart::Setup.default_template_name is nil as @jumpstart_setup_yaml is not loaded" do
6
6
 
7
7
  setup do
8
- JumpStart.module_eval do
9
- @jumpstart_setup_yaml = nil
8
+ JumpStart.module_eval do
9
+ @jumpstart_setup_yaml = nil
10
10
  @templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
11
11
  end
12
12
  end
13
-
13
+
14
14
  teardown do
15
- reset_global_defaults
15
+ reset_global_defaults
16
16
  end
17
17
 
18
18
  should "loop on check_project_name method when passed one argument under 3 characters and a valid second argument. JumpStart::Setup.templates_path should be set to default." do
@@ -61,8 +61,8 @@ class TestJumpStartWithDefaultTemplateSet < Test::Unit::TestCase
61
61
  @project.expects(:check_install_path)
62
62
  @project.expects(:jumpstart_menu).never
63
63
  @project.check_setup
64
- end
64
+ end
65
65
 
66
66
  end
67
-
68
- end
67
+
68
+ end
@@ -3,19 +3,19 @@ require 'helper'
3
3
  class TestJumpStartWithNoGlobalDefaults < Test::Unit::TestCase
4
4
 
5
5
  context "JumpStart::Setup.templates_path and JumpStart::Setup.default_template_name are both set to nil as @jumpstart_setup_yaml is not loaded" do
6
-
6
+
7
7
  setup do
8
- JumpStart.module_eval do
8
+ JumpStart.module_eval do
9
9
  @jumpstart_setup_yaml = nil
10
10
  @default_template_name = nil
11
11
  end
12
12
  @project.stubs(:jumpstart_menu)
13
13
  end
14
-
14
+
15
15
  teardown do
16
16
  reset_global_defaults
17
17
  end
18
-
18
+
19
19
  should "launch menu when passed nil. JumpStart::Setup.templates_path should be set to default." do
20
20
  @project = JumpStart::Base.new([nil])
21
21
  @project.expects(:jumpstart_menu).once
@@ -60,7 +60,7 @@ class TestJumpStartWithNoGlobalDefaults < Test::Unit::TestCase
60
60
  assert_equal "#{JumpStart::ROOT_PATH}/jumpstart_templates", @project.instance_variable_get(:@template_path)
61
61
  assert_equal nil, @project.instance_eval {@template_name}
62
62
  end
63
-
63
+
64
64
  end
65
-
66
- end
65
+
66
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 7
9
- version: 0.3.7
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ian Alexander Wood (i0n)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-01 00:00:00 +01:00
17
+ date: 2010-06-02 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency