duke 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,9 @@ Duke will clone the repo and configure it with some defaults.
32
32
  === Default Configuration
33
33
 
34
34
  host: localhost
35
- Used to generate links to cijoes in the web interface.
35
+ Used to generate links to cijoes and the main duke url.
36
+ port: nil
37
+ Used to generate the main duke url.
36
38
  runner: rake
37
39
  When duke checks out a new repo it will configure it to build using this command.
38
40
  pid_dir: tmp/pids
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{duke}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Marney"]
@@ -28,4 +28,7 @@ module Duke
28
28
  config_yml = File.exist?(config_path) ? YAML.load_file(config_path) : {}
29
29
  config = CONFIG_DEFAULT.merge(config_yml)
30
30
  Config = OpenStruct.new(config)
31
+ url = "http://#{Config.host}"
32
+ url += ":#{Config.port}" if Config.port
33
+ Config.host_url = url
31
34
  end
@@ -23,15 +23,15 @@ module Duke
23
23
  @project = Project.find(:repo_dir => params[:id])
24
24
  if @project.running?
25
25
  @project.stop
26
- else
26
+ elsif params[:project][:port]
27
27
  @project.start(params[:project][:port])
28
28
  end
29
- redirect '/'
29
+ redirect Config.host_url
30
30
  end
31
31
 
32
32
  post '/projects' do
33
33
  Project.create(params[:project])
34
- redirect '/'
34
+ redirect Config.host_url
35
35
  end
36
36
  end
37
37
  end
@@ -1,7 +1,7 @@
1
1
  module Duke
2
2
  class Controller
3
3
  extend Forwardable
4
- def_delegators :controller, :start, :stop, :running?, :pid
4
+ def_delegators :controller, :start, :stop, :pid
5
5
  attr_reader :dir, :repo_dir, :timeout, :port
6
6
 
7
7
  def self.pid_files
@@ -27,6 +27,10 @@ module Duke
27
27
  nil
28
28
  end
29
29
 
30
+ def running?
31
+ port.nil? ? false : controller.running?
32
+ end
33
+
30
34
  def identifier
31
35
  "#{repo_dir}.#{port}"
32
36
  end
@@ -89,6 +89,24 @@ describe Controller do
89
89
  end
90
90
  end
91
91
 
92
+ describe "#running" do
93
+ context "when port is nil" do
94
+ it "is false" do
95
+ @controller.stub(:port).and_return(nil)
96
+ @controller.running?.should be_false
97
+ end
98
+ end
99
+
100
+ context "when port is not nil" do
101
+ it "is delegates to controller" do
102
+ controller = double("controller")
103
+ controller.should_receive(:running?).and_return('running?')
104
+ @controller.stub(:controller).and_return(controller)
105
+ @controller.running?.should == "running?"
106
+ end
107
+ end
108
+ end
109
+
92
110
  describe "#controller" do
93
111
  it "instantiates a DaemonController" do
94
112
  @controller.stub(:identifier).and_return("identifier")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Justin Marney