docman 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79315860ae754b3a074bb1229651542641846d77
4
- data.tar.gz: 168507455be1385b378d456aa1bfa8de52c04700
3
+ metadata.gz: d21d4701a1e78242691f9855ef44f869eb4b8a13
4
+ data.tar.gz: 4265af6c323295622bf23f8228444a752358fdb0
5
5
  SHA512:
6
- metadata.gz: 750664e21bf593b052a230e2721c0ab50502c730d4778a9f4af8a7f65c5a11b7d55be2d21a9e27f5140ca75fb113b20d1f792c96a4bf4da8a2763b166b124385
7
- data.tar.gz: 816ac4cbd7a9cd4ba498b833cf64d3cec325e8a2963e5ecd3faa7c299ca566be77677233e086e369b4c0fb986610ba99ed64be29e9cd813618b7ae1bbcee3a37
6
+ metadata.gz: 556e35cc141fb5e8d3599c1d5043b6e08655585261d981ed51bc9d139b63cc46570bcea2fdc2d14256b71b99e120402df9b8ddcc3490d441f3f6c59ccfba4c06
7
+ data.tar.gz: 87775b0e968e87c7a4fb6293e948638dd669053f866d62f209e71356efc2c25a439fec0dff333eeecafb0df2121c7fc64d4abf389bd42da0f4778a55f32b577f
@@ -42,6 +42,12 @@ module Docman
42
42
  end
43
43
  end
44
44
 
45
+ path = @docroot_config.root['full_build_path']
46
+ Dir.chdir path
47
+ if GitUtil.repo_changed? path
48
+ GitUtil.reset_repo path
49
+ end
50
+
45
51
  stored_config_hash = read_version_file_param('config_hash')
46
52
  @config_hash = Docman::Application.instance.config.config_hash
47
53
  @config_yaml = Docman::Application.instance.config.to_yaml
@@ -95,6 +101,8 @@ module Docman
95
101
 
96
102
  def read_file(path)
97
103
  YAML::load_file(path)
104
+ rescue
105
+ raise "Error in config file #{path}"
98
106
  end
99
107
 
100
108
  def read_version_file_param(param)
@@ -78,6 +78,8 @@ module Docman
78
78
  end
79
79
 
80
80
  def states_dependin_on(name, version)
81
+ raise "There is no project with name '#{name}' exists in config" unless @names.has_key? name
82
+
81
83
  states = {}
82
84
  @names[name]['states'].each do |state, info|
83
85
  states[state] = info if info['version'] == version
@@ -8,18 +8,30 @@ module Docman
8
8
 
9
9
  def self.exec(command)
10
10
  @logger.info command
11
- @logger.info `#{command}`.delete!("\n")
11
+ result = `#{command}`.delete!("\n")
12
+ @logger.info result if result
13
+ raise result unless $?.exitstatus == 0
14
+ result
15
+ end
16
+
17
+ def self.reset_repo(path)
18
+ Dir.chdir path
19
+ exec 'git reset --hard'
20
+ exec 'git clean -f -d'
12
21
  end
13
22
 
14
23
  def self.get(repo, path, type, version)
15
24
  if File.directory? path and File.directory?(File.join(path, '.git'))
16
25
  Dir.chdir path
26
+
27
+ self.reset_repo(path) if self.repo_changed?(path)
28
+
17
29
  if type == 'branch'
18
30
  exec "git checkout #{version}"
19
31
  exec "git pull origin #{version}"
20
32
  end
21
33
  if type == 'tag'
22
- exec "git fetch --tags"
34
+ exec 'git fetch --tags'
23
35
  exec "git checkout tags/#{version}"
24
36
  end
25
37
  else
@@ -1,3 +1,3 @@
1
1
  module Docman
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tolstikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-13 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler