mirror of
https://github.com/tomgi/git_stats.git
synced 2024-12-22 13:32:17 +01:00
absolute paths building so it can be used as a gem
This commit is contained in:
parent
54301365f8
commit
015202d1e1
6 changed files with 42 additions and 8 deletions
|
@ -11,4 +11,4 @@ require 'lazy_high_charts'
|
||||||
require 'launchy'
|
require 'launchy'
|
||||||
require 'i18n'
|
require 'i18n'
|
||||||
|
|
||||||
Dir['lib/**/*.rb'].each { |r| require File.expand_path(r) }
|
require 'git_stats/base'
|
29
lib/git_stats/base.rb
Normal file
29
lib/git_stats/base.rb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
require 'git_stats/core_extensions/hash'
|
||||||
|
require 'git_stats/core_extensions/string'
|
||||||
|
require 'git_stats/core_extensions/symbol'
|
||||||
|
|
||||||
|
require 'git_stats/version'
|
||||||
|
require 'git_stats/i18n'
|
||||||
|
require 'git_stats/by_field_finder'
|
||||||
|
require 'git_stats/cli'
|
||||||
|
require 'git_stats/generator'
|
||||||
|
|
||||||
|
require 'git_stats/git_data/activity'
|
||||||
|
require 'git_stats/git_data/author'
|
||||||
|
require 'git_stats/git_data/blob'
|
||||||
|
require 'git_stats/git_data/command_parser'
|
||||||
|
require 'git_stats/git_data/command_runner'
|
||||||
|
require 'git_stats/git_data/commit'
|
||||||
|
require 'git_stats/git_data/repo'
|
||||||
|
require 'git_stats/git_data/short_stat'
|
||||||
|
|
||||||
|
require 'git_stats/stats_view/template'
|
||||||
|
require 'git_stats/stats_view/view'
|
||||||
|
require 'git_stats/stats_view/view_data'
|
||||||
|
|
||||||
|
require 'git_stats/stats_view/charts/activity_charts'
|
||||||
|
require 'git_stats/stats_view/charts/authors_charts'
|
||||||
|
require 'git_stats/stats_view/charts/chart'
|
||||||
|
require 'git_stats/stats_view/charts/charts'
|
||||||
|
require 'git_stats/stats_view/charts/repo_charts'
|
||||||
|
|
5
lib/git_stats/core_extensions/string.rb
Normal file
5
lib/git_stats/core_extensions/string.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class String
|
||||||
|
def absolute_path
|
||||||
|
Pathname.new(__FILE__).expand_path.join(self).cleanpath.to_s
|
||||||
|
end
|
||||||
|
end
|
|
@ -1 +1 @@
|
||||||
I18n.load_path += Dir['config/locales/*.yml']
|
I18n.load_path += Dir['../../../../config/locales/*.yml'.absolute_path]
|
|
@ -4,7 +4,7 @@ module GitStats
|
||||||
def initialize(name, layout=nil)
|
def initialize(name, layout=nil)
|
||||||
@name = name
|
@name = name
|
||||||
@layout = layout
|
@layout = layout
|
||||||
@template = Tilt.new("templates/#@name.haml")
|
@template = Tilt.new("../../../../templates/#@name.haml".absolute_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(data, params={})
|
def render(data, params={})
|
||||||
|
|
|
@ -3,7 +3,7 @@ module GitStats
|
||||||
class View
|
class View
|
||||||
def initialize(view_data, out_path)
|
def initialize(view_data, out_path)
|
||||||
@view_data, @out_path = view_data, out_path
|
@view_data, @out_path = view_data, out_path
|
||||||
@layout = Tilt.new("templates/layout.haml")
|
@layout = Tilt.new("../../../../templates/layout.haml".absolute_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_all
|
def render_all
|
||||||
|
@ -34,10 +34,10 @@ module GitStats
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_templates(root = '')
|
def all_templates(root = '')
|
||||||
Dir["templates/#{root}**/[^_]*.haml"].map {
|
Dir["../../../../templates/#{root}**/[^_]*.haml".absolute_path].map {
|
||||||
|f| Pathname.new(f)
|
|f| Pathname.new(f)
|
||||||
}.map { |f|
|
}.map { |f|
|
||||||
f.relative_path_from(Pathname.new('templates')).sub_ext('')
|
f.relative_path_from(Pathname.new('../../../../templates'.absolute_path)).sub_ext('')
|
||||||
}.map(&:to_s) - %w(layout)
|
}.map(&:to_s) - %w(layout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ module GitStats
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_static_content
|
def prepare_static_content
|
||||||
FileUtils.cp_r(Dir['templates/static/*'], @out_path)
|
FileUtils.cp_r(Dir["../../../../templates/static/*".absolute_path], @out_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_assets
|
def prepare_assets
|
||||||
FileUtils.cp_r('templates/assets', @out_path)
|
FileUtils.cp_r('../../../../templates/assets'.absolute_path, @out_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue