Class: Milkode::Updater
- Inherits:
-
Object
show all
- Defined in:
- lib/milkode/database/updater.rb
Defined Under Namespace
Classes: Result, ResultAccumulator
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(grndb, package_name) ⇒ Updater
Returns a new instance of Updater.
17
18
19
20
21
22
23
24
25
|
# File 'lib/milkode/database/updater.rb', line 17
def initialize(grndb, package_name)
@grndb = grndb
@package_name = package_name
@package = @grndb.packages[@package_name]
@result = Result.new
@current_ignore = IgnoreChecker.new
@options = {}
@out = $stdout
end
|
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
15
16
17
|
# File 'lib/milkode/database/updater.rb', line 15
def result
@result
end
|
Instance Method Details
#enable_display_info ⇒ Object
77
78
79
|
# File 'lib/milkode/database/updater.rb', line 77
def enable_display_info
@options[:display_info] = true
end
|
#enable_no_auto_ignore ⇒ Object
69
70
71
|
# File 'lib/milkode/database/updater.rb', line 69
def enable_no_auto_ignore
@options[:no_auto_ignore] = true
end
|
#enable_no_clean ⇒ Object
97
98
99
|
# File 'lib/milkode/database/updater.rb', line 97
def enable_no_clean
@options[:no_clean] = true
end
|
#enable_silent_mode ⇒ Object
73
74
75
|
# File 'lib/milkode/database/updater.rb', line 73
def enable_silent_mode
@options[:silent_mode] = true
end
|
89
90
91
|
# File 'lib/milkode/database/updater.rb', line 89
def enable_update_with_ctags
@options[:update_with_ctags] = true
end
|
93
94
95
|
# File 'lib/milkode/database/updater.rb', line 93
def enable_update_with_ctags_e
@options[:update_with_ctags_e] = true
end
|
#enable_update_with_git_pull ⇒ Object
81
82
83
|
# File 'lib/milkode/database/updater.rb', line 81
def enable_update_with_git_pull
@options[:update_with_git_pull] = true
end
|
#enable_update_with_svn_update ⇒ Object
85
86
87
|
# File 'lib/milkode/database/updater.rb', line 85
def enable_update_with_svn_update
@options[:update_with_svn_update] = true
end
|
#exec ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/milkode/database/updater.rb', line 27
def exec
if @options[:update_with_git_pull]
Dir.chdir(@package.directory) { system("git pull") }
end
if @options[:update_with_svn_update]
Dir.chdir(@package.directory) { system("svn update") }
end
if @options[:global_gitignore]
add_global_gitignore(@options[:global_gitignore])
end
update_dir(@package.directory)
unless @options[:no_clean]
@grndb.documents.cleanup_package_name(@package_name, @current_ignore)
end
if @options[:update_with_ctags]
Dir.chdir(@package.directory) { system("ctags -R") }
end
if @options[:update_with_ctags_e]
Dir.chdir(@package.directory) { system("ctags -R -e") }
end
@grndb.packages.touch(@package_name, :updatetime)
end
|
#set_global_gitignore(filename) ⇒ Object
101
102
103
|
# File 'lib/milkode/database/updater.rb', line 101
def set_global_gitignore(filename)
@options[:global_gitignore] = filename
end
|
#set_package_ignore(ignore_setting) ⇒ Object
65
66
67
|
# File 'lib/milkode/database/updater.rb', line 65
def set_package_ignore(ignore_setting)
@current_ignore.add ignore_setting
end
|