Class: WatirInstall::Generators::New

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/watir_install/generators/new.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



14
15
16
# File 'lib/watir_install/generators/new.rb', line 14

def self.source_root
  "#{File.dirname(__FILE__)}/new"
end

Instance Method Details

#bundleObject



64
65
66
67
# File 'lib/watir_install/generators/new.rb', line 64

def bundle
  Dir.chdir(name)
  system 'bundle install'
end

#data_filesObject



51
52
53
# File 'lib/watir_install/generators/new.rb', line 51

def data_files
  template "spec/support/data/base.rb.tt", "#{name}/spec/support/data/base.rb"
end

#initial_commitObject



69
70
71
72
73
74
# File 'lib/watir_install/generators/new.rb', line 69

def initial_commit
  if no_git == 'false'
    @git.lib.add('.', all: true)
    @git.commit("initial commit", {all: true})
  end
end

#page_filesObject



55
56
57
# File 'lib/watir_install/generators/new.rb', line 55

def page_files
  template "spec/support/pages/base.rb.tt", "#{name}/spec/support/pages/base.rb"
end

#root_filesObject



37
38
39
40
41
42
43
44
45
# File 'lib/watir_install/generators/new.rb', line 37

def root_files
  template "gemfile.rb.tt", "#{name}/Gemfile"
  template "gitignore.rb.tt", "#{name}/.gitignore"
  template "rakefile.rb.tt", "#{name}/Rakefile"
  template "readme.rb.tt", "#{name}/README.md"
  template "ruby-version.rb.tt", "#{name}/.ruby-version"
  template "travis.rb.tt", "#{name}/.travis.yml"
  template "rspec.rb.tt", "#{name}/.rspec"
end

#support_filesObject



59
60
61
62
# File 'lib/watir_install/generators/new.rb', line 59

def support_files
  template "spec/support/sauce_helpers.rb.tt", "#{name}/spec/support/sauce_helpers.rb"
  template "spec/support/site.rb.tt", "#{name}/spec/support/site.rb"
end

#test_filesObject



47
48
49
# File 'lib/watir_install/generators/new.rb', line 47

def test_files
  template "spec/spec_helper.rb.tt", "#{name}/spec/spec_helper.rb"
end

#user_emailObject



28
29
30
31
32
33
34
35
# File 'lib/watir_install/generators/new.rb', line 28

def user_email
  if no_git == 'false'
    @user_email ||= @git.config["user.email"]
    @user_email ||= ask "Enter your Email: "
    @git.config('user.email', @user_email)
    @user_email
  end
end

#user_nameObject



18
19
20
21
22
23
24
25
26
# File 'lib/watir_install/generators/new.rb', line 18

def user_name
  if no_git == 'false'
    @git = Git.init(name)
    @user_name ||= @git.config["user.name"]
    @user_name ||= ask "Enter your Name:  "
    @git.config('user.name', @user_name)
    @user_name
  end
end