Module: Subtrac
- Defined in:
- lib/subtrac.rb,
lib/subtrac/svn.rb,
lib/subtrac/trac.rb,
lib/subtrac/apache.rb,
lib/subtrac/client.rb,
lib/subtrac/config.rb,
lib/subtrac/project.rb,
lib/subtrac/version.rb,
lib/subtrac/commands.rb,
lib/subtrac/template.rb,
lib/subtrac/commands/create.rb,
lib/subtrac/commands/delete.rb,
lib/subtrac/commands/install.rb,
lib/subtrac/commands/create_template.rb
Defined Under Namespace
Modules: Commands Classes: Apache, Client, Config, Project, Svn, Template, Trac
Constant Summary collapse
- SUBTRAC_ROOT =
"#{File.dirname(__FILE__)}/"- SUBTRAC_ENV =
(ENV['SUBTRAC_ENV'] || 'development').dup
- VERSION =
'0.1.40'
Class Method Summary collapse
- .create_project(project, client, template = nil) ⇒ Object
- .delete_project(project, client) ⇒ Object
-
.install(args, options) ⇒ Object
Install.
-
.load_config ⇒ Object
Loads the configuration YML file.
Class Method Details
.create_project(project, client, template = nil) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/subtrac.rb', line 164 def create_project(project,client,template=nil) load_config() project = ask("What is the name of the project you would like to create? ") if project.nil? client = ask("Which client is this project for? ") if client.nil? use_custom_template = agree("Would you like to use a custom template for this project? [y/n]") if template.nil? if use_custom_template then list_of_templates = Dir.entries(File.join(Config.svn_dir,"templates")) # The new and improved choose()... #choices = %{#{list_of_templates}} # %w{ruby python perl} say("\nThis is the new mode (default)...") choose do || .prompt = "Which template would you like to use for this project? " list_of_templates.each do |t| unless File.directory?(t) .choice t do template = t end end end end else template = "blank" end # create default project project = Project.new(project,client,template) # get these out for binding...we'll tidy up later #client = project.client Config.project = project Config.client = project.client # create the svn repo svn = Svn.new svn.create_project(project) # create the trac site trac = Trac.new trac.create_project(project) # create the apache configuration apache = Apache.new apache.create_project(project) project.clear_temp() # fix privileges give_apache_privileges() end |
.delete_project(project, client) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/subtrac.rb', line 120 def delete_project(project,client) load_config() if client # test the client exists client_exists = Dir.exist?(File.join(Config.svn_dir,client)) end unless client or client_exists list_of_clients = Dir.entries(Config.svn_dir) choose do || .prompt = "Which client contains the project you would like to delete? " list_of_clients.each do |t| unless File.directory?(t) .choice t do client = t end end end end end if project # test the project exists project_exists = Dir.exist?(File.join(Config.svn_dir,client,project)) end unless project or project_exists list_of_projects = Dir.entries(File.join(Config.svn_dir,client)) choose do || .prompt = "Which client contains the project you would like to delete? " list_of_projects.each do |t| unless File.directory?(t) .choice t do project = t end end end end end # remove the folder puts "Dir.delete(" + File.join(Config.svn_dir,client,project) + ")" end |
.install(args, options) ⇒ Object
Install
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/subtrac.rb', line 56 def install(args,) load_config() puts "\n==== Installing development server files ====" if .defaults then overwrite = .clean confirm_default_client = true else # check where we are installing Config.confirm_or_update(:install_dir,"install_dir") unless !File.directory?(Config.install_dir) # Ask if the user agrees (yes or no) confirm_clean = agree("Err, it seems there's some stuff in there. You sure you want me to overwrite? [Y/n]") if .clean overwrite = agree("Doubly sure? I can't undo this....[Y/n]") if confirm_clean end # confirm server Config.confirm_or_update(:server_name,"server_name") # ask for hostname Config.confirm_or_update(:server_hostname,"server_hostname") # default client/project name Config.confirm_or_update(:default_client,"default_client") Config.confirm_or_update(:default_project,"default_project") end say("Ok we're about to install now, these are the options you have chosen: installation directory: #{Config.install_dir} overwrite: #{overwrite} server name: #{Config.server_name} server hostname: #{Config.server_hostname} default client: #{Config.default_client} default project: #{Config.default_project}") confirm = agree("Is this ok? [y/n]") exit 0 if !confirm create_environment_directories(overwrite) #create a new virtual host apache = Apache.new apache.create_virtual_host() # create the trac site trac = Trac.new trac.install_common_files() install_common_files() configure_admin_user() # create default project create_project(Config.default_project,Config.default_client,"blank") # store any user preferences for later use Config.save() end |