Class: Redsync
- Inherits:
-
Object
- Object
- Redsync
- Defined in:
- lib/redsync.rb,
lib/redsync/cli.rb,
lib/redsync/wiki.rb,
lib/redsync/project.rb,
lib/redsync/sync_stat.rb,
lib/redsync/wiki_page.rb,
lib/redsync/local_wiki.rb,
lib/redsync/remote_wiki.rb
Defined Under Namespace
Classes: CLI, LocalWiki, Project, RemoteWiki, SyncStat, Wiki, WikiPage
Instance Attribute Summary collapse
-
#data_dir ⇒ Object
readonly
Returns the value of attribute data_dir.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#wikis ⇒ Object
readonly
Returns the value of attribute wikis.
Instance Method Summary collapse
-
#initialize(options) ⇒ Redsync
constructor
Valid options: :url => Redmine’s base URL.
- #interactive ⇒ Object
- #status_check ⇒ Object
- #sync_all ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Redsync
Valid options:
:url => Redmine's base URL. Required.
:projects => List of target projects. Required.
:username => Redmine username. Required.
:password => Redmine password. Required.
:data_dir => Directory to read/write. Required.
:extension => Filename extensions. Defaults to "txt"
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/redsync.rb', line 29 def initialize() @projects = [:projects].map do |pj| Project.new( :url => [:url].sub(/^(.*?)\/?$/, '\1') + "/projects/#{pj}/wiki", :api_key => [:api_key], :data_dir => File.join([:data_dir], pj), :extension => [:extension] ) end @agent = Mechanize.new end |
Instance Attribute Details
#data_dir ⇒ Object (readonly)
Returns the value of attribute data_dir.
15 16 17 |
# File 'lib/redsync.rb', line 15 def data_dir @data_dir end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
15 16 17 |
# File 'lib/redsync.rb', line 15 def extension @extension end |
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
15 16 17 |
# File 'lib/redsync.rb', line 15 def projects @projects end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
15 16 17 |
# File 'lib/redsync.rb', line 15 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
15 16 17 |
# File 'lib/redsync.rb', line 15 def username @username end |
#wikis ⇒ Object (readonly)
Returns the value of attribute wikis.
15 16 17 |
# File 'lib/redsync.rb', line 15 def wikis @wikis end |
Instance Method Details
#interactive ⇒ Object
57 58 59 |
# File 'lib/redsync.rb', line 57 def interactive binding.pry end |
#status_check ⇒ Object
43 44 45 46 47 |
# File 'lib/redsync.rb', line 43 def status_check @projects.each do |pj| pj.status_check end end |
#sync_all ⇒ Object
50 51 52 53 54 |
# File 'lib/redsync.rb', line 50 def sync_all @projects.each do |pj| pj.sync end end |
#to_s ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/redsync.rb', line 62 def to_s str = "#<Redsync" str << " url = \"#{@url}\"\n" str << " username = \"#{@username}\"\n" str << " projects = \"#{@projects}\"\n" str << " data_dir = \"#{@data_dir}\"\n" str << " extension = \"#{@extension}\"\n" str << ">" end |