Class: Boards::NewProject
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Boards::NewProject
- Includes:
- Thor::Actions
- Defined in:
- lib/boards/new_project.rb
Instance Method Summary collapse
- #create_boards_rb ⇒ Object
- #create_directory ⇒ Object
- #create_gemfile ⇒ Object
- #create_setup_rb ⇒ Object
Instance Method Details
#create_boards_rb ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/boards/new_project.rb', line 31 def create_boards_rb dir_name = name.downcase file_name = 'boards.rb' unless File.exists?("#{dir_name}/#{file_name}") File.open("#{dir_name}/#{file_name}", "w") do |f| f.write "# Define the setup of your different boards here.\n" f.write "# For more information on the DSL that can be put in this file got to <boards wiki uri>.\n" f.write "# TODO: Define DSL.\n" f.write "# TODO: Update boards wiki.\n" end say "create \t#{dir_name}/#{file_name}", :green else say "file \t#{dir_name}/#{file_name} already exists", :blue end end |
#create_directory ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/boards/new_project.rb', line 8 def create_directory dir_name = name.downcase unless Dir.exists?(dir_name) Dir.mkdir(dir_name) say "create \t#{dir_name}/", :green else say "dir \t#{dir_name}/ already exists", :blue end end |
#create_gemfile ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/boards/new_project.rb', line 47 def create_gemfile dir_name = name.downcase file_name = 'Gemfile' unless File.exists?("#{dir_name}/#{file_name}") File.open("#{dir_name}/#{file_name}", "w") do |f| f.write "source 'https://rubygems.org'\n" f.write 'git_source(:github) { |repo| "https://github.com/#{repo}.git" }' f.write "\n\n" f.write "# Bundle edge Boards instead:\n" f.write "# gem 'boards', github: '#{REPO}'\n" f.write "gem 'boards', '#{VERSION}'" end say "create \t#{dir_name}/#{file_name}", :green else say "file \t#{dir_name}/#{file_name} already exists", :blue end end |
#create_setup_rb ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/boards/new_project.rb', line 18 def create_setup_rb dir_name = name.downcase file_name = 'setup.rb' unless File.exists?("#{dir_name}/#{file_name}") File.open("#{dir_name}/#{file_name}", "w") do |f| f.write "# I am a setup file." end say "create \t#{dir_name}/#{file_name}", :green else say "file \t#{dir_name}/#{file_name} already exists", :blue end end |