forked from featurist/pogoscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
59 lines (51 loc) · 1.54 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require 'rubygems'
require 'erb'
require 'fileutils'
require 'rake/testtask'
require 'json'
desc "Build pogo-script-source gem"
task :gem do
require 'rubygems'
require 'rubygems/package'
gemspec = Gem::Specification.new do |s|
s.name = 'pogo-script-source'
s.version = JSON.parse(File.read('package.json'))["version"]
s.date = Time.now.strftime("%Y-%m-%d")
s.homepage = "http://pogoscript.org/"
s.summary = "The PogoScript Compiler"
s.description = <<-EOS
PogoScript is a programming language that emphasises readability, is
friendly to domain specific languages and compiles to regular Javascript.
EOS
s.files = [
'lib/pogo_script/pogo-script.js',
'lib/pogo_script/source.rb'
]
s.authors = ['Tim Macfarlane']
s.email = '[email protected]'
s.rubyforge_project = 'pogo-script-source'
s.license = "MIT"
end
file = File.open("pogo-script-source.gem", "w")
Gem::Package.open(file, 'w') do |pkg|
pkg.metadata = gemspec.to_yaml
path = "lib/pogo_script/source.rb"
contents = <<-ERUBY
module PogoScript
module Source
def self.bundled_path
File.expand_path("../pogo-script.js", __FILE__)
end
end
end
ERUBY
pkg.add_file_simple(path, 0644, contents.size) do |tar_io|
tar_io.write(contents)
end
contents = File.read("html/pogo.js")
path = "lib/pogo_script/pogo-script.js"
pkg.add_file_simple(path, 0644, contents.size) do |tar_io|
tar_io.write(contents)
end
end
end