propel 0.1.0 → 0.1.1
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/propel/configuration.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Propel
|
2
2
|
class Configuration
|
3
|
-
def initialize(command_line_arguments)
|
3
|
+
def initialize(command_line_arguments, repository)
|
4
4
|
@command_line_options = command_line_arguments
|
5
|
+
@repository = repository
|
5
6
|
end
|
6
7
|
|
7
8
|
DEFAULTS = {
|
@@ -15,6 +16,10 @@ module Propel
|
|
15
16
|
DEFAULTS.merge(parse(options_from_config_file).merge(parse @command_line_options))
|
16
17
|
end
|
17
18
|
|
19
|
+
def config_file
|
20
|
+
File.join(@repository.project_root, ".propel")
|
21
|
+
end
|
22
|
+
|
18
23
|
private
|
19
24
|
def options_from_config_file
|
20
25
|
File.exist?(config_file) ? File.read(config_file).split : [ ]
|
@@ -23,9 +28,5 @@ module Propel
|
|
23
28
|
def parse(option_array)
|
24
29
|
Propel::OptionParser.parse!(option_array)
|
25
30
|
end
|
26
|
-
|
27
|
-
def config_file
|
28
|
-
'./.propel'
|
29
|
-
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/propel/runner.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
module Propel
|
2
2
|
class Runner
|
3
3
|
def initialize(args = [ ])
|
4
|
-
@
|
4
|
+
@repository = GitRepository.new
|
5
|
+
@options = Configuration.new(args, @repository).options
|
5
6
|
end
|
6
7
|
|
7
8
|
def start
|
8
|
-
|
9
|
-
|
10
|
-
if git_repository.changed?
|
9
|
+
if @repository.changed?
|
11
10
|
if remote_build_configured?
|
12
11
|
check_remote_build! unless ignore_remote_build?
|
13
12
|
|
@@ -17,7 +16,7 @@ module Propel
|
|
17
16
|
|
18
17
|
propel!
|
19
18
|
else
|
20
|
-
puts "There is nothing to propel - your HEAD is identical to #{
|
19
|
+
puts "There is nothing to propel - your HEAD is identical to #{@repository.remote_config} #{@repository.merge_config}."
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
data/lib/propel/version.rb
CHANGED
@@ -3,24 +3,34 @@ require 'spec_helper'
|
|
3
3
|
describe Propel::Configuration do
|
4
4
|
describe "#options" do
|
5
5
|
it "should prefer options given on the command line over options in a configuration file" do
|
6
|
-
configuration = Propel::Configuration.new(['--rebase'])
|
6
|
+
configuration = Propel::Configuration.new(['--rebase'], Propel::GitRepository.new)
|
7
7
|
configuration.stub!(:options_from_config_file).and_return(['--no-rebase'])
|
8
8
|
|
9
9
|
configuration.options[:rebase].should be_true
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should not overwrite options from config file with defaults" do
|
13
|
-
configuration = Propel::Configuration.new([])
|
13
|
+
configuration = Propel::Configuration.new([], Propel::GitRepository.new)
|
14
14
|
configuration.stub!(:options_from_config_file).and_return(['--wait'])
|
15
15
|
|
16
16
|
configuration.options[:wait].should be_true
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should set default options" do
|
20
|
-
configuration = Propel::Configuration.new([])
|
20
|
+
configuration = Propel::Configuration.new([], Propel::GitRepository.new)
|
21
21
|
configuration.stub!(:options_from_config_file).and_return([])
|
22
22
|
|
23
23
|
configuration.options.should == { :rebase => true, :force => false, :verbose => false, :wait => false}
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
describe "#config_file" do
|
28
|
+
it "should return a file located in the project root" do
|
29
|
+
git_repository = Propel::GitRepository.new
|
30
|
+
git_repository.stub!(:project_root).and_return('/foo/testdirectory')
|
31
|
+
|
32
|
+
configuration = Propel::Configuration.new([], git_repository)
|
33
|
+
configuration.config_file.should == '/foo/testdirectory/.propel'
|
34
|
+
end
|
35
|
+
end
|
26
36
|
end
|
@@ -11,6 +11,13 @@ describe Propel::GitRepository do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe "#project_root" do
|
15
|
+
it "should return the root of the project" do
|
16
|
+
project_root = File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. ]))
|
17
|
+
Propel::GitRepository.new.project_root.should == project_root
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe "#changed?" do
|
15
22
|
it "should return false when the remote branch has the same SHA1 as the local HEAD" do
|
16
23
|
git_repository = Propel::GitRepository.new
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Leitgeb
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-02 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|