keithsalisbury-subtrac 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 13
4
+ :patch: 14
@@ -0,0 +1,13 @@
1
+ module Subtrac
2
+ module Commands
3
+ class Create
4
+ def initialize(args, options)
5
+ options.project = ask("What is the name of the project you would like to create? ") if !options.project
6
+ options.client = ask("Which client is this project for? ") if !options.client
7
+ # this needs to load the updated configuration?
8
+ Subtrac.load_config()
9
+ Subtrac.create_project(options.project,options.client)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module Subtrac
2
+ module Commands
3
+ class Install
4
+ def initialize(args, options)
5
+ Subtrac.load_config()
6
+ Subtrac.install(args,options)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ module Subtrac
2
+ module Commands
3
+ autoload :Install, "subtrac/commands/install"
4
+ autoload :Create, "subtrac/commands/create"
5
+ end
6
+ end
@@ -1,9 +1,6 @@
1
1
  development: &non_production_settings
2
2
  # Things that can be changed
3
- :admin:
4
- :username: "admin"
5
- :password: "6kvCHrTLk3ubo" # passw0rd
6
-
3
+ :admin_user: "admin"
7
4
  :server_name: "Subtrac Development Server"
8
5
  :server_hostname: "dev.subtrac.com"
9
6
  :server_ip: "192.168.2.1"
@@ -35,8 +32,6 @@ development: &non_production_settings
35
32
  admins: TRAC_ADMIN
36
33
  clients: WIKI_VIEW TICKET_CREATE TICKET_APPEND
37
34
  developers: BROWSER_VIEW LOG_VIEW FILE_VIEW CHANGESET_VIEW TICKET_VIEW TICKET_CREATE TICKET_APPEND MILESTONE_VIEW MILESTONE_CREATE MILESTONE_MODIFY ROADMAP_VIEW REPORT_VIEW REPORT_SQL_VIEW`BROWSER_VIEW LOG_VIEW FILE_VIEW CHANGESET_VIEW TICKET_VIEW TICKET_CREATE TICKET_APPEND MILESTONE_VIEW MILESTONE_CREATE MILESTONE_MODIFY ROADMAP_VIEW REPORT_VIEW REPORT_SQL_VIEW
38
- admins: admin
39
- salisburyk: admin
40
35
  client: clients
41
36
 
42
37
  # Internal config
@@ -1 +1,3 @@
1
- admin:6kvCHrTLk3ubo
1
+ admin:2UPs2u5oj2mIc
2
+ admin:2UPs2u5oj2mIc
3
+ keith:aaLYeLlpy5Tu6
@@ -13,13 +13,16 @@
13
13
  <location />
14
14
  AuthType Basic
15
15
  AuthName '<%= @server_name %>'
16
- AuthUserFile <%= @install_dir %>/passwords
17
- #Require valid-user
16
+ AuthUserFile <%= @install_dir %>/.passwd
17
+ Require valid-user
18
+ AuthBasicProvider file
19
+ <% if @ldap_enable then %>
18
20
  #AuthBasicProvider file ldap
19
21
  #AuthLDAPBindDN '<%= @ldap_bind_dn %>'
20
22
  #AuthLDAPBindPassword '<%= @ldap_bind_password %>'
21
23
  #AuthLDAPURL '<%= @ldap_url %>'
22
24
  #AuthzLDAPAuthoritative off
25
+ <% end %>
23
26
  </location>
24
27
 
25
28
  <location <%= @APP_CONFIG[:urls][:svn] %>>
data/lib/subtrac.rb CHANGED
@@ -39,6 +39,8 @@ require 'yaml'
39
39
  require 'erb'
40
40
  require 'fileutils'
41
41
  require 'subtrac/version'
42
+ require 'subtrac/commands'
43
+
42
44
 
43
45
  module Subtrac
44
46
 
@@ -131,24 +133,6 @@ module Subtrac
131
133
 
132
134
  end
133
135
 
134
- module Commands
135
- class Install
136
- def initialize(args, options)
137
- Subtrac.load_config()
138
- Subtrac.install(args,options)
139
- end
140
- end
141
- class Create
142
- def initialize(args, options)
143
- options.project = ask("What is the name of the project you would like to create? ") if !options.project
144
- options.client = ask("Which client is this project for? ") if !options.client
145
- # this needs to load the updated configuration?
146
- Subtrac.load_config()
147
- Subtrac.create_project(options.project,options.client)
148
- end
149
- end
150
- end
151
-
152
136
  # Loads the configuration YML file
153
137
  def self.load_config
154
138
  # TODO: We need to refactor this code so it will load the default configuration only if one has not been created
@@ -185,9 +169,12 @@ module Subtrac
185
169
  @install_dir = File.expand_path(@APP_CONFIG[:installation_dir])
186
170
  @conf_dir = @APP_CONFIG[:apache2_conf]
187
171
 
188
- @ldap_bind_dn = @APP_CONFIG[:ldap][:bind_dn]
189
- @ldap_bind_password = @APP_CONFIG[:ldap][:bind_password]
190
- @ldap_url = @APP_CONFIG[:ldap][:host]
172
+ @ldap_enable = @APP_CONFIG[:ldap][:enable]
173
+ if (@ldap_enable) then
174
+ @ldap_bind_dn = @APP_CONFIG[:ldap][:bind_dn]
175
+ @ldap_bind_password = @APP_CONFIG[:ldap][:bind_password]
176
+ @ldap_url = @APP_CONFIG[:ldap][:host]
177
+ end
191
178
 
192
179
  end
193
180
 
@@ -201,7 +188,8 @@ module Subtrac
201
188
 
202
189
  unless !File.directory?(@install_dir)
203
190
  # Ask if the user agrees (yes or no)
204
- confirm_clean = agree("Err, that directory's got stuff init. You sure you want me to overwrite? [Y/n]") if options.clean
191
+ confirm_clean = agree("Err, it seems there's some stuff in there. You sure you want me to overwrite? [Y/n]") if options.clean
192
+ confirm_clean = agree("Doubly sure? I can't undo this....[Y/n]") if confirm_clean
205
193
  end
206
194
 
207
195
  # right lets install
@@ -210,6 +198,7 @@ module Subtrac
210
198
 
211
199
  create_environment_directories(confirm_clean)
212
200
  install_common_files()
201
+ configure_admin_user()
213
202
  # TODO: Need to check for default client/project before creating virtual host
214
203
  # otherwise we need remove the rewrite rule
215
204
  create_virtual_host()
@@ -292,6 +281,20 @@ module Subtrac
292
281
  # TODO: refactor /common to the app config
293
282
  FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "common/.")),docs_dir)
294
283
  FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "shared/.")),create_if_missing(File.join(trac_dir, ".shared")))
284
+ # this need to be replaced with a question/answer session
285
+ #FileUtils.cp(,@install_dir)
286
+ end
287
+
288
+ def self.configure_admin_user
289
+ puts "\n==== Configure admin user ===="
290
+ # create admin user
291
+ passwd_file = File.join(@install_dir, ".passwd")
292
+ admin_user = ask("Pick an admin username: ") { |q| q.echo = true }
293
+ `htpasswd -c #{passwd_file} #{admin_user}`
294
+ @APP_CONFIG[:admin_user] = admin_user
295
+ # ensure this guy is added to trac admin group
296
+ @APP_CONFIG[:trac][:permissions][admin_user] = "admins"
297
+ #FileUtils.chown_R('www-data', 'www-data', passwd_file, :verbose => true) if SUBTRAC_ENV != 'test'
295
298
  end
296
299
 
297
300
  def self.create_environment_directories(overwrite=false)
@@ -393,11 +396,11 @@ module Subtrac
393
396
  say("Setting up default trac permissions...")
394
397
  # set up trac permissions
395
398
  @APP_CONFIG[:trac][:permissions].each do |key, value|
396
- `trac-admin #{project_trac_dir} permission add #{key} #{value}` if SUBTRAC_ENV != 'test'
399
+ `sudo trac-admin #{project_trac_dir} permission add #{key} #{value}` if SUBTRAC_ENV != 'test'
397
400
  end
398
401
 
399
402
  say("Adding default trac wiki pages...")
400
- # this needs to loop through the directory and import all pages
403
+ # loop through the directory and import all pages
401
404
  Dir.foreach("#{project_template}/trac/wiki/.") do |file|
402
405
  # do something with the file here
403
406
  unless ['.', '..','.svn'].include? file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keithsalisbury-subtrac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Salisbury
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-19 00:00:00 -07:00
12
+ date: 2009-04-20 00:00:00 -07:00
13
13
  default_executable: subtrac
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -38,6 +38,9 @@ files:
38
38
  - VERSION.yml
39
39
  - bin/subtrac
40
40
  - lib/subtrac.rb
41
+ - lib/subtrac/commands.rb
42
+ - lib/subtrac/commands/create.rb
43
+ - lib/subtrac/commands/install.rb
41
44
  - lib/subtrac/common/clients/index.wsgi
42
45
  - lib/subtrac/common/favicon.ico
43
46
  - lib/subtrac/common/images/trac/banner_bg.jpg