rkh-monk 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/README.markdown +70 -0
- data/Rakefile +11 -0
- data/bin/monk +13 -0
- data/lib/monk.rb +142 -0
- data/monk.gemspec +19 -0
- data/test/commands.rb +72 -0
- data/test/integration_test.rb +112 -0
- data/test/monk_test.rb +135 -0
- metadata +84 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2008 Michel Martens and Damian Janowski
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
Monk
|
2
|
+
====
|
3
|
+
|
4
|
+
The glue framework for web development.
|
5
|
+
|
6
|
+
Description
|
7
|
+
-----------
|
8
|
+
|
9
|
+
Monk is a glue framework for web development. It means that instead of
|
10
|
+
installing all the tools you need for your projects, you can rely on a
|
11
|
+
git repository and a list of dependencies, and Monk takes care of the
|
12
|
+
rest. By default, it ships with a Sinatra application that includes
|
13
|
+
Contest, Stories, Webrat, Ohm and some other niceties, along with a
|
14
|
+
structure and helpful documentation to get your hands wet in no time.
|
15
|
+
|
16
|
+
But Monk also respects your tastes, and you are invited to create your
|
17
|
+
own versions of the skeleton app and your own list of dependencies. You
|
18
|
+
can add many different templates (different git repositories) and Monk
|
19
|
+
will help you manage them all.
|
20
|
+
|
21
|
+
Usage
|
22
|
+
-----
|
23
|
+
|
24
|
+
Install the monk gem and create your project:
|
25
|
+
|
26
|
+
$ sudo gem install monk
|
27
|
+
$ monk init myapp
|
28
|
+
$ cd myapp
|
29
|
+
$ rake
|
30
|
+
|
31
|
+
If the tests pass, it means that you can start hacking right away. If
|
32
|
+
they don't, just follow the instructions. As the default skeleton
|
33
|
+
is very opinionated, you will probably need to install and run
|
34
|
+
[Redis](http://code.google.com/p/redis/), a key-value database.
|
35
|
+
|
36
|
+
Check the `dependencies` file in the root of your project to see what
|
37
|
+
else is there. Monk works with git almost exclusively, but your project
|
38
|
+
can also depend on gems. Check the dependencies file to see what options
|
39
|
+
you have, and run the `dep` command line tool to verify it.
|
40
|
+
|
41
|
+
Installation
|
42
|
+
------------
|
43
|
+
|
44
|
+
$ sudo gem install monk
|
45
|
+
|
46
|
+
License
|
47
|
+
-------
|
48
|
+
|
49
|
+
Copyright (c) 2009 Michel Martens and Damian Janowski
|
50
|
+
|
51
|
+
Permission is hereby granted, free of charge, to any person
|
52
|
+
obtaining a copy of this software and associated documentation
|
53
|
+
files (the "Software"), to deal in the Software without
|
54
|
+
restriction, including without limitation the rights to use,
|
55
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
56
|
+
copies of the Software, and to permit persons to whom the
|
57
|
+
Software is furnished to do so, subject to the following
|
58
|
+
conditions:
|
59
|
+
|
60
|
+
The above copyright notice and this permission notice shall be
|
61
|
+
included in all copies or substantial portions of the Software.
|
62
|
+
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
64
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
65
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
66
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
67
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
68
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
69
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
70
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/monk
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#! /usr/bin/env ruby -rubygems
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "monk")
|
4
|
+
|
5
|
+
# A way to extend Monk is to write tasks in a Thorfile in the project's root directory.
|
6
|
+
# Monk loads the Thorfile if there is one, and all the tasks that are declared in the
|
7
|
+
# class Monk become available.
|
8
|
+
if File.exists?("Thorfile")
|
9
|
+
load("Thorfile")
|
10
|
+
end
|
11
|
+
|
12
|
+
# Start the monk tasks.
|
13
|
+
Monk.start
|
data/lib/monk.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "yaml"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
class Monk < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
# options every git aware task takes
|
14
|
+
def git_options
|
15
|
+
method_option :branch, :type => :string, :alias => "-b"
|
16
|
+
method_option :keep_remote, :type => :boolean
|
17
|
+
method_option :remote_name, :type => :string
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "init", "Initialize a Monk application"
|
23
|
+
method_option :skeleton, :type => :string, :aliases => "-s"
|
24
|
+
git_options
|
25
|
+
def init(target = ".")
|
26
|
+
clone(source(options[:skeleton] || "default"), target) ?
|
27
|
+
cleanup(target) :
|
28
|
+
say_status(:error, clone_error(target))
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "show NAME", "Display the repository address for NAME"
|
32
|
+
def show(name)
|
33
|
+
if monk_config.include? name
|
34
|
+
say_status name, *source(name).values_at(:url, :branch)
|
35
|
+
else
|
36
|
+
say_status name, "repository not found"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "list", "Lists the configured repositories"
|
41
|
+
def list
|
42
|
+
monk_config.keys.sort.each do |key|
|
43
|
+
show(key)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "add NAME REPOSITORY_URL", "Add the repository to the configuration file"
|
48
|
+
git_options
|
49
|
+
def add(name, repository_url)
|
50
|
+
monk_config[name] = { :url => repository_url }
|
51
|
+
monk_config[name].merge! options
|
52
|
+
write_monk_config_file
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "change NAME", "Modifies options for a repository without having to repeat the url."
|
56
|
+
git_options
|
57
|
+
def change(name)
|
58
|
+
if monk_config.include? name
|
59
|
+
monk_config[name].merge! options
|
60
|
+
write_monk_config_file
|
61
|
+
else
|
62
|
+
say_status name, "repository not found"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "rm NAME", "Remove the repository from the configuration file"
|
67
|
+
def rm(name)
|
68
|
+
monk_config.delete(name)
|
69
|
+
write_monk_config_file
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "copy FROM TO", "Creates a copy of an existing skeleton."
|
73
|
+
git_options
|
74
|
+
def copy(from, to)
|
75
|
+
return unless monk_config.include? from
|
76
|
+
monk_config[to] = monk_config[from].merge options
|
77
|
+
write_monk_config_file
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def clone(src, target)
|
83
|
+
if Dir["#{target}/*"].empty?
|
84
|
+
FileUtils.mkdir_p target
|
85
|
+
Dir.chdir(target) do
|
86
|
+
say_status :fetching, src[:url]
|
87
|
+
branch = src[:branch] || "master"
|
88
|
+
remote = src[:remote_name] || "skeleton"
|
89
|
+
system <<-EOS
|
90
|
+
git init &&
|
91
|
+
git remote add -t #{branch} -f #{remote} #{src[:url]} &&
|
92
|
+
git checkout -t #{remote}/#{branch}
|
93
|
+
EOS
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def cleanup(target)
|
99
|
+
inside(target) { remove_file ".git" } unless options.keep_remote?
|
100
|
+
say_status :initialized, target
|
101
|
+
end
|
102
|
+
|
103
|
+
def source(name)
|
104
|
+
monk_config[name]
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def monk_config_file
|
109
|
+
@monk_config_file ||= File.join(monk_home, ".monk")
|
110
|
+
end
|
111
|
+
|
112
|
+
def monk_config
|
113
|
+
@monk_config ||= begin
|
114
|
+
write_monk_config_file unless File.exists? monk_config_file
|
115
|
+
YAML.load_file(monk_config_file).inject({}) do |config, (key, value)|
|
116
|
+
# fixing old monk config files
|
117
|
+
config.merge key => value.respond_to?(:keys) ? value : {:url => value}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def write_monk_config_file
|
123
|
+
remove_file monk_config_file
|
124
|
+
create_file monk_config_file do
|
125
|
+
config = @monk_config || { "default" => {:url => "git://github.com/monkrb/skeleton.git"} }
|
126
|
+
config.to_yaml
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.source_root
|
131
|
+
"."
|
132
|
+
end
|
133
|
+
|
134
|
+
def clone_error(target)
|
135
|
+
"Couldn't clone repository into target directory '#{target}'. " +
|
136
|
+
"You must have git installed and the target directory must be empty."
|
137
|
+
end
|
138
|
+
|
139
|
+
def monk_home
|
140
|
+
ENV["MONK_HOME"] || File.join(Thor::Util.user_home)
|
141
|
+
end
|
142
|
+
end
|
data/monk.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "monk"
|
3
|
+
s.version = "0.0.5"
|
4
|
+
s.summary = "Monk, the glue framework"
|
5
|
+
s.description = "Monk is a glue framework for web development. It means that instead of installing all the tools you need for your projects, you can rely on a git repository and a list of dependencies, and Monk will care of the rest. By default, it ships with a Sinatra application that includes Contest, Stories, Webrat, Ohm and some other niceties, along with a structure and helpful documentation to get your hands wet in no time."
|
6
|
+
s.authors = ["Damian Janowski", "Michel Martens"]
|
7
|
+
s.email = ["djanowski@dimaion.com", "michel@soveran.com"]
|
8
|
+
s.homepage = "http://monkrb.com"
|
9
|
+
|
10
|
+
s.rubyforge_project = "monk"
|
11
|
+
|
12
|
+
s.executables << "monk"
|
13
|
+
|
14
|
+
s.add_dependency("thor", "~> 0.11")
|
15
|
+
s.add_dependency("dependencies", ">= 0.0.6")
|
16
|
+
s.requirements << "git"
|
17
|
+
|
18
|
+
s.files = ["LICENSE", "README.markdown", "Rakefile", "bin/monk", "lib/monk.rb", "monk.gemspec", "test/commands.rb", "test/integration_test.rb", "test/monk_test.rb"]
|
19
|
+
end
|
data/test/commands.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require "open3"
|
2
|
+
require "socket"
|
3
|
+
|
4
|
+
module Test::Commands
|
5
|
+
def sh(cmd)
|
6
|
+
out, err = nil
|
7
|
+
|
8
|
+
Open3.popen3(cmd) do |_in, _out, _err|
|
9
|
+
out = _out.read
|
10
|
+
err = _err.read
|
11
|
+
end
|
12
|
+
|
13
|
+
[out, err]
|
14
|
+
end
|
15
|
+
|
16
|
+
# Runs a command in the background, silencing all output.
|
17
|
+
# For debugging purposes, set the environment variable VERBOSE.
|
18
|
+
def sh_bg(cmd)
|
19
|
+
if ENV["VERBOSE"]
|
20
|
+
streams_to_silence = []
|
21
|
+
else
|
22
|
+
streams_to_silence = [$stdout, $stderr]
|
23
|
+
cmd = "#{cmd} 2>&1>/dev/null"
|
24
|
+
end
|
25
|
+
|
26
|
+
silence_stream(*streams_to_silence) do
|
27
|
+
(pid = fork) ? Process.detach(pid) : exec(cmd)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def listening?(host, port)
|
32
|
+
begin
|
33
|
+
socket = TCPSocket.new(host, port)
|
34
|
+
socket.close unless socket.nil?
|
35
|
+
true
|
36
|
+
rescue Errno::ECONNREFUSED,
|
37
|
+
Errno::EBADF, # Windows
|
38
|
+
Errno::EADDRNOTAVAIL # Windows
|
39
|
+
false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def wait_for_service(host, port, timeout = 3)
|
44
|
+
start_time = Time.now
|
45
|
+
|
46
|
+
until listening?(host, port)
|
47
|
+
if timeout && (Time.now > (start_time + timeout))
|
48
|
+
raise SocketError.new("Socket #{host}:#{port} did not open within #{timeout} seconds")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
def suspects(port)
|
56
|
+
list = sh("lsof -i :#{port}").first.split("\n")[1..-1] || []
|
57
|
+
list.map {|s| s[/^.+? (\d+)/, 1] }
|
58
|
+
end
|
59
|
+
|
60
|
+
def silence_stream(*streams) #:yeild:
|
61
|
+
on_hold = streams.collect{ |stream| stream.dup }
|
62
|
+
streams.each do |stream|
|
63
|
+
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
64
|
+
stream.sync = true
|
65
|
+
end
|
66
|
+
yield
|
67
|
+
ensure
|
68
|
+
streams.each_with_index do |stream, i|
|
69
|
+
stream.reopen(on_hold[i])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
2
|
+
|
3
|
+
class TestMonk < Test::Unit::TestCase
|
4
|
+
context "monk init NAME" do
|
5
|
+
setup do
|
6
|
+
@ports_to_close = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def assert_url(url)
|
10
|
+
assert_match /200 OK/, sh("curl -I 0.0.0.0:4567#{url}").first.split("\n").first
|
11
|
+
end
|
12
|
+
|
13
|
+
def try_server(cmd, port)
|
14
|
+
binary = cmd[/^(.+?)( |$)/, 1]
|
15
|
+
|
16
|
+
flunk "Can't find `#{binary}`." unless system("which #{binary} > /dev/null")
|
17
|
+
|
18
|
+
kill_suspects(port)
|
19
|
+
sh_bg(cmd)
|
20
|
+
|
21
|
+
# Mark the port for closing on teardown, just in case the build fails.
|
22
|
+
@ports_to_close << port if wait_for_service("0.0.0.0", port)
|
23
|
+
|
24
|
+
doc = Hpricot(sh("curl 0.0.0.0:#{port}").first)
|
25
|
+
|
26
|
+
assert_match /Hello, world/, doc.at("body").inner_text
|
27
|
+
|
28
|
+
# Make sure all referenced URLs in the layout respond correctly.
|
29
|
+
doc.search("//*[@href]").each do |node|
|
30
|
+
assert_url node.attributes["href"]
|
31
|
+
end
|
32
|
+
|
33
|
+
doc.search("//*[@src]").each do |node|
|
34
|
+
assert_url node.attributes["src"]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
should "create a skeleton app with all tests passing" do
|
39
|
+
flunk "There is another server running on 0.0.0.0:4567. Suspect PIDs: #{suspects(4567).join(", ")}" if listening?("0.0.0.0", 4567)
|
40
|
+
flunk "There is another server running on 0.0.0.0:9292. Suspect PIDs: #{suspects(9292).join(", ")}" if listening?("0.0.0.0", 9292)
|
41
|
+
|
42
|
+
Dir.chdir(root("test", "tmp")) do
|
43
|
+
FileUtils.rm_rf("monk-test")
|
44
|
+
|
45
|
+
out, err = monk("init monk-test")
|
46
|
+
assert_match /initialized.* monk-test/, out
|
47
|
+
|
48
|
+
Dir.chdir("monk-test") do
|
49
|
+
assert !File.directory?(".git")
|
50
|
+
|
51
|
+
FileUtils.cp("config/settings.example.yml", "config/settings.yml")
|
52
|
+
FileUtils.cp("config/redis/development.example.conf", "config/redis/development.conf")
|
53
|
+
FileUtils.cp("config/redis/test.example.conf", "config/redis/test.conf")
|
54
|
+
|
55
|
+
# Load Redis.
|
56
|
+
sh "redis-server config/redis/test.conf"
|
57
|
+
wait_for_service("0.0.0.0", 6380)
|
58
|
+
|
59
|
+
sh "redis-server config/redis/development.conf"
|
60
|
+
wait_for_service("0.0.0.0", 6379)
|
61
|
+
|
62
|
+
assert system("rake >/dev/null"), "the build didn't pass"
|
63
|
+
assert system("rake1.9 >/dev/null"), "the build didn't pass (1.9)"
|
64
|
+
|
65
|
+
try_server "ruby init.rb", 4567
|
66
|
+
try_reloading
|
67
|
+
try_server "rackup", 9292
|
68
|
+
|
69
|
+
try_server "ruby1.9 init.rb", 4567
|
70
|
+
try_reloading
|
71
|
+
try_server "rackup1.9", 9292
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def try_reloading
|
77
|
+
gsub_file("app/routes/home.rb", "haml :home", "'Goodbye'") do
|
78
|
+
sleep 0.2
|
79
|
+
assert_match /Goodbye/, sh("curl 0.0.0.0:4567").first
|
80
|
+
end
|
81
|
+
|
82
|
+
gsub_file("init.rb", "Main.run!", %Q(Main.get "/test" { 'test' }\n Main.run!)) do
|
83
|
+
sleep 0.2
|
84
|
+
assert_match /test/, sh("curl 0.0.0.0:4567/test").first
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def gsub_file(file, *args)
|
89
|
+
old = File.read(file)
|
90
|
+
|
91
|
+
begin
|
92
|
+
new = old.gsub(*args)
|
93
|
+
File.open(file, "w") {|f| f.write(new) }
|
94
|
+
yield
|
95
|
+
ensure
|
96
|
+
File.open(file, "w") {|f| f.write(old) }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def kill_suspects(port)
|
101
|
+
list = suspects(port)
|
102
|
+
|
103
|
+
sh "kill -9 #{list.join(" ")}" unless list.empty?
|
104
|
+
end
|
105
|
+
|
106
|
+
teardown do
|
107
|
+
@ports_to_close.each do |port|
|
108
|
+
kill_suspects port
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
data/test/monk_test.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
2
|
+
|
3
|
+
class TestMonk < Test::Unit::TestCase
|
4
|
+
context "monk init NAME" do
|
5
|
+
should "fail if the target working directory is not empty" do
|
6
|
+
Dir.chdir(root("test", "tmp")) do
|
7
|
+
FileUtils.rm_rf("monk-test")
|
8
|
+
FileUtils.mkdir("monk-test")
|
9
|
+
|
10
|
+
Dir.chdir("monk-test") do
|
11
|
+
FileUtils.touch("foobar")
|
12
|
+
end
|
13
|
+
|
14
|
+
out, err = monk("init monk-test")
|
15
|
+
assert_match /error/, out
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
should "create a skeleton app in the target directory" do
|
20
|
+
Dir.chdir(root("test", "tmp")) do
|
21
|
+
FileUtils.rm_rf("monk-test")
|
22
|
+
|
23
|
+
out, err = monk("init monk-test")
|
24
|
+
assert_match /initialized.* monk-test/, out
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "monk init" do
|
30
|
+
should "fail if the current working directory is not empty" do
|
31
|
+
Dir.chdir(root("test", "tmp")) do
|
32
|
+
FileUtils.rm_rf("monk-test")
|
33
|
+
FileUtils.mkdir("monk-test")
|
34
|
+
|
35
|
+
|
36
|
+
Dir.chdir("monk-test") do
|
37
|
+
FileUtils.touch("foobar")
|
38
|
+
out, err = monk("init")
|
39
|
+
assert_match /error/, out
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
should "create a skeleton app in the working directory" do
|
45
|
+
Dir.chdir(root("test", "tmp")) do
|
46
|
+
FileUtils.rm_rf("monk-test")
|
47
|
+
FileUtils.mkdir("monk-test")
|
48
|
+
|
49
|
+
Dir.chdir("monk-test") do
|
50
|
+
out, err = monk("init")
|
51
|
+
assert_match /initialized/, out
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
should "use an alternative skeleton if the option is provided" do
|
57
|
+
Dir.chdir(root("test", "tmp")) do
|
58
|
+
FileUtils.rm_rf("monk-test")
|
59
|
+
FileUtils.mkdir("monk-test")
|
60
|
+
|
61
|
+
monk("add foobar git://github.com/monkrb/skeleton.git")
|
62
|
+
|
63
|
+
Dir.chdir("monk-test") do
|
64
|
+
out, err = monk("init -s foobar")
|
65
|
+
assert_match /initialized/, out
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "monk show NAME" do
|
72
|
+
should "display the repository for NAME" do
|
73
|
+
out, err = monk("show default")
|
74
|
+
assert out["git://github.com/monkrb/skeleton.git"]
|
75
|
+
end
|
76
|
+
|
77
|
+
should "display nothing if NAME is not set" do
|
78
|
+
out, err = monk("show foobar")
|
79
|
+
assert out["repository not found"]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "monk list" do
|
84
|
+
should "display the configured repositories" do
|
85
|
+
out, err = monk("list")
|
86
|
+
assert out["default"]
|
87
|
+
assert out["git://github.com/monkrb/skeleton.git"]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context "monk add NAME REPOSITORY" do
|
92
|
+
should "add the named repository to the configuration" do
|
93
|
+
monk("add foobar git://github.com/monkrb/foo.git")
|
94
|
+
out, err = monk("show foobar")
|
95
|
+
assert out["foobar"]
|
96
|
+
assert out["git://github.com/monkrb/foo.git"]
|
97
|
+
monk("rm foobar")
|
98
|
+
end
|
99
|
+
|
100
|
+
should "allow to fetch from the added repository when using the skeleton parameter" do
|
101
|
+
monk("add glue git://github.com/monkrb/glue.git")
|
102
|
+
|
103
|
+
Dir.chdir(root("test", "tmp")) do
|
104
|
+
FileUtils.rm_rf("monk-test")
|
105
|
+
FileUtils.mkdir("monk-test")
|
106
|
+
|
107
|
+
out, err = monk("init monk-test --skeleton glue")
|
108
|
+
assert_match /initialized/, out
|
109
|
+
assert_match /glue.git/, out
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
should "allow to fetch from the added repository when using the s parameter" do
|
114
|
+
monk("add glue git://github.com/monkrb/glue.git")
|
115
|
+
|
116
|
+
Dir.chdir(root("test", "tmp")) do
|
117
|
+
FileUtils.rm_rf("monk-test")
|
118
|
+
FileUtils.mkdir("monk-test")
|
119
|
+
|
120
|
+
out, err = monk("init monk-test -s glue")
|
121
|
+
assert_match /initialized/, out
|
122
|
+
assert_match /glue.git/, out
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "monk rm NAME" do
|
128
|
+
should "remove the named repository from the configuration" do
|
129
|
+
monk("add foobar git://github.com/monkrb/foo.git")
|
130
|
+
monk("rm foobar")
|
131
|
+
out, err = monk("show foobar")
|
132
|
+
assert out["repository not found"]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rkh-monk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Damian Janowski
|
8
|
+
- Michel Martens
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-16 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: thor
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0.11"
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: dependencies
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.0.6
|
35
|
+
version:
|
36
|
+
description: Monk is a glue framework for web development. It means that instead of installing all the tools you need for your projects, you can rely on a git repository and a list of dependencies, and Monk will care of the rest. By default, it ships with a Sinatra application that includes Contest, Stories, Webrat, Ohm and some other niceties, along with a structure and helpful documentation to get your hands wet in no time.
|
37
|
+
email:
|
38
|
+
- djanowski@dimaion.com
|
39
|
+
- michel@soveran.com
|
40
|
+
executables:
|
41
|
+
- monk
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- LICENSE
|
48
|
+
- README.markdown
|
49
|
+
- Rakefile
|
50
|
+
- bin/monk
|
51
|
+
- lib/monk.rb
|
52
|
+
- monk.gemspec
|
53
|
+
- test/commands.rb
|
54
|
+
- test/integration_test.rb
|
55
|
+
- test/monk_test.rb
|
56
|
+
has_rdoc: false
|
57
|
+
homepage: http://monkrb.com
|
58
|
+
licenses:
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
requirements:
|
77
|
+
- git
|
78
|
+
rubyforge_project: monk
|
79
|
+
rubygems_version: 1.3.5
|
80
|
+
signing_key:
|
81
|
+
specification_version: 2
|
82
|
+
summary: Monk, the glue framework
|
83
|
+
test_files: []
|
84
|
+
|