Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom Miller
committed
May 18, 2012
0 parents
commit 9dd2fb1
Showing
6 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.bundle | ||
*.tar.bz2 | ||
df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'http://rubygems.org' | ||
gem 'mechanize' | ||
gem 'os' | ||
gem 'debugger' | ||
gem 'rake' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
columnize (0.3.6) | ||
debugger (1.1.3) | ||
columnize (>= 0.3.1) | ||
debugger-linecache (~> 1.1.1) | ||
debugger-ruby_core_source (~> 1.1.2) | ||
debugger-linecache (1.1.1) | ||
debugger-ruby_core_source (>= 1.1.1) | ||
debugger-ruby_core_source (1.1.2) | ||
domain_name (0.5.3) | ||
unf (~> 0.0.3) | ||
mechanize (2.5.1) | ||
domain_name (~> 0.5, >= 0.5.1) | ||
mime-types (~> 1.17, >= 1.17.2) | ||
net-http-digest_auth (~> 1.1, >= 1.1.1) | ||
net-http-persistent (~> 2.5, >= 2.5.2) | ||
nokogiri (~> 1.4) | ||
ntlm-http (~> 0.1, >= 0.1.1) | ||
webrobots (~> 0.0, >= 0.0.9) | ||
mime-types (1.18) | ||
net-http-digest_auth (1.2) | ||
net-http-persistent (2.6) | ||
nokogiri (1.5.2) | ||
ntlm-http (0.1.1) | ||
os (0.9.6) | ||
rake (0.9.2.2) | ||
unf (0.0.5) | ||
unf_ext | ||
unf_ext (0.0.4) | ||
webrobots (0.0.13) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
debugger | ||
mechanize | ||
os | ||
rake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
require 'rubygems' | ||
require 'bundler' | ||
Bundler.require | ||
require 'rake/clean' | ||
|
||
CLEAN.include('df', '*.tar.bz2') | ||
CLOBBER.include('df') | ||
|
||
TILESET = 'vidumec-12x12.png' | ||
COLOR_SCHEME = 'another_natural_scheme.txt' | ||
|
||
module DwarfConfig | ||
def config(settings={}) | ||
settings.each do |k,v| | ||
v = if v.class == Array | ||
v.join(':') | ||
else | ||
v.to_s.sub('true', 'yes').sub('false', 'no') | ||
end | ||
v = v.upcase unless v == TILESET | ||
sub! /^\[(#{k.to_s.upcase}):[^\]]+\]/, "[\\1:#{v}]" | ||
end | ||
end | ||
end | ||
|
||
def read_config(filename) | ||
File.read(filename).extend DwarfConfig | ||
end | ||
|
||
def write_config(filename, settings={}) | ||
puts "Configuring #{filename}" | ||
file = read_config "df/data/init/#{filename}" | ||
file.config settings | ||
File.open("df/data/init/#{filename}", 'w') do |f| | ||
f << file | ||
end | ||
end | ||
|
||
task :default => [:config, :setup] | ||
|
||
task :config => 'df' do | ||
|
||
write_config 'init.txt', { | ||
intro: false, | ||
font: TILESET | ||
} | ||
|
||
write_config 'd_init.txt', { | ||
embark_rectangle: [6, 6], | ||
coffin_no_pets_default: true, | ||
idlers: 'top', | ||
population_cap: 100, | ||
baby_child_cap: [20, 20], | ||
varied_ground_tiles: false, | ||
show_flow_ammounts: true | ||
} | ||
end | ||
|
||
task :setup => 'df' do | ||
cp "colors/#{COLOR_SCHEME}", 'df/data/init/colors.txt' | ||
cp "tilesets/#{TILESET}", "df/data/art/#{TILESET}" | ||
end | ||
|
||
file 'df' => ['df.tar.bz2'] do |t| | ||
sh "tar -xzf #{t.prerequisites.first}" | ||
mv FileList['df_{osx,linux}'].first, t.name | ||
end | ||
|
||
file 'df.tar.bz2' do | ||
url = 'http://bay12games.com/dwarves/' | ||
link_text = case | ||
when OS.mac? then 'Mac (Intel)' | ||
when OS.linux? then 'Linux' | ||
end | ||
filename = Mechanize.new.get(url).link_with(text: link_text).href | ||
sh "curl -# #{url}#{filename} -o df.tar.bz2" unless filename.empty? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[BLACK_R:0] | ||
[BLACK_G:0] | ||
[BLACK_B:0] | ||
[BLUE_R:73] | ||
[BLUE_G:95] | ||
[BLUE_B:157] | ||
[GREEN_R:89] | ||
[GREEN_G:117] | ||
[GREEN_B:55] | ||
[CYAN_R:101] | ||
[CYAN_G:144] | ||
[CYAN_B:158] | ||
[RED_R:146] | ||
[RED_G:0] | ||
[RED_B:0] | ||
[MAGENTA_R:165] | ||
[MAGENTA_G:54] | ||
[MAGENTA_B:101] | ||
[BROWN_R:138] | ||
[BROWN_G:105] | ||
[BROWN_B:59] | ||
[LGRAY_R:128] | ||
[LGRAY_G:128] | ||
[LGRAY_B:128] | ||
[DGRAY_R:80] | ||
[DGRAY_G:80] | ||
[DGRAY_B:80] | ||
[LBLUE_R:111] | ||
[LBLUE_G:138] | ||
[LBLUE_B:165] | ||
[LGREEN_R:160] | ||
[LGREEN_G:200] | ||
[LGREEN_B:82] | ||
[LCYAN_R:159] | ||
[LCYAN_G:196] | ||
[LCYAN_B:210] | ||
[LRED_R:206] | ||
[LRED_G:73] | ||
[LRED_B:1] | ||
[LMAGENTA_R:239] | ||
[LMAGENTA_G:150] | ||
[LMAGENTA_B:207] | ||
[YELLOW_R:255] | ||
[YELLOW_G:198] | ||
[YELLOW_B:0] | ||
[WHITE_R:255] | ||
[WHITE_G:255] | ||
[WHITE_B:255] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.