├── .gitignore ├── .gitmodules ├── Rakefile ├── README.rdoc ├── rubybuntu-gedit.gemspec └── bin └── rubybuntu-gedit /.gitignore: -------------------------------------------------------------------------------- 1 | pkg 2 | *~ 3 | *.swp 4 | *.swo 5 | *.rbc 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "data/language-specs"] 2 | path = data/language-specs 3 | url = https://github.com/janlelis/rubybuntu-language-specs 4 | [submodule "data/styles"] 5 | path = data/styles 6 | url = https://github.com/janlelis/rubybuntu-editor-styles 7 | [submodule "data/mime"] 8 | path = data/mime 9 | url = https://github.com/janlelis/rubybuntu-mime 10 | [submodule "data/snippets"] 11 | path = data/snippets 12 | url = https://github.com/janlelis/rubybuntu-gedit-snippets 13 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | GEMSPEC = 'rubybuntu-gedit.gemspec' 3 | 4 | def gemspec 5 | @gemspec ||= eval(File.read( GEMSPEC ), binding, GEMSPEC) 6 | end 7 | 8 | desc "Build the gem" 9 | task :gem => :gemspec do 10 | sh "gem build #{GEMSPEC}" 11 | FileUtils.mkdir_p 'pkg' 12 | FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg' 13 | end 14 | 15 | desc "Install the gem locally (without docs)" 16 | task :install => :gem do 17 | sh %{gem install pkg/#{gemspec.name}-#{gemspec.version} --no-rdoc --no-ri} 18 | end 19 | 20 | desc "Generate the gemspec" 21 | task :generate do 22 | puts gemspec.to_ruby 23 | end 24 | 25 | desc "Validate the gemspec" 26 | task :gemspec do 27 | gemspec.validate 28 | end 29 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = RubyBuntuGedit 2 | 3 | == Ruby/Rails/Web related gedit language definitions, mime types, styles and snippets. 4 | 5 | This is not meant to be an alternative to *gedit-plugins* or gmate[https://github.com/gmate/gmate], but an addition. It focuses on maintaining the base stuff to provide a foundation for customizing your gedit with your favourite plugins. 6 | 7 | === Contains 8 | * {language specifications}[https://github.com/janlelis/rubybuntu-language-specs] 9 | * {mime types}[https://github.com/janlelis/rubybuntu-mime] 10 | * {styles}[https://github.com/janlelis/rubybuntu-editor-styles] 11 | * {snippets}[https://github.com/janlelis/rubybuntu-gedit-snippets] 12 | 13 | Might also contain plugins someday, but only ones directly related to Ruby/Rails/Web stuff. 14 | 15 | == Setup 16 | 17 | Either checkout the sub-repositories (in the data directory) and install each one manually or run 18 | 19 | gem install rubybuntu-gedit 20 | rubybuntu-gedit install 21 | 22 | For gedit 3, replace the last line with: 23 | 24 | rubybuntu-gedit install -3 25 | 26 | Want to tweak parts of the source to your needs? Try this one in the project dir: 27 | 28 | rake install && rubybuntu-gedit install specs --sudo 29 | 30 | == J-_-L 31 | -------------------------------------------------------------------------------- /rubybuntu-gedit.gemspec: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | require 'rubygems' unless defined? Gem 3 | 4 | Gem::Specification.new do |s| 5 | s.name = "rubybuntu-gedit" 6 | s.version = Time.now.strftime("%y.%m.%d") 7 | s.authors = ["Jan Lelis", "Snippets by Christoph Olszowka", "Please see individual files for author and license"] 8 | s.email = "mail@janlelis.de" 9 | s.homepage = "https://github.com/janlelis/rubybuntu-gedit" 10 | s.summary = "Ruby/Web devoloper's gedit" 11 | s.description = "Ruby/Rails/Web related gedit language definitions, mime types, styles and snippets." 12 | 13 | s.files = Dir.glob(%w|bin/* [A-Z]*.{txt,rdoc} data/**/*|) + %w|Rakefile rubybuntu-gedit.gemspec| 14 | s.executables = Dir['bin/*'].map{|f| File.basename f } 15 | s.license = "GPL" 16 | 17 | s.add_dependency 'paint' 18 | 19 | len = s.homepage.size 20 | s.post_install_message = \ 21 | (" ┌── " + "info ".ljust(len-2,'%') + "─┐\n" + 22 | " J-_-L │ " + s.homepage + " │\n" + 23 | " ├── " + "usage ".ljust(len-2,'%') + "─┤\n" + 24 | " │ " + "rubybuntu-gedit install".ljust(len,' ') + " │\n" + 25 | " └─" + '─'*len + "─┘").gsub('%', '─') # 1.8 workaround 26 | end 27 | -------------------------------------------------------------------------------- /bin/rubybuntu-gedit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # The installer was done as fast as possible, so 3 | # TODO use dry and maintainable ruby code :D 4 | 5 | # # # 6 | # enable colors if possible 7 | begin 8 | require 'paint' 9 | rescue LoadError 10 | end 11 | 12 | unless defined? Paint 13 | module Paint 14 | def self.[](*args) 15 | args[0] 16 | end 17 | end 18 | end 19 | 20 | # # # 21 | # parse command line stuff 22 | if ARGV.shift != 'install' 23 | warn 'Currently, only "rubybuntu-gedit install" is supported. Quitting...' 24 | exit 25 | end 26 | 27 | @sudo = false # auto sudo 28 | @gedit = 3 29 | 30 | if ARGV.reject{|e| e[0] == '-' }.empty? 31 | @todo = [:specs, :mime, :styles, :snippets] 32 | ARGV.clear 33 | else 34 | @todo = [] 35 | while arg = ARGV.shift 36 | case arg 37 | when "--sudo" 38 | @sudo = true 39 | when /specs/ 40 | @todo << :specs 41 | when /mime/ 42 | @todo << :mime 43 | when /styles/ 44 | @todo << :styles 45 | when /snippets/ 46 | @todo << :snippets 47 | when "-3" 48 | @gedit = 3 49 | end 50 | end 51 | end 52 | 53 | # # # 54 | # helper methods 55 | def action(what) 56 | if what && !what.empty? 57 | puts Paint["x] #{what}", :yellow] 58 | system what 59 | end 60 | end 61 | 62 | def check_existence(what, sudo = true) 63 | if File.exists?(what) 64 | print "Q] The installer found an outdated file at \"#{what}\"\n" \ 65 | " It's recommended to remove it. Do you want to remove it? [Yn] " 66 | action("sudo rm -f #{what}") if gets.chop =~ /^y?$/i 67 | end 68 | end 69 | 70 | # # # 71 | # language specs 72 | def specs 73 | puts Paint["\nLet's start with copying the language specs\n", :underline] 74 | print "Q] Do you want to install the languages specs as sudo [/usr/share/gtksourceview-#@gedit.0/language-specs]\n" \ 75 | " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] " 76 | if @sudo || gets.chop =~ /^s?$/i 77 | action "sudo cp #@data/language-specs/*.lang /usr/share/gtksourceview-#@gedit.0/language-specs" 78 | else 79 | action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/language-specs\n" \ 80 | " cp #@data/language-specs/*.lang ~/.local/share/gtksourceview-#@gedit.0/language-specs" 81 | end 82 | 83 | check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', true 84 | check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', true 85 | check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', false 86 | check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', false 87 | end 88 | 89 | # # # 90 | # mime 91 | def mime 92 | puts Paint["\nNow the mime types should be updated\n", :underline] 93 | print "Q] Do you want to install the mime types as sudo [/usr/share/mime/packages]\n" \ 94 | " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] " 95 | if @sudo || gets.chop =~ /^s?$/i 96 | action "sudo cp #@data/mime/*.xml /usr/share/mime/packages\n" \ 97 | " sudo update-mime-database /usr/share/mime" 98 | else 99 | action "mkdir -p ~/.local/share/mime/packages\n" \ 100 | " cp #@data/mime/*.xml ~/.local/share/mime/packages\n" \ 101 | " update-mime-database ~/.local/share/mime" 102 | end 103 | 104 | check_existence '/usr/share/mime/rails.xml', true 105 | check_existence '~/.local/share/mime/rails.xml', false 106 | end 107 | 108 | # # # 109 | # styles 110 | def styles 111 | puts Paint["\nNow, some styles get copied that use the new language specs :)\n", :underline] 112 | print "Q] Do you want to install the styles as sudo [/usr/share/gtksourceview-#@gedit.0/styles]\n" \ 113 | " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/styles]? [Sh] " 114 | if @sudo || gets.chop =~ /^s?$/i 115 | action "sudo cp #@data/styles/*.xml /usr/share/gtksourceview-#@gedit.0/styles" 116 | else 117 | action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/styles\n" \ 118 | " cp #@data/styles/*.xml ~/.local/share/gtksourceview-#@gedit.0/styles" 119 | end 120 | end 121 | 122 | # # # 123 | # snippets 124 | def snippets 125 | puts Paint["\nSorry, currently, the snippets cannot installed via this installer\n", :underline] 126 | puts "...\n" 127 | end 128 | 129 | 130 | # # # 131 | # run 132 | @data = File.dirname(__FILE__) + "/../data" 133 | 134 | puts 135 | puts Paint["Welcome to the rubybuntu-gedit installer :D", :green] 136 | puts 'Before each action I\'ll tell you what I am going to do' 137 | puts Paint['Please note: ', :bold] + 'I am pretty untested and might destroy your computer' 138 | 139 | @todo.each{|todo| send todo } 140 | 141 | puts 142 | puts Paint["Congratulations! You've updated your gedit stuff! (if everything worked correctly)", :green] 143 | puts 144 | puts "If not, please install manually and open an issue on github" 145 | puts 'Don\'t forget to change your gedit style to "RubyBuntu One" to really use the new features.' 146 | puts 147 | puts " J-_-L" 148 | puts 149 | 150 | --------------------------------------------------------------------------------