snaptoken 0.16.0 → 0.17.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd8904d0bdce5a73db3795d42eddea18618930fb
4
- data.tar.gz: 580aa6514165807bea0d89475364d8b7d351cbff
3
+ metadata.gz: ecc91e0a30895dd4821e2da35602b38a8d5d68cf
4
+ data.tar.gz: 74ae9e091a3c50452c5421c8873b51993942fb3d
5
5
  SHA512:
6
- metadata.gz: d1149aeee348e9bebe74a60320c6b91ca4003e8a1cf27ee7ccdeed905a540e69c75c260b03bae49d26169c1ccf7488d3820dce8e5f871f660e68030a5f7b12fd
7
- data.tar.gz: b9053d36ac5e378fa3dc4f0a1a3ef589fa1344bbdbba0210f10c34a6a78aa8b87a9383729b73bc0631ff2970c78ccf8476add0ee846912d9626b7c5cf795bace
6
+ metadata.gz: c40cad24f4935310d55101d30ea6b84037e5393b96c38b7b9448bd5231ad65e724f170bc2a63dcaf9289ab71b2875990e440317127c33cd7914aa5c5b5d2431d
7
+ data.tar.gz: 66c826b887014796a835bf0fb1c8095e79b5087f787505a1795e5757700a18b97d5cafc7e4c28fb88f52373fa05aa330c7c37cc1781d28b331c02f759867b380
@@ -18,6 +18,7 @@ class Snaptoken::Commands::Diff < Snaptoken::Commands::BaseCommand
18
18
  if line =~ /^(From|Date|index)/
19
19
  # skip
20
20
  elsif line =~ /^Subject: \[[^\]]*\](.*)$/
21
+ break if $1.strip == "-"
21
22
  f << "\n" unless step_num == 1
22
23
  step = Snaptoken::Step.from_commit_msg(step_num, $1.strip)
23
24
  f << "~~~ step: #{step.commit_msg}\n"
@@ -16,10 +16,28 @@ class Snaptoken::Commands::Repo < Snaptoken::Commands::BaseCommand
16
16
  repo = Rugged::Repository.init_at("repo")
17
17
 
18
18
  steps.each do |step|
19
- index = repo.index
20
- index.read_tree(repo.head.target.tree) unless repo.empty?
19
+ commit_oid = add_commit(repo, step, step_path(step))
21
20
 
22
- FileUtils.cd(step_path(step)) do
21
+ if step.name
22
+ repo.references.create("refs/tags/#{step.name}", commit_oid)
23
+ end
24
+ end
25
+
26
+ if Dir.exist? "repo-extra"
27
+ add_commit(repo, nil, [step_path(latest_step), "repo-extra"])
28
+ end
29
+
30
+ repo.checkout_head(strategy: :force)
31
+ end
32
+
33
+ private
34
+
35
+ def add_commit(repo, step, add_paths)
36
+ index = repo.index
37
+ index.read_tree(repo.head.target.tree) unless repo.empty?
38
+
39
+ Array(add_paths).each do |add_path|
40
+ FileUtils.cd(add_path) do
23
41
  Dir["**/*"].each do |path|
24
42
  unless File.directory?(path)
25
43
  oid = repo.write(File.read(path), :blob)
@@ -27,21 +45,15 @@ class Snaptoken::Commands::Repo < Snaptoken::Commands::BaseCommand
27
45
  end
28
46
  end
29
47
  end
30
-
31
- options = {}
32
- options[:tree] = index.write_tree(repo)
33
- options[:message] = step.commit_msg
34
- options[:parents] = repo.empty? ? [] : [repo.head.target]
35
- options[:update_ref] = 'HEAD'
36
-
37
- commit_oid = Rugged::Commit.create(repo, options)
38
-
39
- if step.name
40
- repo.references.create("refs/tags/#{step.name}", commit_oid)
41
- end
42
48
  end
43
49
 
44
- repo.checkout_head(strategy: :force)
50
+ options = {}
51
+ options[:tree] = index.write_tree(repo)
52
+ options[:message] = step ? step.commit_msg : "-"
53
+ options[:parents] = repo.empty? ? [] : [repo.head.target]
54
+ options[:update_ref] = 'HEAD'
55
+
56
+ Rugged::Commit.create(repo, options)
45
57
  end
46
58
  end
47
59
 
@@ -19,6 +19,8 @@ class Snaptoken::Commands::Unrepo < Snaptoken::Commands::BaseCommand
19
19
  walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
20
20
  walker.push(repo.branches.find { |b| b.name == "master" }.target)
21
21
  walker.each.with_index do |commit, idx|
22
+ break if commit.message.lines.first.strip == "-"
23
+
22
24
  step = Snaptoken::Step.from_commit_msg(idx + 1, commit.message.lines.first.strip)
23
25
 
24
26
  repo.checkout(commit.oid, strategy: :force,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ruten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged