Class: Giticious::Setup
- Inherits:
-
Object
- Object
- Giticious::Setup
- Defined in:
- lib/giticious/setup.rb
Class Method Summary collapse
Class Method Details
.create_config_dir ⇒ Object
31 32 33 34 35 |
# File 'lib/giticious/setup.rb', line 31 def self.create_config_dir config_dir = "#{Dir.home}/.giticious" FileUtils.mkdir(config_dir) unless Dir.exists?(config_dir) end |
.create_repo_dir ⇒ Object
37 38 39 40 41 |
# File 'lib/giticious/setup.rb', line 37 def self.create_repo_dir repo_dir = "#{Dir.home}/repositories" FileUtils.mkdir(repo_dir) unless Dir.exists?(repo_dir) end |
.migrate_db ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/giticious/setup.rb', line 11 def self.migrate_db ActiveRecord::Schema.define do create_table :repositories do |table| table.column :name, :string, :unique => true table.column :path, :string end create_table :users do |table| table.column :username, :string, :unique => true end create_table :permissions do |table| table.column :user_id, :integer table.column :repository_id, :integer table.column :perm_read, :boolean table.column :perm_write, :boolean end end end |
.run ⇒ Object
4 5 6 7 8 |
# File 'lib/giticious/setup.rb', line 4 def self.run self.create_config_dir self.create_repo_dir self.migrate_db end |