cijoe_passenger 0.1.0
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/.bundle/config +2 -0
- data/.gitignore +4 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +20 -0
- data/README.rdoc +31 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/cijoep +25 -0
- data/cijoe_passenger.gemspec +82 -0
- data/lib/cijoe_passenger.rb +21 -0
- data/lib/cijoe_passenger/add.rb +63 -0
- data/lib/cijoe_passenger/apps/base.rb +7 -0
- data/lib/cijoe_passenger/cijoe.rb +5 -0
- data/lib/cijoe_passenger/git.rb +46 -0
- data/lib/cijoe_passenger/install.rb +15 -0
- data/lib/cijoe_passenger/project.rb +33 -0
- data/lib/cijoe_passenger/scan.rb +9 -0
- data/spec/cijoe_passenger/add_spec.rb +29 -0
- data/spec/cijoe_passenger/git_spec.rb +39 -0
- data/spec/cijoe_passenger/install_spec.rb +13 -0
- data/spec/cijoe_passenger/project_spec.rb +69 -0
- data/spec/cijoe_passenger/scan_spec.rb +14 -0
- data/spec/spec_helper.rb +6 -0
- data/templates/config.ru +8 -0
- data/templates/config/cijoe_passenger.conf.tt +8 -0
- data/templates/config/config.yml.tt +1 -0
- data/templates/log/access_log +0 -0
- data/templates/log/error_log +0 -0
- data/templates/public/index.html +1 -0
- metadata +114 -0
data/.bundle/config
ADDED
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@cijoep
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
choice (0.1.4)
|
5
|
+
cijoe (0.7.0)
|
6
|
+
choice
|
7
|
+
sinatra
|
8
|
+
diff-lcs (1.1.2)
|
9
|
+
rack (1.2.1)
|
10
|
+
rspec (2.0.1)
|
11
|
+
rspec-core (~> 2.0.1)
|
12
|
+
rspec-expectations (~> 2.0.1)
|
13
|
+
rspec-mocks (~> 2.0.1)
|
14
|
+
rspec-core (2.0.1)
|
15
|
+
rspec-expectations (2.0.1)
|
16
|
+
diff-lcs (>= 1.1.2)
|
17
|
+
rspec-mocks (2.0.1)
|
18
|
+
rspec-core (~> 2.0.1)
|
19
|
+
rspec-expectations (~> 2.0.1)
|
20
|
+
sinatra (1.1.0)
|
21
|
+
rack (~> 1.1)
|
22
|
+
tilt (~> 1.1)
|
23
|
+
thor (0.14.3)
|
24
|
+
tilt (1.1)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
cijoe
|
31
|
+
rspec
|
32
|
+
thor
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Justin Marney & Tony Pitale
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= cijoe_passenger
|
2
|
+
|
3
|
+
Generates a CIJoe passenger instance with projects that automatically build.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
Use passenger wrapper.
|
8
|
+
|
9
|
+
Create a directory to serve as your cijoe root
|
10
|
+
mkdir cijoep
|
11
|
+
|
12
|
+
Give install the url you want to server cijoe from
|
13
|
+
cd cijoep
|
14
|
+
cijoep install cijoe.local
|
15
|
+
|
16
|
+
Add a project
|
17
|
+
cijoep add git@github.com:vigetlabs/cijoe_passenger.git
|
18
|
+
|
19
|
+
== Note on Patches/Pull Requests
|
20
|
+
|
21
|
+
* Fork the project.
|
22
|
+
* Make your feature addition or bug fix.
|
23
|
+
* Add tests for it. This is important so I don't break it in a
|
24
|
+
future version unintentionally.
|
25
|
+
* Commit, do not mess with rakefile, version, or history.
|
26
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
27
|
+
* Send me a pull request. Bonus points for topic branches.
|
28
|
+
|
29
|
+
== Copyright
|
30
|
+
|
31
|
+
Copyright (c) 2010 Justin Marney & Tony Pitale. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "cijoe_passenger"
|
8
|
+
gem.summary = %Q{Makes CIJoe awesomer.}
|
9
|
+
gem.description = %Q{Generates a CIJoe passenger instance with projects that automatically build.}
|
10
|
+
gem.email = "gotascii@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/vigetlabs/cijoe_passenger"
|
12
|
+
gem.authors = ["Justin Marney", "Tony Pitale"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 0"
|
14
|
+
gem.files << 'templates/log/*' << 'templates/tmp/restart.txt'
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
24
|
+
# spec.libs << 'lib' << 'spec'
|
25
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
29
|
+
# spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
spec.rcov_opts = ['--exclude', 'lib\/spec,bin\/spec,config\/boot.rb,gems,spec_helper']
|
33
|
+
end
|
34
|
+
|
35
|
+
task :rcovo => [:rcov] do
|
36
|
+
system "open coverage/index.html"
|
37
|
+
end
|
38
|
+
|
39
|
+
task :test => :check_dependencies
|
40
|
+
|
41
|
+
task :default => :spec
|
42
|
+
|
43
|
+
require 'rake/rdoctask'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "cijoe_passenger #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/cijoep
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'cijoe_passenger'
|
4
|
+
|
5
|
+
ARGV << '--help' if ARGV.empty?
|
6
|
+
|
7
|
+
command = ARGV.shift
|
8
|
+
|
9
|
+
case command
|
10
|
+
when '-h', '--help'
|
11
|
+
puts <<-EOT
|
12
|
+
Usage: cijoep COMMAND [ARGS]
|
13
|
+
|
14
|
+
Commands:
|
15
|
+
install URL Install cijoe_passenger into current directory and configure for URL
|
16
|
+
add NAME|REPO_URL [REPO_URL] Adds app to current cijoe_passenger directory using repo at REPO_URL
|
17
|
+
scan Scans apps for updates and sends necessary build requests to cijoe
|
18
|
+
runner NAME COMMAND Sets the runner COMMAND for cijoe_passenger instance NAME
|
19
|
+
EOT
|
20
|
+
when 'runner'
|
21
|
+
add = CIJoePassenger::Add.new([ARGV.shift, 'repo'])
|
22
|
+
add.configure_cijoe_runner(ARGV.shift)
|
23
|
+
else
|
24
|
+
CIJoePassenger.const_get(command.capitalize.to_sym).start(ARGV)
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cijoe_passenger}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Justin Marney", "Tony Pitale"]
|
12
|
+
s.date = %q{2010-10-28}
|
13
|
+
s.default_executable = %q{cijoep}
|
14
|
+
s.description = %q{Generates a CIJoe passenger instance with projects that automatically build.}
|
15
|
+
s.email = %q{gotascii@gmail.com}
|
16
|
+
s.executables = ["cijoep"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".bundle/config",
|
23
|
+
".gitignore",
|
24
|
+
".rvmrc",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE",
|
28
|
+
"README.rdoc",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"bin/cijoep",
|
32
|
+
"cijoe_passenger.gemspec",
|
33
|
+
"lib/cijoe_passenger.rb",
|
34
|
+
"lib/cijoe_passenger/add.rb",
|
35
|
+
"lib/cijoe_passenger/apps/base.rb",
|
36
|
+
"lib/cijoe_passenger/cijoe.rb",
|
37
|
+
"lib/cijoe_passenger/git.rb",
|
38
|
+
"lib/cijoe_passenger/install.rb",
|
39
|
+
"lib/cijoe_passenger/project.rb",
|
40
|
+
"lib/cijoe_passenger/scan.rb",
|
41
|
+
"spec/cijoe_passenger/add_spec.rb",
|
42
|
+
"spec/cijoe_passenger/git_spec.rb",
|
43
|
+
"spec/cijoe_passenger/install_spec.rb",
|
44
|
+
"spec/cijoe_passenger/project_spec.rb",
|
45
|
+
"spec/cijoe_passenger/scan_spec.rb",
|
46
|
+
"spec/spec_helper.rb",
|
47
|
+
"templates/config.ru",
|
48
|
+
"templates/config/cijoe_passenger.conf.tt",
|
49
|
+
"templates/config/config.yml.tt",
|
50
|
+
"templates/log/access_log",
|
51
|
+
"templates/log/error_log",
|
52
|
+
"templates/public/index.html",
|
53
|
+
"templates/tmp/restart.txt"
|
54
|
+
]
|
55
|
+
s.homepage = %q{http://github.com/vigetlabs/cijoe_passenger}
|
56
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
57
|
+
s.require_paths = ["lib"]
|
58
|
+
s.rubygems_version = %q{1.3.7}
|
59
|
+
s.summary = %q{Makes CIJoe awesomer.}
|
60
|
+
s.test_files = [
|
61
|
+
"spec/cijoe_passenger/add_spec.rb",
|
62
|
+
"spec/cijoe_passenger/git_spec.rb",
|
63
|
+
"spec/cijoe_passenger/install_spec.rb",
|
64
|
+
"spec/cijoe_passenger/project_spec.rb",
|
65
|
+
"spec/cijoe_passenger/scan_spec.rb",
|
66
|
+
"spec/spec_helper.rb"
|
67
|
+
]
|
68
|
+
|
69
|
+
if s.respond_to? :specification_version then
|
70
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
71
|
+
s.specification_version = 3
|
72
|
+
|
73
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
75
|
+
else
|
76
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
77
|
+
end
|
78
|
+
else
|
79
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'thor/group'
|
5
|
+
require 'net/http'
|
6
|
+
require 'uri'
|
7
|
+
require 'ostruct'
|
8
|
+
require 'yaml'
|
9
|
+
require 'cijoe_passenger/git'
|
10
|
+
require 'cijoe_passenger/project'
|
11
|
+
require 'cijoe_passenger/scan'
|
12
|
+
require 'cijoe_passenger/add'
|
13
|
+
require 'cijoe_passenger/install'
|
14
|
+
|
15
|
+
module CIJoePassenger
|
16
|
+
CONFIG_DEFAULT = {:runner => 'rake cruise'}
|
17
|
+
config_path = File.join('config', 'config.yml')
|
18
|
+
config_yml = File.exist?(config_path) ? YAML.load_file(config_path) : {}
|
19
|
+
config = CONFIG_DEFAULT.merge(config_yml)
|
20
|
+
Config = OpenStruct.new(config)
|
21
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module CIJoePassenger
|
2
|
+
class Add < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
attr_reader :git
|
5
|
+
namespace :add
|
6
|
+
argument :name, :type => :string, :desc => "The project name or repo if no name given"
|
7
|
+
argument :repo, :type => :string, :desc => "The git repo address if name differs from repo name", :default => ''
|
8
|
+
argument :campfire, :type => :hash, :desc => "A hash of campfire options", :default => {}
|
9
|
+
|
10
|
+
def initialize(args=[], options={}, config={})
|
11
|
+
super
|
12
|
+
if @repo == ''
|
13
|
+
@repo = @name
|
14
|
+
@name = @repo.slice(/\/(.*).git$/, 1)
|
15
|
+
end
|
16
|
+
@git = Git.new([name])
|
17
|
+
end
|
18
|
+
|
19
|
+
def clone
|
20
|
+
git.clone(repo)
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_app_to_rack
|
24
|
+
append_file 'config.ru' do
|
25
|
+
<<-CONFIG
|
26
|
+
\n\nmap "/#{name}" do
|
27
|
+
work_path = File.join(Dir.pwd, '#{name}')
|
28
|
+
module CIJoePassenger
|
29
|
+
module Apps
|
30
|
+
class #{name.capitalize} < Base; end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
CIJoePassenger::Apps::#{name.capitalize}.configure do |config|
|
34
|
+
config.set :project_path, work_path
|
35
|
+
config.set :show_exceptions, true
|
36
|
+
config.set :lock, true
|
37
|
+
end
|
38
|
+
run CIJoePassenger::Apps::#{name.capitalize}
|
39
|
+
end
|
40
|
+
CONFIG
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def configure_cijoe_runner(runner = nil)
|
45
|
+
runner ||= ::CIJoePassenger::Config.runner
|
46
|
+
git.add_config_to_repo("cijoe.runner", runner)
|
47
|
+
end
|
48
|
+
|
49
|
+
def configure_campfire
|
50
|
+
campfire.each do |k, v|
|
51
|
+
@git.add_config_to_repo("campfire.#{k}", v)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def restart
|
56
|
+
run "touch tmp/restart.txt"
|
57
|
+
end
|
58
|
+
|
59
|
+
def remind
|
60
|
+
puts "\n\n*** Don't forget to setup #{name}/config/database.yml and/or bundle install ***"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module CIJoePassenger
|
2
|
+
class Git < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
namespace :git
|
6
|
+
argument :name, :type => :string, :desc => "The project NAME"
|
7
|
+
|
8
|
+
def git_path
|
9
|
+
File.join(name, '.git')
|
10
|
+
end
|
11
|
+
|
12
|
+
def repo?
|
13
|
+
File.exist?(git_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ls_remote_origin_master
|
17
|
+
res = ''
|
18
|
+
inside(name) do
|
19
|
+
res = run("git ls-remote origin master")
|
20
|
+
end
|
21
|
+
res
|
22
|
+
end
|
23
|
+
|
24
|
+
def upstream_head
|
25
|
+
ls_remote_origin_master.split(' ').first
|
26
|
+
end
|
27
|
+
|
28
|
+
def current_head
|
29
|
+
res = ''
|
30
|
+
inside(git_path) do
|
31
|
+
res = run("cat #{File.join('refs', 'heads', 'master')}")
|
32
|
+
end
|
33
|
+
res.chop
|
34
|
+
end
|
35
|
+
|
36
|
+
def clone(url)
|
37
|
+
run "git clone #{url} #{name}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_config_to_repo(key, value)
|
41
|
+
inside(name) do
|
42
|
+
run "git config --add \"#{key}\" \"#{value}\""
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CIJoePassenger
|
2
|
+
class Install < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
namespace :install
|
6
|
+
argument :cijoe_url, :type => :string, :desc => "The URL of the CIJoe server"
|
7
|
+
source_root File.join(File.dirname(__FILE__), '..', '..')
|
8
|
+
|
9
|
+
def install
|
10
|
+
@cijoe_url = cijoe_url
|
11
|
+
@app_path = Dir.pwd
|
12
|
+
directory 'templates', @app_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module CIJoePassenger
|
2
|
+
class Project
|
3
|
+
attr_reader :name, :git
|
4
|
+
|
5
|
+
def self.dirs
|
6
|
+
Dir['*'].select do |name|
|
7
|
+
Git.new([name]).repo?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.all
|
12
|
+
dirs.collect{|name| Project.new(name) }
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.stale
|
16
|
+
all.select(&:stale?)
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(name)
|
20
|
+
@name = name
|
21
|
+
@git = Git.new([name])
|
22
|
+
end
|
23
|
+
|
24
|
+
def stale?
|
25
|
+
git.current_head != git.upstream_head
|
26
|
+
end
|
27
|
+
|
28
|
+
def build
|
29
|
+
uri = URI.parse("http://#{Config.cijoe_url}/#{name}")
|
30
|
+
Net::HTTP.post_form(uri, {})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Add do
|
4
|
+
before do
|
5
|
+
@git = stub
|
6
|
+
Git.stub!(:new).with(['name']).and_return(@git)
|
7
|
+
@add = Add.new(['name', 'repo'])
|
8
|
+
end
|
9
|
+
|
10
|
+
it "has a git instance by default" do
|
11
|
+
@add.git.should == @git
|
12
|
+
end
|
13
|
+
|
14
|
+
it "clones the repo" do
|
15
|
+
@git.should_receive(:clone).with('repo')
|
16
|
+
@add.clone
|
17
|
+
end
|
18
|
+
|
19
|
+
it "configures cijoe runner in git config" do
|
20
|
+
::CIJoePassenger::Config.stub!(:runner).and_return('runner')
|
21
|
+
@git.should_receive(:add_config_to_repo).with("cijoe.runner", 'runner')
|
22
|
+
@add.configure_cijoe_runner
|
23
|
+
end
|
24
|
+
|
25
|
+
it "reminds peeps to setup database.yml" do
|
26
|
+
@add.should_receive(:puts).with(/forget/)
|
27
|
+
@add.remind
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Git do
|
4
|
+
before do
|
5
|
+
@git = Git.new(['name'])
|
6
|
+
end
|
7
|
+
|
8
|
+
it "has a path to the git config dir" do
|
9
|
+
@git.git_path.should == "name/.git"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "checks to see if git_path exists in order to determine if repo exists" do
|
13
|
+
@git.stub!(:git_path).and_return('git_path')
|
14
|
+
File.should_receive(:exist?).with('git_path').and_return(true)
|
15
|
+
@git.repo?.should == true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "runs git ls-remote origin master in the repo dir and returns output" do
|
19
|
+
@git.stub!(:inside).with('name').and_yield
|
20
|
+
@git.should_receive(:run).with("git ls-remote origin master").and_return('ls_remote_origin_master')
|
21
|
+
@git.ls_remote_origin_master.should == 'ls_remote_origin_master'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "split on space and pull the first segment back from ls_remote_origin_master as origin_head_sha" do
|
25
|
+
@git.stub!(:ls_remote_origin_master).and_return("123 some/junk")
|
26
|
+
@git.upstream_head.should == '123'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "clones a repo into the repo_path" do
|
30
|
+
@git.should_receive(:run).with("git clone repo name")
|
31
|
+
@git.clone('repo')
|
32
|
+
end
|
33
|
+
|
34
|
+
it "runs git ls-remote origin master in the repo dir and returns output" do
|
35
|
+
@git.stub!(:inside).with('name').and_yield
|
36
|
+
@git.should_receive(:run).with("git config --add \"key\" \"value\"")
|
37
|
+
@git.add_config_to_repo('key', 'value')
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Install do
|
4
|
+
before do
|
5
|
+
@install = Install.new(['url'])
|
6
|
+
end
|
7
|
+
|
8
|
+
it "run directory with templates and current working directory" do
|
9
|
+
Dir.stub!(:pwd).and_return('pwd')
|
10
|
+
@install.should_receive(:directory).with('templates', 'pwd')
|
11
|
+
@install.install
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Project, "the class" do
|
4
|
+
it "selects all the dirs that are repos" do
|
5
|
+
git1 = stub
|
6
|
+
git1.stub!(:repo?).and_return(true)
|
7
|
+
git2 = stub
|
8
|
+
git2.stub!(:repo?).and_return(false)
|
9
|
+
|
10
|
+
dirs = ['dir1', 'dir2']
|
11
|
+
Git.stub!(:new).with(['dir1']).and_return(git1)
|
12
|
+
Git.stub!(:new).with(['dir2']).and_return(git2)
|
13
|
+
|
14
|
+
Dir.should_receive(:[]).with('*').and_return(dirs)
|
15
|
+
Project.dirs.should == ['dir1']
|
16
|
+
end
|
17
|
+
|
18
|
+
it "creates a new project for each repo" do
|
19
|
+
repo = stub
|
20
|
+
repos = [repo]
|
21
|
+
Project.stub!(:dirs).and_return(repos)
|
22
|
+
Project.should_receive(:new).with(repo).and_return(repo)
|
23
|
+
Project.all.should == repos
|
24
|
+
end
|
25
|
+
|
26
|
+
it "selects only stale projects" do
|
27
|
+
p1 = stub
|
28
|
+
p1.stub!(:stale?).and_return(true)
|
29
|
+
p2 = stub
|
30
|
+
p2.stub!(:stale?).and_return(false)
|
31
|
+
Project.stub!(:all).and_return([p1, p2])
|
32
|
+
Project.stale.should == [p1]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe Project, "the instance" do
|
37
|
+
before do
|
38
|
+
@git = stub
|
39
|
+
Git.stub!(:new).with(['name']).and_return(@git)
|
40
|
+
@project = Project.new('name')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "has a name reader" do
|
44
|
+
@project.name.should == 'name'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "has a git instance by default" do
|
48
|
+
@project.git.should == @git
|
49
|
+
end
|
50
|
+
|
51
|
+
it "is not stale if current_head matches upstream_head" do
|
52
|
+
@git.stub!(:current_head).and_return('a')
|
53
|
+
@git.stub!(:upstream_head).and_return('a')
|
54
|
+
@project.stale?.should be(false)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "is stale if current_head doesnt match upstream_head" do
|
58
|
+
@git.stub!(:current_head).and_return('a')
|
59
|
+
@git.stub!(:upstream_head).and_return('b')
|
60
|
+
@project.stale?.should be(true)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "send a request to cijoe to build the project" do
|
64
|
+
::CIJoePassenger::Config.stub!(:cijoe_url).and_return('cijoe_url')
|
65
|
+
URI.should_receive(:parse).with("http://cijoe_url/name").and_return('uri')
|
66
|
+
Net::HTTP.should_receive(:post_form).with('uri', {})
|
67
|
+
@project.build
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scan, "the instance" do
|
4
|
+
before do
|
5
|
+
@scan = Scan.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "invoke refresh on each refreshable project" do
|
9
|
+
project = mock
|
10
|
+
project.should_receive(:build)
|
11
|
+
Project.stub!(:stale).and_return([project])
|
12
|
+
@scan.scan
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/templates/config.ru
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
cijoe_url: <%= @cijoe_url %>
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
cijoe_passenger works!
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cijoe_passenger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Justin Marney
|
13
|
+
- Tony Pitale
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-28 00:00:00 -04:00
|
19
|
+
default_executable: cijoep
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Generates a CIJoe passenger instance with projects that automatically build.
|
35
|
+
email: gotascii@gmail.com
|
36
|
+
executables:
|
37
|
+
- cijoep
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- LICENSE
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- .bundle/config
|
45
|
+
- .gitignore
|
46
|
+
- .rvmrc
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
49
|
+
- LICENSE
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
53
|
+
- bin/cijoep
|
54
|
+
- cijoe_passenger.gemspec
|
55
|
+
- lib/cijoe_passenger.rb
|
56
|
+
- lib/cijoe_passenger/add.rb
|
57
|
+
- lib/cijoe_passenger/apps/base.rb
|
58
|
+
- lib/cijoe_passenger/cijoe.rb
|
59
|
+
- lib/cijoe_passenger/git.rb
|
60
|
+
- lib/cijoe_passenger/install.rb
|
61
|
+
- lib/cijoe_passenger/project.rb
|
62
|
+
- lib/cijoe_passenger/scan.rb
|
63
|
+
- spec/cijoe_passenger/add_spec.rb
|
64
|
+
- spec/cijoe_passenger/git_spec.rb
|
65
|
+
- spec/cijoe_passenger/install_spec.rb
|
66
|
+
- spec/cijoe_passenger/project_spec.rb
|
67
|
+
- spec/cijoe_passenger/scan_spec.rb
|
68
|
+
- spec/spec_helper.rb
|
69
|
+
- templates/config.ru
|
70
|
+
- templates/config/cijoe_passenger.conf.tt
|
71
|
+
- templates/config/config.yml.tt
|
72
|
+
- templates/log/access_log
|
73
|
+
- templates/log/error_log
|
74
|
+
- templates/public/index.html
|
75
|
+
- templates/tmp/restart.txt
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/vigetlabs/cijoe_passenger
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
requirements: []
|
102
|
+
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.3.7
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Makes CIJoe awesomer.
|
108
|
+
test_files:
|
109
|
+
- spec/cijoe_passenger/add_spec.rb
|
110
|
+
- spec/cijoe_passenger/git_spec.rb
|
111
|
+
- spec/cijoe_passenger/install_spec.rb
|
112
|
+
- spec/cijoe_passenger/project_spec.rb
|
113
|
+
- spec/cijoe_passenger/scan_spec.rb
|
114
|
+
- spec/spec_helper.rb
|