Top Level Namespace
Defined Under Namespace
Modules: Behaviors, Bloggit
Classes: Action, FixedHoe, Hash, Json, Main, String
Constant Summary
collapse
- SVN =
ENV['SCM'] || 'svk'
- VERBOSE =
true
- PLUGIN_BOILERPLATE =
"# = Examples for creating your own plugins...\n\ninclude Bloggit\n\n# = Registering the plugin to retrieve settings from settings.yml\nPlugin.register :example do |settings|\n # this will read from the settings.yml under plugins.example\n # $username = settings.fetch('username', '')\nend\n\n\n# = Registering custom tags in the template engine\n#\n# This will register the tag `example` for use in any template page \n# (including layouts). Example usage of this tag:\n#\n# <%= example :version %>\n#\n# Output:\n#\n# Bloggit 1.0.0\n#\nTemplate.register_tag :example do |*args|\n kind, opts = args\n opts ||= {}\n\n case kind\n when :version\n \"Bloggit \"+ Bloggit::RELEASE_INFO\n else\n \"Unknown tag \"+ kind\n end\n \nend\n\n# = Responding to application events...\nBloggit::on_event(:after_generate) do |site, cache_dir|\n # puts \"I'm called after the rest of the site has been generated...\"\nend\n\n# = Adding a command line tool...\nCmdline.register do |cmd, site|\n example_cmd = CmdParse::Command.new( 'example', true, true )\n example_cmd.short_desc = \"Example tool from plugin\"\n cmd.add_command( example_cmd )\n\n sub_cmd = CmdParse::Command.new( 'sub', false )\n sub_cmd.short_desc = \"A sub command\"\n sub_cmd.set_execution_block do |args|\n puts \"Sub-command has been called, w00t!\"\n end\n\n example_cmd.add_command( sub_cmd )\nend\n\n# = Registering a custom text format:\nbegin\n require 'rdoc/markup/simple_markup'\n require 'rdoc/markup/simple_markup/to_html'\n\n Bloggit::TextFormatter.register :rdoc do |text|\n p = SM::SimpleMarkup.new\n h = SM::ToHtml.new\n p.convert(text, h)\n end\n\nrescue LoadError\n puts \"There was an error registering the :rdoc text format:\"+ $!\nend\n"
- NOISE_WORDS =
%w(about after all also an and another any are as at be because been before
being between both but by came can come could did do each for from get
got has had he have her here him himself his how if in into is it like
make many me might more most much must my never now of on only or other
our out over said same see should since some still such take than that
the their them then there these they this those through to too under up
very was way we well were what where which while who with would you your a
b c d e f g h i j k l m n o p q r s t u v w x y z $ 1 2 3 4 5 6 7 8 9 0 _)
Instance Method Summary
collapse
Instance Method Details
#add(dir) ⇒ Object
29
30
31
|
# File 'lib/bloggit/tasks/scm.rb', line 29
def add(dir)
sh %(#{SVN} add #{dir})
end
|
#project_name ⇒ Object
42
43
44
|
# File 'lib/bloggit/tasks/scm.rb', line 42
def project_name
File.basename(File.expand_path(RAILS_ROOT))
end
|
#propset(prop, value, *targets) ⇒ Object
25
26
27
|
# File 'lib/bloggit/tasks/scm.rb', line 25
def propset(prop, value, *targets)
sh %(#{SVN} propset #{prop} "#{value}" #{targets.join(' ')})
end
|
#remove(file) ⇒ Object
33
34
35
36
|
# File 'lib/bloggit/tasks/scm.rb', line 33
def remove(file)
sh %(#{SVN} revert #{file})
sh %(#{SVN} delete #{file})
end
|
#scm_processor(mode, no_targets_msg = "Nothing to do") ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/bloggit/tasks/scm.rb', line 46
def scm_processor(mode, no_targets_msg="Nothing to do")
raise "Requires mode :add or :remove" if mode.nil? or ![:add,:remove].include?(mode)
re = (mode == :add) ? [ /^\?/, /^\?\s*/ ] : [ /^\!/, /^\!\s*/ ]
files = stat.select{ |e| re[0] =~ e}.collect{|e| e.sub(re[1], '').chomp }
puts
if files.length == 0
puts no_targets_msg
else
files.map {|f| puts " #{f}"}
print "\n#{mode.to_s.capitalize} all of these? (y/n/i) : "
affected_files = 0
if STDIN.gets =~ /^(y|i)/i
case $1.downcase
when 'y'
(mode == :add) ? add(files.join(' ')) : files.map { |f| remove(f) }
affected_files = files.length
when 'i'
puts "\n[Interactive Mode]\n"
files.each do |file|
print "#{mode.to_s.capitalize} '#{file}'? (y/n) : "
if /^y/i =~ STDIN.gets
(mode == :add) ? add(file) : remove(file)
affected_files += 1
else
puts "Ignored"
end
end
end
end
puts "\n#{affected_files} file(s) affected, #{files.length - affected_files} ignored"
end
puts
end
|
#stat ⇒ Object
38
39
40
|
# File 'lib/bloggit/tasks/scm.rb', line 38
def stat
`#{SVN} stat`
end
|