ginst 0.1.3 → 0.2.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.tar.gz.sig +0 -0
- data/Manifest +34 -8
- data/Rakefile +6 -3
- data/bin/ginst +11 -4
- data/features/browsing_project.feature +20 -0
- data/features/manage_projects.feature +36 -0
- data/features/manage_server.feature +17 -0
- data/features/step_definitions/manage_projects_steps.rb +35 -0
- data/features/step_definitions/manage_server_steps.rb +33 -0
- data/features/step_definitions/webrat_steps.rb +99 -0
- data/features/support/env.rb +29 -0
- data/features/support/git.rb +22 -0
- data/features/support/paths.rb +16 -0
- data/ginst.gemspec +8 -11
- data/lib/app/authorization.rb +1 -1
- data/lib/app/views/_commit.haml +8 -0
- data/lib/app/views/commit.haml +38 -8
- data/lib/app/views/commits.haml +1 -1
- data/lib/app/views/edit.haml +11 -0
- data/lib/app/views/layout.haml +10 -7
- data/lib/app/views/new.haml +19 -0
- data/lib/app/views/project.haml +4 -1
- data/lib/app/views/ref.haml +3 -0
- data/lib/app/views/style.sass +0 -1
- data/lib/app/webserver.rb +66 -76
- data/lib/ginst.rb +7 -5
- data/lib/ginst/core_extensions.rb +32 -0
- data/lib/ginst/ginst.rb +5 -72
- data/lib/ginst/project.rb +13 -38
- data/lib/ginst/project/base.rb +59 -0
- data/lib/ginst/project/build.rb +117 -0
- data/lib/ginst/project/commit_db.rb +29 -0
- data/lib/ginst/project/finders.rb +17 -0
- data/lib/ginst/project/grit.rb +53 -0
- data/lib/ginst/project/validations.rb +60 -0
- data/lib/ginst/test.rb +8 -0
- data/lib/ginst/test/base.rb +17 -0
- data/lib/ginst/test/dir.rb +39 -0
- data/lib/ginst/test/repo.rb +13 -0
- data/lib/ginst/test/run.rb +11 -0
- data/lib/ginst/web_server.rb +43 -0
- data/spec/fixtures/sample_repo.zip +0 -0
- data/spec/models/project_base_spec.rb +56 -0
- data/spec/models/project_build_spec.rb +18 -0
- data/spec/models/project_commit_db_spec.rb +19 -0
- data/spec/models/project_finders_spec.rb +34 -0
- data/spec/models/project_grit_spec.rb +19 -0
- data/spec/models/project_validations_spec.rb +72 -0
- data/spec/spec_helper.rb +8 -0
- metadata +56 -29
- metadata.gz.sig +0 -0
- data/lib/app/views/full_commit.haml +0 -38
- data/lib/app/views/project_index.haml +0 -11
- data/lib/ginst/command_line.rb +0 -47
- data/lib/ginst/master_command_line.rb +0 -40
- data/lib/ginst/plugin.rb +0 -16
- data/lib/ginst/server.rb +0 -51
- data/lib/ginst/templates/rgithook.rb +0 -6
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,38 +0,0 @@
|
|
1
|
-
= haml :commit, :layout => false, :locals => {:commit => @commit}
|
2
|
-
- unless @commit.properties['testing']
|
3
|
-
%form{:method => 'post'}
|
4
|
-
%input{:type =>'submit', :value => 'Run hooks for this commit'}
|
5
|
-
- else
|
6
|
-
%form{:method => 'post'}
|
7
|
-
%input{:type =>'submit', :value => 'Tests are runing now', :disabled => 'disabled'}
|
8
|
-
|
9
|
-
%p.separator
|
10
|
-
Commit Info
|
11
|
-
%p.message
|
12
|
-
= format_message @commit.message
|
13
|
-
- @commit.properties.each do |key,val|
|
14
|
-
%p.separator= key.to_s
|
15
|
-
%p=val.to_s
|
16
|
-
%p.separator
|
17
|
-
Files
|
18
|
-
%p.files
|
19
|
-
%ul
|
20
|
-
-@commit.diffs.each do |diff|
|
21
|
-
- op = diff.deleted_file ? 'deleted' : (diff.new_file ? 'new' : (diff.a_path == diff.b_path ? 'update' : 'moved'))
|
22
|
-
%li{ :class => op }
|
23
|
-
= "(#{(diff.a_path == diff.b_path) ? 'igual' : 'cambio'})"
|
24
|
-
= diff.a_path || diff.b_path
|
25
|
-
%p.separator
|
26
|
-
Specs
|
27
|
-
%ul
|
28
|
-
%li
|
29
|
-
%dt Author:
|
30
|
-
%dd= @commit.author.name
|
31
|
-
%dt Commiter:
|
32
|
-
%dd= @commit.committer.name
|
33
|
-
%dt Commit Date:
|
34
|
-
%dd= @commit.date
|
35
|
-
%dt Work Date
|
36
|
-
%dd= @commit.authored_date
|
37
|
-
%dt
|
38
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
- unless @project.rgithook.installed?
|
2
|
-
.warning
|
3
|
-
RGitHook is not installed
|
4
|
-
%form{:method => 'post'}
|
5
|
-
%input{:type => 'submit', :value => 'Install'}
|
6
|
-
- else
|
7
|
-
.info
|
8
|
-
RGitHook is installed
|
9
|
-
%form{:method => 'post'}
|
10
|
-
%input{:type => 'submit', :value => 'ReInstall'}
|
11
|
-
|
data/lib/ginst/command_line.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'grit'
|
3
|
-
module Ginst
|
4
|
-
class CommandLine
|
5
|
-
def self.run
|
6
|
-
options = parse()
|
7
|
-
puts %x(#{$0} --help) unless options[:command]
|
8
|
-
exit(0) if options[:command] == :exit || !options[:command]
|
9
|
-
|
10
|
-
if [:start,:stop,:restart,:status].include? options[:command]
|
11
|
-
Server.send(options[:command],options)
|
12
|
-
Process.waitall
|
13
|
-
Server.status(options) unless options[:command] == :status
|
14
|
-
%x(open http://127.0.0.1:#{options[:port]}) if [:start, :restart].include? options[:command]
|
15
|
-
end
|
16
|
-
|
17
|
-
Ginst.install(options) if options[:command] == :install
|
18
|
-
|
19
|
-
rescue OptionParser::InvalidOption, OptionParser::AmbiguousOption
|
20
|
-
puts "Invalid options #{ARGV}"
|
21
|
-
puts %x(#{$0} --help)
|
22
|
-
rescue Grit::InvalidGitRepositoryError
|
23
|
-
puts "Invalid path #{options[:path]}. Not found a git repo"
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.parse
|
27
|
-
options = {}
|
28
|
-
OptionParser.new do |opts|
|
29
|
-
opts.banner = "Usage: #{File.basename($0)} [options]"
|
30
|
-
|
31
|
-
opts.on_head('-s','--start','Start the web server') { options[:command] = :start }
|
32
|
-
opts.on_head('-t','--stop', 'Stop the web server') { options[:command] = :stop }
|
33
|
-
opts.on_head('-r','--restart','Restart the web server') { options[:command] = :restart }
|
34
|
-
opts.on_head('-a','--status', 'Show status of the web server') { options[:command] = :status }
|
35
|
-
opts.on_head('-p','--port PORT','Webserver port') {|p| options[:port] = p.to_i }
|
36
|
-
opts.on_head('-i','--install [PATH]', 'Install ginst') {|p| options[:command] = :install ; p and options[:path] = p }
|
37
|
-
opts.on('-p', '--path GIT_WORK_DIR', 'Specify other path (default current dir)'){|p| options[:path] = p}
|
38
|
-
opts.on_tail("-h", "--help", 'Show help') { options[:command]=:exit; puts opts }
|
39
|
-
opts.on_tail("-v", "--version", 'Show version') { options[:command]=:exit; puts "Ginst version #{Ginst::Version}" }
|
40
|
-
end.parse!
|
41
|
-
|
42
|
-
options[:path] ||= Dir.pwd
|
43
|
-
options[:port] ||= 7654
|
44
|
-
options
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'ruby-debug'
|
3
|
-
module Ginst
|
4
|
-
class CommandLine
|
5
|
-
def self.run
|
6
|
-
options = parse()
|
7
|
-
puts %x(#{$0} --help) unless options[:command]
|
8
|
-
exit(0) if options[:command] == :exit || !options[:command]
|
9
|
-
|
10
|
-
if [:start,:stop,:restart,:status].include? options[:command]
|
11
|
-
Server.send(options[:command])
|
12
|
-
Process.waitall
|
13
|
-
Server.status unless options[:command] == :status
|
14
|
-
end
|
15
|
-
|
16
|
-
rescue OptionParser::InvalidOption, OptionParser::AmbiguousOption
|
17
|
-
puts "Invalid options #{ARGV}"
|
18
|
-
puts %x(#{$0} --help)
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.parse
|
22
|
-
options = {}
|
23
|
-
OptionParser.new do |opts|
|
24
|
-
opts.banner = "Usage: #{File.basename($0)} [options]"
|
25
|
-
|
26
|
-
opts.on_head('-s','--start','Start the web server') { options[:command] = :start }
|
27
|
-
opts.on_head('-t','--stop', 'Stop the web server') { options[:command] = :stop }
|
28
|
-
opts.on_head('-r','--restart','Restart the web server') { options[:command] = :restart }
|
29
|
-
opts.on_head('-a','--status', 'Show status of the web server') { options[:command] = :status }
|
30
|
-
opts.on_head('-i','--install [PATH]', 'Install ginst') {|p| options[:command] = :install ; p and options[:path] = p }
|
31
|
-
opts.on('-p', '--path GIT_WORK_DIR', 'Specify other path (default current dir)'){|p| options[:path] = p}
|
32
|
-
opts.on_tail("-h", "--help", 'Show help') { options[:command]=:exit; puts opts }
|
33
|
-
opts.on_tail("-v", "--version", 'Show version') { options[:command]=:exit; puts "Ginst version #{Ginst::Version}" }
|
34
|
-
end.parse!
|
35
|
-
|
36
|
-
options[:path] ||= Dir.pwd
|
37
|
-
options
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/lib/ginst/plugin.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
module Ginst
|
3
|
-
class GinstPlugin < ::RGitHook::Plugin
|
4
|
-
|
5
|
-
module RunnerMethods
|
6
|
-
def ginst_post_receive(old_commit,new_commit,ref)
|
7
|
-
repo.commits_between(old_commit,new_commit).each do |commit|
|
8
|
-
test(commit)
|
9
|
-
end
|
10
|
-
|
11
|
-
%x(say 'hello')
|
12
|
-
repo.commit(old_commit).properties[:gritted] = "YES"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/ginst/server.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'daemons'
|
3
|
-
|
4
|
-
module Ginst
|
5
|
-
class Server
|
6
|
-
DEFAULT_PORT = 7654
|
7
|
-
|
8
|
-
# Options are:
|
9
|
-
# :port => Web server port
|
10
|
-
# :path => Repo path
|
11
|
-
def self.start(options = {})
|
12
|
-
puts "Starting ginst for #{options[:path]} at http://localhost:#{options[:port] || DEFAULT_PORT}"
|
13
|
-
fork{run_daemon_with_env(options[:path],['start','--',sinatra_options(options)])}
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.stop(options = {})
|
17
|
-
fork{run_daemon_with_env(options[:path],['stop'])}
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.restart(options = {})
|
21
|
-
puts "Restarting ginst for #{options[:path]} at http://localhost:#{options[:port] || DEFAULT_PORT}"
|
22
|
-
run_daemon_with_env(options[:path],['restart','--',sinatra_options(options)])
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.status(options = {})
|
26
|
-
run_daemon_with_env(options[:path],['status']).show_status.to_s
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def self.run_daemon_with_env(path,env)
|
32
|
-
rgithook = ::RGitHook::RGitHook.new(path)
|
33
|
-
daemons_options = {:app_name => "ginst-#{rgithook.project_name}", :dir_mode=>:normal, :dir=>rgithook.path, :ARGV => env, :multiple => false, :log_output => true, :monitor => true, :mode => :exec}
|
34
|
-
ENV['REPO_PATH'] = path
|
35
|
-
Daemons.run(server_path(path),daemons_options)
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.sinatra_options(options)
|
39
|
-
sinatra_options = "-p #{options.delete(:port) || DEFAULT_PORT} -e production"
|
40
|
-
end
|
41
|
-
|
42
|
-
# Try to load de server of the local repo .git/ginst/webserver
|
43
|
-
# but if it does not exists, load the default
|
44
|
-
def self.server_path(path)
|
45
|
-
local_file = File.join(Grit::Repo.new(path).path,'ginst','webserver.rb')
|
46
|
-
system_file= File.expand_path(File.join(File.dirname(__FILE__),'..','app','webserver.rb'))
|
47
|
-
File.file?(local_file) ? local_file : system_file
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|