jumpstart 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -0,0 +1,71 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'jumpstart'
6
+
7
+ # Runs all tests
8
+ require 'rake/testtask'
9
+ Rake::TestTask.new(:test) do |test|
10
+ test.libs << 'lib' << 'test'
11
+ test.pattern = 'test/**/test_*.rb'
12
+ test.verbose = true
13
+ end
14
+
15
+ namespace :deploy do
16
+
17
+ desc "Commits changes to local git repo and then pushes to remote"
18
+ task :git do
19
+ git_actions
20
+ end
21
+
22
+ desc "Builds gemspec and deploys gem to RubyGems.org"
23
+ task :gem do
24
+ rubygems_actions
25
+ end
26
+
27
+ end
28
+
29
+ namespace :version do
30
+
31
+ namespace :bump do
32
+
33
+ desc "Bumps major version number by 1"
34
+ task :major do
35
+ JumpStart::Setup.bump_version_major
36
+ git_actions
37
+ end
38
+
39
+ desc "Bumps minor version number by 1"
40
+ task :minor do
41
+ JumpStart::Setup.bump_version_minor
42
+ git_actions
43
+ end
44
+
45
+ desc "Bumps patch version number by 1"
46
+ task :patch do
47
+ JumpStart::Setup.bump_version_patch
48
+ git_actions
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+
55
+ def git_actions
56
+ Dir.chdir("#{JumpStart::ROOT_PATH}")
57
+ system "git add ."
58
+ system "git commit -v -a -m 'commit for version: #{JumpStart.version}'"
59
+ system "git tag #{JumpStart.version}"
60
+ system "git push --tags"
61
+ end
62
+
63
+ def rubygems_actions
64
+ Dir.chdir("#{JumpStart::ROOT_PATH}")
65
+ system "gem build jumpstart.gemspec"
66
+ system "gem push jumpstart-#{JumpStart.version}.gem"
67
+ end
68
+
69
+ def test
70
+ puts "YO YO YO"
71
+ end
@@ -0,0 +1,4 @@
1
+ ---
2
+ :jumpstart_version_major: 0
3
+ :jumpstart_version_minor: 1
4
+ :jumpstart_version_patch: 11
data/lib/jumpstart.rb CHANGED
@@ -20,32 +20,16 @@ module JumpStart
20
20
  CONFIG_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../config'))
21
21
  IGNORE_DIRS = ['.','..']
22
22
 
23
+ require 'jumpstart/setup'
23
24
  require 'jumpstart/base'
24
25
  require 'jumpstart/filetools'
25
26
  require 'jumpstart/stringtools'
26
-
27
- jumpstart_setup_yaml = YAML.load_file("#{CONFIG_PATH}/jumpstart_setup.yml")
28
- # The path to the jumpstart templates directory.
29
- # Set as a module instance variable.
30
- @templates_path = jumpstart_setup_yaml[:jumpstart_templates_path]
31
- # sets the default template to use if it has not been passed as an argument.
32
- # Set as a module instance variable.
33
- @default_template_name = jumpstart_setup_yaml[:jumpstart_default_template_name]
34
27
 
35
- # Get and Set methods for module instance variables.
36
- def self.templates_path; @templates_path; end
37
- def self.templates_path=(value); @templates_path = value; end
38
- def self.default_template_name; @default_template_name; end
39
- def self.default_template_name=(value); @default_template_name = value; end
40
-
41
- class Setup
42
- def self.dump_global_yaml
43
- File.open( "#{CONFIG_PATH}/jumpstart_setup.yml", 'w' ) do |out|
44
- YAML.dump( {:jumpstart_templates_path => JumpStart.templates_path, :jumpstart_default_template_name => JumpStart.default_template_name}, out )
45
- end
46
- end
28
+ # Looks up the current version of JumpStart
29
+ def self.version
30
+ "#{JumpStart::Setup.version_major}.#{JumpStart::Setup.version_minor}.#{JumpStart::Setup.version_patch}"
47
31
  end
48
-
32
+
49
33
  end
50
34
 
51
35
  module FileUtils
@@ -58,8 +42,3 @@ class String
58
42
  include JumpStart::StringTools
59
43
  end
60
44
 
61
- # Set the jumpstart templates path back to default if it has not been set
62
- if JumpStart.templates_path.nil? || JumpStart.templates_path.empty?
63
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/jumpstart_templates"
64
- JumpStart::Setup.dump_global_yaml
65
- end
@@ -19,19 +19,19 @@ module JumpStart
19
19
  @input = $stdin
20
20
  # setup for testing output
21
21
  @output = $stdout
22
- # set the name of the project from the first argument passed, or from the module instance variable JumpStart.default_template_name if no argument passed.
22
+ # set the name of the project from the first argument passed, or from the module instance variable JumpStart::Setup.default_template_name if no argument passed.
23
23
  @project_name = args.shift.dup if args[0] != nil
24
24
  if args[0] != nil
25
25
  @template_name = args.shift.dup
26
- elsif JumpStart.default_template_name.nil? != nil
27
- @template_name = JumpStart.default_template_name
26
+ elsif JumpStart::Setup.default_template_name.nil? != nil
27
+ @template_name = JumpStart::Setup.default_template_name
28
28
  end
29
29
  # set instance variable @template_path as the directory to read templates from.
30
- @template_path = FileUtils.join_paths(JumpStart.templates_path, @template_name)
30
+ @template_path = FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name)
31
31
  end
32
32
 
33
33
  # TODO Ensure that if jumpstart is launched with two arguments they are parsed as @project_name and @template_name, and the command is launched without any menu display.
34
- # TODO Ensure that if jumpstart is launched with one argument it is parsed as @project_name, and if JumpStart.default_template_name exists then the command is launched without any menu display.
34
+ # TODO Ensure that if jumpstart is launched with one argument it is parsed as @project_name, and if JumpStart::Setup.default_template_name exists then the command is launched without any menu display.
35
35
  # TODO Write integration tests.
36
36
  # TODO Document methods for RDOC
37
37
  # Finish README etc for github
@@ -41,8 +41,8 @@ module JumpStart
41
41
  def set_config_file_options
42
42
  if @template_name.nil?
43
43
  jumpstart_menu
44
- elsif File.exists?(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config/", "#{@template_name}.yml"))
45
- @config_file = YAML.load_file(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config/", "#{@template_name}.yml"))
44
+ elsif File.exists?(FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name, "/jumpstart_config/", "#{@template_name}.yml"))
45
+ @config_file = YAML.load_file(FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name, "/jumpstart_config/", "#{@template_name}.yml"))
46
46
  @install_command ||= @config_file[:install_command]
47
47
  @install_command_args ||= @config_file[:install_command_args]
48
48
  @replace_strings ||= @config_file[:replace_strings].each {|x| x}
@@ -64,11 +64,11 @@ module JumpStart
64
64
  # set up instance variable containing an array that will be populated with existing jumpstart templates
65
65
  def lookup_existing_templates
66
66
  @existing_templates = []
67
- template_dirs = Dir.entries(JumpStart.templates_path) - IGNORE_DIRS
67
+ template_dirs = Dir.entries(JumpStart::Setup.templates_path) - IGNORE_DIRS
68
68
  template_dirs.each do |x|
69
- if File.directory?(FileUtils.join_paths(JumpStart.templates_path, x))
70
- if Dir.entries(FileUtils.join_paths(JumpStart.templates_path, x)).include? "jumpstart_config"
71
- if File.exists?(FileUtils.join_paths(JumpStart.templates_path, x, '/jumpstart_config/', "#{x}.yml"))
69
+ if File.directory?(FileUtils.join_paths(JumpStart::Setup.templates_path, x))
70
+ if Dir.entries(FileUtils.join_paths(JumpStart::Setup.templates_path, x)).include? "jumpstart_config"
71
+ if File.exists?(FileUtils.join_paths(JumpStart::Setup.templates_path, x, '/jumpstart_config/', "#{x}.yml"))
72
72
  @existing_templates << x
73
73
  end
74
74
  end
@@ -151,13 +151,13 @@ module JumpStart
151
151
  end
152
152
 
153
153
  def create_template
154
- if File.directory?(FileUtils.join_paths(JumpStart.templates_path, @template_name))
155
- puts "\nThe directory #{FileUtils.join_paths(JumpStart.templates_path, @template_name).red} already exists. The template will not be created."
154
+ if File.directory?(FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name))
155
+ puts "\nThe directory #{FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name).red} already exists. The template will not be created."
156
156
  exit_normal
157
157
  else
158
- FileUtils.mkdir_p(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config"))
158
+ FileUtils.mkdir_p(FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name, "/jumpstart_config"))
159
159
  yaml = IO.read(FileUtils.join_paths(ROOT_PATH, "/source_templates/template_config.yml"))
160
- File.open(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config", "#{@template_name}.yml"), 'w') do |file|
160
+ File.open(FileUtils.join_paths(JumpStart::Setup.templates_path, @template_name, "/jumpstart_config", "#{@template_name}.yml"), 'w') do |file|
161
161
  file.puts yaml
162
162
  end
163
163
  puts "The template #{@template_name.green} has been generated.\n"
@@ -258,9 +258,9 @@ module JumpStart
258
258
  puts " The template name ".red + input.red_bold + " begins with an invalid character. Please enter a name that begins with a letter or a number.".red
259
259
  new_template_options
260
260
  else
261
- FileUtils.mkdir_p(FileUtils.join_paths(JumpStart.templates_path, input, "jumpstart_config"))
262
- FileUtils.cp(FileUtils.join_paths(ROOT_PATH, "source_templates/template_config.yml"), FileUtils.join_paths(JumpStart.templates_path, input, "jumpstart_config", "#{input}.yml"))
263
- puts " The template ".green + input.green_bold + " has been created in your default jumpstart template directory ".green + JumpStart.templates_path.green_bold + " ready for editing.".green
261
+ FileUtils.mkdir_p(FileUtils.join_paths(JumpStart::Setup.templates_path, input, "jumpstart_config"))
262
+ FileUtils.cp(FileUtils.join_paths(ROOT_PATH, "source_templates/template_config.yml"), FileUtils.join_paths(JumpStart::Setup.templates_path, input, "jumpstart_config", "#{input}.yml"))
263
+ puts " The template ".green + input.green_bold + " has been created in your default jumpstart template directory ".green + JumpStart::Setup.templates_path.green_bold + " ready for editing.".green
264
264
  jumpstart_menu
265
265
  end
266
266
  end
@@ -284,9 +284,9 @@ module JumpStart
284
284
  input = gets.chomp.strip
285
285
  case
286
286
  when input.to_i <= @existing_templates.count && input.to_i > 0
287
- JumpStart.default_template_name = @existing_templates[(input.to_i - 1)]
288
- JumpStart::Setup.dump_global_yaml
289
- puts " The default jumpstart template has been set to: #{JumpStart.default_template_name.green}"
287
+ JumpStart::Setup.default_template_name = @existing_templates[(input.to_i - 1)]
288
+ JumpStart::Setup.dump_jumpstart_setup_yaml
289
+ puts " The default jumpstart template has been set to: #{JumpStart::Setup.default_template_name.green}"
290
290
  jumpstart_menu
291
291
  when input == "b"
292
292
  jumpstart_menu
@@ -339,12 +339,12 @@ module JumpStart
339
339
  begin
340
340
  Dir.chdir(root_path)
341
341
  Dir.mkdir(input)
342
- files_and_dirs = FileUtils.sort_contained_files_and_dirs(JumpStart.templates_path)
342
+ files_and_dirs = FileUtils.sort_contained_files_and_dirs(JumpStart::Setup.templates_path)
343
343
  puts "\nCopying existing templates to #{input}"
344
344
  files_and_dirs[:dirs].each {|x| FileUtils.mkdir_p(FileUtils.join_paths(input, x))}
345
- files_and_dirs[:files].each {|x| FileUtils.cp(FileUtils.join_paths(JumpStart.templates_path, x), FileUtils.join_paths(input, x)) }
346
- JumpStart.templates_path = input.to_s
347
- JumpStart::Setup.dump_global_yaml
345
+ files_and_dirs[:files].each {|x| FileUtils.cp(FileUtils.join_paths(JumpStart::Setup.templates_path, x), FileUtils.join_paths(input, x)) }
346
+ JumpStart::Setup.templates_path = input.to_s
347
+ JumpStart::Setup.dump_jumpstart_setup_yaml
348
348
  puts "\nTransfer complete!".green
349
349
  jumpstart_menu
350
350
  rescue
@@ -355,12 +355,12 @@ module JumpStart
355
355
 
356
356
  # Checks to see if the JumpStart template directory should be reset to the default location. (within the gem.)
357
357
  def reset_templates_dir_to_default_check
358
- if JumpStart.templates_path == "#{ROOT_PATH}/jumpstart_templates"
358
+ if JumpStart::Setup.templates_path == "#{ROOT_PATH}/jumpstart_templates"
359
359
  puts " You do not need to reset the jumpstart templates directory, it is already set to: #{ROOT_PATH}/jumpstart_templates\n\n".red
360
360
  templates_dir_menu
361
361
  else
362
362
  puts " Resetting the jumpstart templates directory to the default: #{ROOT_PATH}/jumpstart_templates\n\n"
363
- @current_files_and_dirs = FileUtils.sort_contained_files_and_dirs(JumpStart.templates_path)
363
+ @current_files_and_dirs = FileUtils.sort_contained_files_and_dirs(JumpStart::Setup.templates_path)
364
364
  puts " Moving your jumpstart templates back to the default directory will delete any templates that are currently there. Proceed?\n".yellow
365
365
  puts " Type yes (" + "y".yellow + ") or no (" + "n".yellow + ")\n\n"
366
366
  reset_templates_dir_to_default_set
@@ -374,9 +374,9 @@ module JumpStart
374
374
  FileUtils.delete_dir_contents(FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates'))
375
375
  FileUtils.touch(FileUtils.join_paths(ROOT_PATH, '.gitignore'))
376
376
  @current_files_and_dirs[:dirs].each {|x| FileUtils.mkdir_p(FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates', x))}
377
- @current_files_and_dirs[:files].each {|x| FileUtils.cp(FileUtils.join_paths(JumpStart.templates_path, x), FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates', x)) }
378
- JumpStart.templates_path = FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates')
379
- JumpStart::Setup.dump_global_yaml
377
+ @current_files_and_dirs[:files].each {|x| FileUtils.cp(FileUtils.join_paths(JumpStart::Setup.templates_path, x), FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates', x)) }
378
+ JumpStart::Setup.templates_path = FileUtils.join_paths(ROOT_PATH, '/jumpstart_templates')
379
+ JumpStart::Setup.dump_jumpstart_setup_yaml
380
380
  puts "\n SUCCESS! the jumpstart templates directory has been set to the default: #{ROOT_PATH}/jumpstart_templates".green
381
381
  templates_dir_menu
382
382
  elsif input == "no" || input == "n"
@@ -507,6 +507,7 @@ module JumpStart
507
507
  puts "\n\n Exiting JumpStart...".purple
508
508
  puts "\n Success! ".green + @project_name.green_bold + " has been created at: ".green + FileUtils.join_paths(@install_path, @project_name).green_bold + "\n\n".green
509
509
  puts "******************************************************************************************************************************************\n"
510
+ JumpStart::Setup.dump_jumpstart_setup_yaml
510
511
  exit
511
512
  end
512
513
 
@@ -0,0 +1,59 @@
1
+ module JumpStart
2
+ class Setup
3
+
4
+ class << self
5
+ attr_accessor :templates_path, :default_template_name, :version_major, :version_minor, :version_patch
6
+ end
7
+
8
+ jumpstart_setup_yaml = YAML.load_file("#{JumpStart::CONFIG_PATH}/jumpstart_setup.yml")
9
+ jumpstart_version_yaml = YAML.load_file("#{JumpStart::CONFIG_PATH}/jumpstart_version.yml")
10
+
11
+ @version_major = jumpstart_version_yaml[:jumpstart_version_major]
12
+ @version_minor = jumpstart_version_yaml[:jumpstart_version_minor]
13
+ @version_patch = jumpstart_version_yaml[:jumpstart_version_patch]
14
+
15
+
16
+ # The path to the jumpstart templates directory.
17
+ # Set as a module instance variable.
18
+ @templates_path = jumpstart_setup_yaml[:jumpstart_templates_path]
19
+ # sets the default template to use if it has not been passed as an argument.
20
+ # Set as a module instance variable.
21
+ @default_template_name = jumpstart_setup_yaml[:jumpstart_default_template_name]
22
+
23
+ # Set the jumpstart templates path back to default if it has not been set
24
+ if @templates_path.nil? || @templates_path.empty?
25
+ @templates_path = "#{JumpStart::ROOT_PATH}/jumpstart_templates"
26
+ end
27
+
28
+ # Method for writing to config/jumpstart_setup.yml
29
+ def self.dump_jumpstart_setup_yaml
30
+ File.open( "#{JumpStart::CONFIG_PATH}/jumpstart_setup.yml", 'w' ) do |out|
31
+ YAML.dump( {:jumpstart_templates_path => @templates_path, :jumpstart_default_template_name => @default_template_name}, out )
32
+ end
33
+ end
34
+
35
+ # Method for writing to config/jumpstart_version.yml
36
+ def self.dump_jumpstart_version_yaml
37
+ File.open( "#{JumpStart::CONFIG_PATH}/jumpstart_version.yml", 'w' ) do |out|
38
+ YAML.dump( {:jumpstart_version_major => @version_major, :jumpstart_version_minor => @version_minor, :jumpstart_version_patch => @version_patch}, out )
39
+ end
40
+ end
41
+
42
+ # Method for bumping version number types.
43
+ def self.bump(version_type)
44
+ eval( "@#{version_type} += 1")
45
+ dump_jumpstart_version_yaml
46
+ end
47
+
48
+ # Handles calls to JumpStart::Setup.bump_version_major, JumpStart::Setup.bump_version_minor and JumpStart::Setup.bump_version_patch class methods.
49
+ def self.method_missing(method, *args)
50
+ if method.match(/bump_version_(major|minor|patch)/)
51
+ version_type = method.to_s.sub('bump_', '')
52
+ self.send(:bump, "#{version_type}")
53
+ else
54
+ super
55
+ end
56
+ end
57
+
58
+ end
59
+ end
@@ -12,8 +12,8 @@ class TestJumpstartBase < Test::Unit::TestCase
12
12
  unless File.directory?("#{JumpStart::ROOT_PATH}/test/destination_dir")
13
13
  Dir.mkdir("#{JumpStart::ROOT_PATH}/test/destination_dir")
14
14
  end
15
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
16
- JumpStart.default_template_name = "test_template_1"
15
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
16
+ JumpStart::Setup.default_template_name = "test_template_1"
17
17
  input = StringIO.new
18
18
  output = StringIO.new
19
19
  @test_project = JumpStart::Base.new(["test_jumpstart_project"])
@@ -27,7 +27,7 @@ class TestJumpstartBase < Test::Unit::TestCase
27
27
  @test_project.stubs(:exit_with_success)
28
28
  end
29
29
 
30
- # A valid project but with an invalid template name passed in the argument with a valid project name. Project ends up valid as JumpStart.default_template_name is valid and it falls back on this.
30
+ # A valid project but with an invalid template name passed in the argument with a valid project name. Project ends up valid as JumpStart::Setup.default_template_name is valid and it falls back on this.
31
31
  # IO has been setup for testing
32
32
  # runs set_config_file_options to set all instance variables
33
33
  setup do
@@ -107,11 +107,11 @@ class TestJumpstartBase < Test::Unit::TestCase
107
107
  context "Tests for the JumpStart::Base#intialize instance method. \n" do
108
108
 
109
109
  should "set @jumpstart_template_path" do
110
- assert_equal "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates", @test_project.instance_eval {JumpStart.templates_path}
110
+ assert_equal "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates", @test_project.instance_eval {JumpStart::Setup.templates_path}
111
111
  end
112
112
 
113
- should "set JumpStart.default_template_name" do
114
- assert_equal "test_template_1", @test_project.instance_eval {JumpStart.default_template_name}
113
+ should "set JumpStart::Setup.default_template_name" do
114
+ assert_equal "test_template_1", @test_project.instance_eval {JumpStart::Setup.default_template_name}
115
115
  end
116
116
 
117
117
  should "set @project_name" do
@@ -314,7 +314,7 @@ class TestJumpstartBase < Test::Unit::TestCase
314
314
  context "Tests for the JumpStart::Base#check_template_name instance method. \n" do
315
315
 
316
316
  should "launch jumpstart menu if nil" do
317
- JumpStart.default_template_name = nil
317
+ JumpStart::Setup.default_template_name = nil
318
318
  @test_project.instance_variable_set(:@template_name, nil)
319
319
  @test_project.stubs(:jumpstart_menu).returns("jumpstart_menu")
320
320
  @test_project.expects(:jumpstart_menu).once
@@ -322,7 +322,7 @@ class TestJumpstartBase < Test::Unit::TestCase
322
322
  end
323
323
 
324
324
  should "launch jumpstart menu if empty" do
325
- JumpStart.default_template_name = ""
325
+ JumpStart::Setup.default_template_name = ""
326
326
  @test_project.instance_variable_set(:@template_name, "")
327
327
  @test_project.stubs(:jumpstart_menu).returns("jumpstart_menu")
328
328
  @test_project.expects(:jumpstart_menu).once
@@ -366,16 +366,16 @@ class TestJumpstartBase < Test::Unit::TestCase
366
366
  context "Tests for the JumpStart::Base#create_template instance method. \n" do
367
367
 
368
368
  setup do
369
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
369
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
370
370
  @test_project.instance_variable_set(:@template_name, "testing_create_template")
371
371
  end
372
372
 
373
- should "create a template direcotry named after @template_name in the JumpStart.templates_path directory. Inside this dir it will create a /jumpstart_config directory, and inside that it will create a yaml config file called @template_name.yml and populated with JumpStart::ROOT_PATH/source_templates/template_config.yml " do
373
+ should "create a template direcotry named after @template_name in the JumpStart::Setup.templates_path directory. Inside this dir it will create a /jumpstart_config directory, and inside that it will create a yaml config file called @template_name.yml and populated with JumpStart::ROOT_PATH/source_templates/template_config.yml " do
374
374
  @test_project.instance_eval {create_template}
375
375
  assert File.exists?("#{JumpStart::ROOT_PATH}/test/destination_dir/testing_create_template/jumpstart_config/testing_create_template.yml")
376
376
  end
377
377
 
378
- should "give a message and exit if a directory with the same name as @template_name exists in the JumpStart.templates_path dir" do
378
+ should "give a message and exit if a directory with the same name as @template_name exists in the JumpStart::Setup.templates_path dir" do
379
379
  FileUtils.mkdir("#{JumpStart::ROOT_PATH}/test/destination_dir/testing_create_template")
380
380
  @test_project.expects(:exit_normal).once
381
381
  @test_project.instance_eval {create_template}
@@ -470,8 +470,8 @@ class TestJumpstartBase < Test::Unit::TestCase
470
470
  end
471
471
 
472
472
  should "create a new project with the specified template name, checking that the project name is valid when a valid number is entered" do
473
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
474
- JumpStart.default_template_name = "test_template_1"
473
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
474
+ JumpStart::Setup.default_template_name = "test_template_1"
475
475
  @test_project.expects(:check_project_name).once
476
476
  @test_project.instance_variable_set(:@input, StringIO.new("1\n"))
477
477
  @test_project.instance_eval {new_project_from_template_options}
@@ -518,7 +518,7 @@ class TestJumpstartBase < Test::Unit::TestCase
518
518
  context "Tests for the JumpStart::Base#new_template_options instance method." do
519
519
 
520
520
  setup do
521
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
521
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
522
522
  @test_project.stubs(:jumpstart_menu).returns("jumpstart_menu")
523
523
  @test_project.instance_variable_set(:@existing_templates, %w[one two three])
524
524
  end
@@ -568,31 +568,31 @@ class TestJumpstartBase < Test::Unit::TestCase
568
568
 
569
569
  setup do
570
570
  @test_project.stubs(:jumpstart_menu)
571
- JumpStart::Setup.stubs(:dump_global_yaml)
571
+ JumpStart::Setup.stubs(:dump_jumpstart_setup_yaml)
572
572
  @test_project.instance_variable_set(:@existing_templates, %w[template1 template2 template3])
573
- JumpStart.default_template_name = "temp_default"
573
+ JumpStart::Setup.default_template_name = "temp_default"
574
574
  end
575
575
 
576
576
  should "set the default template if a number corresponding to an existing template is entered." do
577
577
  @test_project.instance_variable_set(:@input, StringIO.new("1\n"))
578
578
  @test_project.expects(:jumpstart_menu).once
579
- JumpStart::Setup.expects(:dump_global_yaml).once
579
+ JumpStart::Setup.expects(:dump_jumpstart_setup_yaml).once
580
580
  @test_project.instance_eval {set_default_template_options}
581
- assert_equal "template1", JumpStart.default_template_name
581
+ assert_equal "template1", JumpStart::Setup.default_template_name
582
582
  end
583
583
 
584
584
  should "go back to the main jumpstart menu if 'b' is entered." do
585
585
  @test_project.instance_variable_set(:@input, StringIO.new("b\n"))
586
586
  @test_project.expects(:jumpstart_menu).once
587
587
  @test_project.instance_eval {set_default_template_options}
588
- assert_equal "temp_default", JumpStart.default_template_name
588
+ assert_equal "temp_default", JumpStart::Setup.default_template_name
589
589
  end
590
590
 
591
591
  should "exit jumpstart if 'x' is entered" do
592
592
  @test_project.instance_variable_set(:@input, StringIO.new("x\n"))
593
593
  @test_project.expects(:exit_normal).once
594
594
  @test_project.instance_eval {set_default_template_options}
595
- assert_equal "temp_default", JumpStart.default_template_name
595
+ assert_equal "temp_default", JumpStart::Setup.default_template_name
596
596
  end
597
597
 
598
598
  # Due to the recursive nature of this code, the only successful way to test is to check for the NoMethodError that is raised when the method is called for a second time, this time with @input as nil. I'd be interested to find another way to test this.
@@ -657,7 +657,7 @@ class TestJumpstartBase < Test::Unit::TestCase
657
657
  context "Tests for the JumpStart::Base#set_templates_dir instance method." do
658
658
 
659
659
  setup do
660
- JumpStart::Setup.stubs(:dump_global_yaml)
660
+ JumpStart::Setup.stubs(:dump_jumpstart_setup_yaml)
661
661
  @test_project.stubs(:jumpstart_menu)
662
662
  end
663
663
 
@@ -667,9 +667,9 @@ class TestJumpstartBase < Test::Unit::TestCase
667
667
  assert_raises(NoMethodError) {@test_project.instance_eval {set_templates_dir}}
668
668
  end
669
669
 
670
- should "create a new directory and copy existing templates into it, then set JumpStart.templates_path to the new location." do
670
+ should "create a new directory and copy existing templates into it, then set JumpStart::Setup.templates_path to the new location." do
671
671
  @test_project.instance_variable_set(:@input, StringIO.new("#{JumpStart::ROOT_PATH}/test/destination_dir/a_name_that_does_not_exist"))
672
- JumpStart::Setup.expects(:dump_global_yaml).once
672
+ JumpStart::Setup.expects(:dump_jumpstart_setup_yaml).once
673
673
  @test_project.expects(:jumpstart_menu).once
674
674
  @test_project.instance_eval {set_templates_dir}
675
675
  assert_equal "Please enter the absolute path for the directory that you would like to contain your jumpstart templates.\n\nCopying existing templates to /Users/i0n/Sites/jumpstart/test/destination_dir/a_name_that_does_not_exist\n\e[32m\nTransfer complete!\e[0m\n", @test_project.output.string
@@ -685,15 +685,15 @@ class TestJumpstartBase < Test::Unit::TestCase
685
685
  @test_project.stubs(:reset_templates_dir_to_default_set)
686
686
  end
687
687
 
688
- should "output a message and run templates_dir_menu if JumpStart.templates_path is set to it's standard starting position." do
689
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/jumpstart_templates"
688
+ should "output a message and run templates_dir_menu if JumpStart::Setup.templates_path is set to it's standard starting position." do
689
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/jumpstart_templates"
690
690
  @test_project.expects(:templates_dir_menu).once
691
691
  @test_project.instance_eval {reset_templates_dir_to_default_check}
692
692
  assert_equal "\e[31m You do not need to reset the jumpstart templates directory, it is already set to: /Users/i0n/Sites/jumpstart/jumpstart_templates\n\n\e[0m\n", @test_project.output.string
693
693
  end
694
694
 
695
- should "run reset_templates_dir_to_default_set if the current JumpStart.templates_path is not the default." do
696
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
695
+ should "run reset_templates_dir_to_default_set if the current JumpStart::Setup.templates_path is not the default." do
696
+ JumpStart::Setup.templates_path = "#{JumpStart::ROOT_PATH}/test/destination_dir"
697
697
  @test_project.expects(:reset_templates_dir_to_default_set).once
698
698
  @test_project.instance_eval {reset_templates_dir_to_default_check}
699
699
  assert_equal " Resetting the jumpstart templates directory to the default: /Users/i0n/Sites/jumpstart/jumpstart_templates\n\n\e[1m\e[33m Moving your jumpstart templates back to the default directory will delete any templates that are currently there. Proceed?\n\e[0m\n Type yes (\e[1m\e[33my\e[0m) or no (\e[1m\e[33mn\e[0m)\n\n", @test_project.output.string
@@ -704,12 +704,12 @@ class TestJumpstartBase < Test::Unit::TestCase
704
704
  context "Tests for the JumpStart::Base#reset_templates_dir_to_default_set instance method." do
705
705
 
706
706
  setup do
707
- JumpStart::Setup.stubs(:dump_global_yaml)
707
+ JumpStart::Setup.stubs(:dump_jumpstart_setup_yaml)
708
708
  @test_project.stubs(:templates_dir_menu)
709
709
  FileUtils.mkdir("#{JumpStart::ROOT_PATH}/test/destination_dir/jumpstart_templates")
710
710
  @normal_root_path = JumpStart::ROOT_PATH.dup
711
711
  JumpStart::ROOT_PATH = "#{@normal_root_path}/test/destination_dir"
712
- JumpStart.templates_path = "#{@normal_root_path}/test/test_jumpstart_templates/test_base"
712
+ JumpStart::Setup.templates_path = "#{@normal_root_path}/test/test_jumpstart_templates/test_base"
713
713
  @test_project.instance_variable_set(:@current_files_and_dirs, {:files => ['current_files_and_dirs_test_file.txt'], :dirs => ['current_files_and_dirs_test_dir']})
714
714
  end
715
715
 
@@ -1087,12 +1087,12 @@ class TestJumpstartBase < Test::Unit::TestCase
1087
1087
 
1088
1088
  end
1089
1089
 
1090
- context "Tests for the JumpStart::Setup#dump_global_yaml class method." do
1090
+ context "Tests for the JumpStart::Setup#dump_jumpstart_setup_yaml class method." do
1091
1091
  should "call File.open and Yaml.dump for jumpstart_setup.yml" do
1092
1092
  YAML.stubs(:dump)
1093
1093
  File.stubs(:open)
1094
1094
  File.expects(:open).once
1095
- JumpStart::Setup.dump_global_yaml
1095
+ JumpStart::Setup.dump_jumpstart_setup_yaml
1096
1096
  end
1097
1097
  end
1098
1098
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 10
9
- version: 0.1.10
8
+ - 11
9
+ version: 0.1.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ian Alexander Wood (i0n)
@@ -57,11 +57,12 @@ extra_rdoc_files: []
57
57
  files:
58
58
  - bin/jumpstart
59
59
  - config/jumpstart_setup.yml
60
- - jumpstart_templates/empty_template/empty_template.yml
60
+ - config/jumpstart_version.yml
61
+ - jumpstart_templates/empty_template/jumpstart_config/empty_template.yml
61
62
  - lib/jumpstart/base.rb
62
63
  - lib/jumpstart/filetools.rb
64
+ - lib/jumpstart/setup.rb
63
65
  - lib/jumpstart/stringtools.rb
64
- - lib/jumpstart/version.rb
65
66
  - lib/jumpstart.rb
66
67
  - source_templates/template_config.yml
67
68
  - test/fake_nginx_path/local_nginx_1.conf
@@ -1,3 +0,0 @@
1
- module JumpStart
2
- VERSION = "0.1.10"
3
- end