Skip to content

Commit

Permalink
fixed relative path issue, bumped version number, added activesupport…
Browse files Browse the repository at this point in the history
… dependency, added prerequisite check that will tell user what packages to install and install gtk and sourceview
  • Loading branch information
PhilT committed Oct 28, 2010
1 parent 22d10ae commit 0475812
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/merrol.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'prerequisites'

require 'gtk2'
require 'gtksourceview2'
require 'yaml'
Expand Down
4 changes: 2 additions & 2 deletions lib/merrol/controllers/file_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def load path
model.place_cursor model.start_iter
model.signal_connect('modified_changed') do
if model.modified?
file_status_view.file = 'data/images/modified.svg'
file_status_view.file = File.app_relative('data/images/modified.svg')
else
file_status_view.file = 'data/images/saved.svg'
file_status_view.file = File.app_relative('data/images/saved.svg')
end
end
edit_view.buffer = model
Expand Down
8 changes: 8 additions & 0 deletions lib/merrol/gtk/image.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Gtk
class Image
def file= path
set_file File.app_relative(path)
end
end
end

2 changes: 1 addition & 1 deletion lib/merrol/views/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ layout:

options:
default_position: 0, 0
default_size: 150, 100
default_size: 1000, 700

54 changes: 54 additions & 0 deletions lib/prerequisites.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class LibNotFoundError < StandardError; end

def check_packages
selections = `dpkg --get-selections`
libs = %w(libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk2.0-dev libgtksourceview2.0-dev)
libs.each do |lib|
raise LibNotFoundError unless selections =~ Regexp.new(lib)
end
rescue LibNotFoundError => e
puts 'Some packages needed for installation are missing'
puts 'To install the rquired packages please run:'
puts ' sudo apt-get install libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk2.0-dev libgtksourceview2.0-dev'
puts
exit
end

def install_ruby_gnome2
trap("INT") { puts "\rAborted."; exit }

puts "Some ruby libraries need to be compiled and installed to run merrol (gtk2 and gtksourceview2)"
puts "Press ENTER to install or CTRL+C to abort"
gets

logfile = '/tmp/ruby-gnome2-install.log'

package = 'ruby-gnome2-all-0.90.4'
system "gem install pkg-config > #{logfile}"
puts 'pkg-config installed'

puts 'Downloading sources...'
system "cd /tmp && wget http://downloads.sourceforge.net/ruby-gnome2/#{package}.tar.gz >> #{logfile}"

puts 'Extracting sources...'
system "cd /tmp && tar xf #{package}.tar.gz"

puts 'Configuring ...'
system "cd /tmp/#{package} && ruby extconf.rb >> #{logfile}"

puts 'Building ...'
system "cd /tmp/#{package} && sudo make >> #{logfile}"

puts 'Installing ...'
system "cd /tmp/#{package} && sudo make install >> #{logfile}"

puts 'Done.'
end

begin
check_packages
require 'gtksourceview2'
rescue LoadError
install_ruby_gnome2
end

4 changes: 3 additions & 1 deletion merrol.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "merrol"
s.version = "0.0.0"
s.version = "0.0.1"
s.authors = "Phil Thompson"
s.email = "phil@electricvisions.com"
s.homepage = "http://merrol.com"
Expand All @@ -9,6 +9,8 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "merrol"

s.add_dependency "activesupport"

s.add_development_dependency "autotest"
s.add_development_dependency "simplecov"
s.add_development_dependency "rspec", '2.0.0'
Expand Down

0 comments on commit 0475812

Please sign in to comment.