zayin 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/zayin.rb +0 -0
- data/lib/zayin/rake/docco.rb +46 -0
- data/lib/zayin/rake/haskell.rb +116 -0
- data/lib/zayin/rake/vagrant.rb +97 -0
- metadata +17 -13
data/lib/zayin.rb
ADDED
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/task'
|
4
|
+
|
5
|
+
module Zayin
|
6
|
+
module Rake
|
7
|
+
# Defines a Rake task for generating documentation with Docco, which must
|
8
|
+
# be on the $PATH.
|
9
|
+
def self.docco(name, src_files, *args)
|
10
|
+
args || args = []
|
11
|
+
args.insert 0, name
|
12
|
+
|
13
|
+
body = proc {
|
14
|
+
src_files.each do |src|
|
15
|
+
puts "docco #{src}"
|
16
|
+
system %{docco #{src}}
|
17
|
+
|
18
|
+
basename = File.basename(src, File.extname(src)) + '.html'
|
19
|
+
tmp = File.join('docs', basename)
|
20
|
+
|
21
|
+
parts = Pathname.new(src).each_filename.to_a
|
22
|
+
parts.shift
|
23
|
+
parts.insert 0, 'docs'
|
24
|
+
parts[-1] = basename
|
25
|
+
dest = File.join(*parts)
|
26
|
+
|
27
|
+
if tmp == dest
|
28
|
+
# If the tmp and dest are the same, then change dest's filename to
|
29
|
+
# index.html and only copy it.
|
30
|
+
dest = File.join(File.dirname(tmp), 'index.html')
|
31
|
+
FileUtils.cp(tmp, dest, :verbose => true)
|
32
|
+
else
|
33
|
+
dirname = File.dirname(dest)
|
34
|
+
FileUtils.mkdir_p(dirname)
|
35
|
+
FileUtils.mv(tmp, dest, :verbose => true)
|
36
|
+
FileUtils.cp('docs/docco.css', File.join(dirname, 'docco.css'),
|
37
|
+
:verbose => true)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
}
|
41
|
+
|
42
|
+
Rake::Task.define_task(*args, &body)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
|
5
|
+
module Zayin
|
6
|
+
module Rake
|
7
|
+
# Defines a set of Rake tasks for working with Haskell/Cabal projects.
|
8
|
+
class HaskellTasks < ::Rake::TaskLib
|
9
|
+
def initialize
|
10
|
+
yield self if block_given?
|
11
|
+
define
|
12
|
+
end
|
13
|
+
|
14
|
+
def define
|
15
|
+
namespace :hs do
|
16
|
+
# Cabal-related tasks.
|
17
|
+
desc 'Configures the project for development.'
|
18
|
+
task :config, [:target] do |t, args|
|
19
|
+
target = args[:target] || 'development'
|
20
|
+
flags = []
|
21
|
+
flags << %w{-f development --enable-tests} if target == 'development'
|
22
|
+
sh %{cabal configure #{flags.join(' ')}}
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Cleans up everything.'
|
26
|
+
task :clean do
|
27
|
+
sh %{cabal clean}
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Runs Haddock to generate documentation.'
|
31
|
+
task :docs do
|
32
|
+
sh %{cabal haddock}
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Runs tests.'
|
36
|
+
task :test => 'hs:build' do
|
37
|
+
sh %{cabal test}
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Builds the Haskell project.'
|
41
|
+
task :build, [:args] do |t, args|
|
42
|
+
params = []
|
43
|
+
params << args[:args] unless args[:args].nil?
|
44
|
+
sh %{cabal build}
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Installs the project locally.'
|
48
|
+
task :install do
|
49
|
+
sh %{cabal install}
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'Checks the project.'
|
53
|
+
task :check do
|
54
|
+
sh %{cabal check}
|
55
|
+
end
|
56
|
+
|
57
|
+
desc 'Uploads the project to Hackage.'
|
58
|
+
task :upload, [:username, :password] do |t, args|
|
59
|
+
username = args[:target]
|
60
|
+
password = args[:target]
|
61
|
+
params = []
|
62
|
+
params << "--username=#{username}" unless not username.nil?
|
63
|
+
params << "--password=#{password}" unless not password.nil?
|
64
|
+
sh %{cabal upload #{params.join(' ')}}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Other tools.
|
68
|
+
desc 'Generates the tags file.'
|
69
|
+
task :tags do
|
70
|
+
FileUtils.rm('tags', :verbose => true)
|
71
|
+
hs_tags = `find . -name '*.hs' | xargs hothasktags`
|
72
|
+
File.open('tags', 'w') { |f| f.write(hs_tags) }
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Runs hlint.'
|
76
|
+
task :lint do
|
77
|
+
sh %{hlint src}
|
78
|
+
end
|
79
|
+
|
80
|
+
desc 'Strips out the extra comments and fluff from the binary.'
|
81
|
+
task :strip, [:target] do |t, args|
|
82
|
+
target = args[:target]
|
83
|
+
raise 'You must specify a target.' if target.nil?
|
84
|
+
sh %{strip -p --strip-unneeded --remove-section=.comment -o #{target} ./dist/build/#{target}/#{target}}
|
85
|
+
end
|
86
|
+
|
87
|
+
namespace :hpc do
|
88
|
+
desc 'This builds the executable with -fhpc.'
|
89
|
+
task :build => ['hs:clean', 'hs:config'] do
|
90
|
+
Rake::Task['hs:build'].invoke('--ghc-option=-fhpc')
|
91
|
+
end
|
92
|
+
|
93
|
+
desc 'This runs the hpc report.'
|
94
|
+
task :report, [:tix, :modules] do |t, args|
|
95
|
+
target = args[:tix]
|
96
|
+
modules = args[:modules]
|
97
|
+
raise 'TIX file must be supplied.' if target.nil?
|
98
|
+
raise 'Modules must be supplied.' if modules.nil?
|
99
|
+
sh %{hpc report #{target} #{modules}}
|
100
|
+
end
|
101
|
+
|
102
|
+
desc 'This runs hpc markup.'
|
103
|
+
task :markup, [:tix, :modules] do |t, args|
|
104
|
+
target = args[:tix]
|
105
|
+
modules = args[:modules]
|
106
|
+
raise 'TIX file must be supplied.' if target.nil?
|
107
|
+
raise 'Modules must be supplied.' if modules.nil?
|
108
|
+
sh %{hpc markup #{target} #{modules}}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
require 'vagrant'
|
5
|
+
|
6
|
+
module Zayin
|
7
|
+
module Rake
|
8
|
+
# Defines a set of Rake tasks for working with Vagrant VMs.
|
9
|
+
class VagrantTasks < ::Rake::TaskLib
|
10
|
+
def initialize
|
11
|
+
yield self if block_given?
|
12
|
+
@env ||= Vagrant::Environment.new
|
13
|
+
define
|
14
|
+
end
|
15
|
+
|
16
|
+
def vm_ssh(cmd)
|
17
|
+
puts ">>> #{cmd}"
|
18
|
+
@env.primary_vm.ssh.execute do |ssh|
|
19
|
+
ssh.exec!(cmd) do |channel, stream, data|
|
20
|
+
print data
|
21
|
+
$stdout.flush
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def define
|
27
|
+
namespace :vagrant do
|
28
|
+
desc 'vagrant up'
|
29
|
+
task :up do
|
30
|
+
puts 'vagrant up'
|
31
|
+
@env.cli('up')
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'vagrant suspend'
|
35
|
+
task :suspend do
|
36
|
+
puts 'vagrant suspend'
|
37
|
+
@env.cli('suspend')
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Halts the VM.'
|
41
|
+
task :halt do
|
42
|
+
puts 'sudo halt'
|
43
|
+
vm_ssh('sudo halt')
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'vagrant destroy'
|
47
|
+
task :destroy do
|
48
|
+
if @env.primary_vm.created?
|
49
|
+
puts 'vagrant destroy'
|
50
|
+
@env.cli('destroy')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
desc 'vagrant status'
|
55
|
+
task :status do
|
56
|
+
puts 'vagrant status'
|
57
|
+
@env.cli('status')
|
58
|
+
end
|
59
|
+
|
60
|
+
namespace :chef do
|
61
|
+
desc 'Dumps out the stacktrace from a Chef error.'
|
62
|
+
task :st do
|
63
|
+
raise "Must run `vagrant up`" unless @env.primary_vm.created?
|
64
|
+
raise "Must be running!" unless @env.primary_vm.vm.running?
|
65
|
+
puts "Getting chef stacktrace."
|
66
|
+
vm_ssh("cat /tmp/vagrant-chef-1/chef-stacktrace.out")
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'Cleans up the cookbooks.'
|
70
|
+
task :clean do
|
71
|
+
FileUtils.rmtree('cookbooks', :verbose => true)
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Clones the cookbooks given from git. URL is required. Cookbook directory and branch are optional.'
|
75
|
+
task :cookbook, [:git_url, :cookbook_dir, :branch] do |t, args|
|
76
|
+
url = args[:git_url]
|
77
|
+
cb_dir = args[:cookbook_dir]
|
78
|
+
branch = args[:branch]
|
79
|
+
raise 'You must specify a URL to clone.' unless url.nil?
|
80
|
+
|
81
|
+
basedir = File.dirname(cb_dir)
|
82
|
+
Dir.mkdir(basedir) if basedir != '.' && !File.directory?(basedir)
|
83
|
+
|
84
|
+
params = []
|
85
|
+
params << "--branch=#{branch}" unless branch.nil?
|
86
|
+
params << url
|
87
|
+
params << cb_dir unless cb_dir.nil?
|
88
|
+
|
89
|
+
sh %{git clone #{params.join(' ')}}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zayin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152885820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.8'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152885820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152884820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152884820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152900060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152900060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2152899140 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.6.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152899140
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rcov
|
60
|
-
requirement: &
|
60
|
+
requirement: &2152898520 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152898520
|
69
69
|
description: A collection of Ruby utilities and Rake tasks.
|
70
70
|
email: erochest@gmail.com
|
71
71
|
executables: []
|
@@ -74,6 +74,10 @@ extra_rdoc_files:
|
|
74
74
|
- LICENSE.txt
|
75
75
|
- README.md
|
76
76
|
files:
|
77
|
+
- lib/zayin.rb
|
78
|
+
- lib/zayin/rake/docco.rb
|
79
|
+
- lib/zayin/rake/haskell.rb
|
80
|
+
- lib/zayin/rake/vagrant.rb
|
77
81
|
- LICENSE.txt
|
78
82
|
- README.md
|
79
83
|
homepage: http://github.com/erochest/zayin
|
@@ -91,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
95
|
version: '0'
|
92
96
|
segments:
|
93
97
|
- 0
|
94
|
-
hash: -
|
98
|
+
hash: -690619307997794117
|
95
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
100
|
none: false
|
97
101
|
requirements:
|