docman 0.0.17 → 0.0.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19f94ad0fa7db90b3885c21db21c601d3f88b3c6
4
- data.tar.gz: 31ecc7e39088113ca2b6641b011f2108656dd3e9
3
+ metadata.gz: 6d91c91e2da9dc5481483fc7e9bdbd5483f2690b
4
+ data.tar.gz: 387e3605485f728f50a760f9800e8c579904a9e4
5
5
  SHA512:
6
- metadata.gz: 769e911a9c9f66418a64b249721a64c7e0db4e654bc5cea51f054bc70eca865c44de340e10d9b990f93009a157157af9c03e74049b895c2a4fb2a980707e9541
7
- data.tar.gz: 371f377760e27394464e5fecb117d0f883f82f06b27f1416faad1dacdef35cd039306a9261017755132dad5b4dce6ec99cb31f1f5a69b98524438ce6929e907f
6
+ metadata.gz: 7028de3b0029ac4e81bd537171ad23474573a62fda966c099a747cc4e23c2953ffd2fa6a2198c718a730727e4f87bd0bf50253b95fcfdb0343501c5f818eae43
7
+ data.tar.gz: 7da3e17324ae345528ae23b4d01d77b86e0a7e9086fd68378eb6413eba60cb07340c93f402e42018e9fdcd6942898fb42a72714f080d20316cfeb09b1cd0a69c
@@ -45,8 +45,11 @@ module Docman
45
45
  @force = false
46
46
  end
47
47
 
48
- def init(name, repo)
49
- `mkdir #{name} && cd #{name} && git clone --depth 1 #{repo} config`
48
+ def init(name, repo, options)
49
+ branch = options['branch'] ? options['branch'] : 'master'
50
+ `mkdir #{name} && cd #{name} && git clone -b #{branch} --single-branch --depth 1 #{repo} config`
51
+ #Dir.chdir File.join(name, 'config')
52
+ #`git checkout #{branch} & git branch -u origin #{branch}`
50
53
  end
51
54
 
52
55
  def with_rescue
@@ -5,10 +5,12 @@ module Docman
5
5
  register_builder :git_direct_builder
6
6
 
7
7
  def execute
8
+ old_revision = GitUtil.last_revision @context['full_build_path']
8
9
  execute_result = GitUtil.get(@context['repo'], @context['full_build_path'], @context.version_type, @context.version)
9
10
  # No commit hash for 'root' as it will be changed later
11
+ last_revision = GitUtil.last_revision @context['full_build_path']
10
12
  @version = @context['type'] == 'root' ? @context['build_path'] : execute_result
11
- GitUtil.repo_changed?(@context['full_build_path']) ? @version : false
13
+ old_revision != last_revision ? @version : false
12
14
  end
13
15
 
14
16
  def changed?
@@ -10,6 +10,7 @@ module Docman
10
10
  desc 'init "dirname" "repo"', 'Initialize docroot in "dirname" from config repo "repo"'
11
11
  method_option :force, :aliases => '-f', :desc => 'Force init'
12
12
  method_option :skip, :aliases => '-s', :desc => 'Skip if docroot initialized already'
13
+ option :branch
13
14
  def init(name, repo)
14
15
  if File.directory? name
15
16
  say("Directory #{name} already exists")
@@ -32,7 +33,7 @@ module Docman
32
33
  end
33
34
 
34
35
  puts "Init docroot directory #{name} and retrieve config from provided repo."
35
- Application.instance.init(name, repo)
36
+ Application.instance.init(name, repo, options)
36
37
  say('Complete!', :green)
37
38
  end
38
39
 
@@ -47,14 +47,19 @@ module Docman
47
47
  Dir.chdir path
48
48
  exec "git checkout #{version}"
49
49
  end
50
- result = type == 'branch' ? self.last_revision : version
50
+ result = type == 'branch' ? self.last_revision(path) : version
51
51
  result
52
52
  end
53
53
 
54
54
 
55
- def self.last_revision
56
- result = `git rev-parse --short HEAD`
57
- result.delete!("\n")
55
+ def self.last_revision(path = nil)
56
+ result = nil
57
+ if self.repo? path
58
+ Dir.chdir path unless path.nil?
59
+ result = `git rev-parse --short HEAD`
60
+ result.delete!("\n")
61
+ end
62
+ result
58
63
  end
59
64
 
60
65
  def self.update(path)
@@ -108,6 +108,7 @@ module Docman
108
108
  false
109
109
  end
110
110
 
111
+ #TODO: check if info.yaml needed for local state
111
112
  def stored_version
112
113
  info_filename = File.join(self['full_build_path'], 'info.yaml')
113
114
  return false unless File.file?(info_filename)
@@ -1,3 +1,3 @@
1
1
  module Docman
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
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.17
4
+ version: 0.0.18
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-22 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler