singularity_dsl 1.2.5 → 1.2.8

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yzc0YjUwZWE2NmJhNGEzMzkyMzQyMjllY2VlOTk4Yzg3ZjMwYzgxZQ==
4
+ Mzg2MGViZWNiZjM3MWYwNWYzMTlmYTk2ZDQxYTcxZmI0NzQxZTNjMw==
5
5
  data.tar.gz: !binary |-
6
- YThjODFlMDNhMTUwYTI3N2YxMDlmOWRhMGNjNzQ5MjE4ZDExNDczMg==
6
+ Zjk3MTE3OTk4NjI3ZGNmMzM3ZDRhMDdmZjc1NGNiOTY4ODBiY2YyNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmY2NWFhZWY3ZTA5ZWRjZmU1MjVjYjUwNmI4MmM2YWNkNWI0YmRkYmJjNmNj
10
- ZTljYjM3NmIwYzBmMTM4YjNlNjk0OTBkOWY5N2MwM2M4MTEwYTA4OTljNzY2
11
- ZjJlMGZmN2ZmYTJhNWNiOWZiMjVmNTM0ZDdjNTliZDhlMjdmZWU=
9
+ OGE5ZjUwZDkwZWY1ZmI4ZjUzNDkyODQ1NmY5ZGVkYmNhOGQ2YTFiYzdkNzA0
10
+ MWQ4ODc0MzYxMmZlYTMyNzY0ZWFmNjhhM2ZlOTBjNmE0NzBlZjU0M2EyYzll
11
+ NDYxZGQ0MDAxZGJmNjkwYzJkZTRlMWMyN2JlMzNhMTQ1NzIyYWM=
12
12
  data.tar.gz: !binary |-
13
- YzlkYmNiMDM2YzI2MjQzNzY1NWEwMWQ5OGQ2MDJjOTYyMDg0MzQ2YmJhY2E2
14
- YTliNzYxNjU0YmNmMzhjNDA3NmRmMDUwODg4NzhkOGE3YzdjN2JhYjNlNDk1
15
- YzJjMzUwNDkwMWZiZTNjYjE3NGJiYTJiYjEyZjM0ZThiZmY0ZmE=
13
+ N2MxM2M2ZGMxMjgxMGQ5MzZmOTlmOTU1MDQyOWYzNjYwYzM4YWMzNDllMDU3
14
+ YjNmNWFiMmE3NjVlYzMxM2EzM2E0MWRhMGI0MDU5ODg0Mzg0MjQ2OTBmNjI4
15
+ Njc3ODliODAwZDdmMWMzZTQ4OTVkNzkyY2QwMTEzMzhlMzdiMDM=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- singularity_dsl (1.2.5)
4
+ singularity_dsl (1.2.8)
5
5
  mixlib-shellout (~> 1.4)
6
6
  rainbow (~> 2.0.0)
7
7
  rake (~> 10.3)
@@ -58,7 +58,8 @@ module SingularityDsl
58
58
  end
59
59
 
60
60
  # BATCH COMMAND
61
- desc 'batch BATCH_NAME', 'Run single task batch in the script.'
61
+ desc 'batch BATCH_NAME',
62
+ 'Run single task batch in the .singularityrc script.'
62
63
  def batch(batch, app = nil)
63
64
  app ||= setup_app(Application.new, singularity_script, tasks_path)
64
65
  exit(app.run batch, options[:all_tasks])
@@ -66,30 +67,37 @@ module SingularityDsl
66
67
 
67
68
  # TEST-MERGE COMMAND
68
69
  desc 'testmerge FORK BRANCH INTO_BRANCH [INTO_FORK]',
69
- 'Perform a test merge into the local repo.'
70
+ 'Perform a testmerge into the local repo and then run .singularityrc'
70
71
  option :run_task,
71
72
  aliases: '-r',
72
73
  type: :string,
73
- desc: 'Run a batch after. If nothing given, script is run as-is',
74
+ desc: 'Run a batch instead, after testmerge.',
74
75
  default: ''
75
76
  def testmerge(git_fork, branch, base_branch, base_fork = nil)
76
77
  test_merge git_fork, branch, base_branch, base_fork
77
- info 'File changesets'
78
- puts @git.diff_remote base_branch, base_fork, '--name-status'
79
- @diff_list = @git.diff_remote base_branch, base_fork, '--name-only'
80
- @git.remove_remote git_fork
81
- @git.remove_remote base_fork
82
- batch target_run_task if options[:run_task]
78
+ @diff_list = diff_list base_branch, base_fork
79
+ remove_remotes git_fork, base_fork
80
+ batch target_run_task if target_run_task
81
+ test unless target_run_task
83
82
  end
84
83
 
85
84
  private
86
85
 
86
+ def diff_list(ref, url)
87
+ @git.diff_remote ref, url, '--name-only'
88
+ end
89
+
90
+ def remove_remotes(*urls)
91
+ urls.each { |url| @git.remove_remote url }
92
+ end
93
+
87
94
  def test_merge(git_fork, branch, base_branch, base_fork)
88
95
  @git.clean_reset
89
96
  @git.add_remote base_fork
90
97
  @git.checkout_remote base_branch, base_fork
91
98
  @git.add_remote git_fork
92
99
  @git.merge_remote branch, git_fork
100
+ @git.install_submodules
93
101
  end
94
102
 
95
103
  def target_run_task
@@ -105,7 +113,7 @@ module SingularityDsl
105
113
  end
106
114
  unless @diff_list.nil?
107
115
  info 'Running with diff-list'
108
- puts @diff_list
116
+ list_items @diff_list
109
117
  app.change_list @diff_list
110
118
  end
111
119
  info "Loading CI script from #{singularity_script} ..."
@@ -19,6 +19,10 @@ module SingularityDsl
19
19
  remote_action branch, remote, 'checkout'
20
20
  end
21
21
 
22
+ def install_submodules
23
+ exec 'git submodule update --init --recursive'
24
+ end
25
+
22
26
  def merge_remote(branch, url)
23
27
  remote_action branch, url, 'merge'
24
28
  end
@@ -5,6 +5,11 @@ require 'rainbow'
5
5
  module SingularityDsl
6
6
  # mixin for output wrappers
7
7
  module Stdout
8
+ def list_items(items)
9
+ items = [*items]
10
+ items.each { |item| puts Rainbow(item).magenta }
11
+ end
12
+
8
13
  def info(message)
9
14
  puts Rainbow(message).cyan
10
15
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version const for gem
4
4
  module SingularityDsl
5
- VERSION = '1.2.5'
5
+ VERSION = '1.2.8'
6
6
  end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ require 'singularity_dsl/cli/cli'
4
+
5
+ describe 'Cli' do
6
+ let(:cli) { SingularityDsl::Cli::Cli.new }
7
+
8
+ context '#testmerge' do
9
+ before(:each) do
10
+ expect(cli).to receive(:test_merge)
11
+ expect(cli).to receive(:diff_list)
12
+ expect(cli).to receive(:remove_remotes)
13
+ end
14
+
15
+ it 'runs test method if no run_task' do
16
+ cli.stub(:target_run_task).and_return false
17
+ expect(cli).to receive(:test)
18
+ cli.testmerge 'fork', 'fork_branch', 'base_branch'
19
+ end
20
+
21
+ it 'runs batch method if no run_task' do
22
+ cli.stub(:target_run_task).and_return 'test_batch'
23
+ expect(cli).to receive(:batch)
24
+ cli.testmerge 'fork', 'fork_branch', 'base_branch'
25
+ end
26
+ end
27
+ end
@@ -4,6 +4,9 @@ require 'singularity_dsl/tasks/shell_task'
4
4
 
5
5
  describe 'ShellTask' do
6
6
  let(:sh_task) { ShellTask.new }
7
+ before(:each) do
8
+ sh_task.stub(:log_shell)
9
+ end
7
10
 
8
11
  context '#initialize' do
9
12
  it 'starts with no conditionals' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singularity_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - chr0n1x
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -179,6 +179,7 @@ files:
179
179
  - lib/singularity_dsl/version.rb
180
180
  - singularity_dsl.gemspec
181
181
  - spec/singularity_dsl/application_spec.rb
182
+ - spec/singularity_dsl/cli/cli_spec.rb
182
183
  - spec/singularity_dsl/dsl/batch_spec.rb
183
184
  - spec/singularity_dsl/dsl/changeset_spec.rb
184
185
  - spec/singularity_dsl/dsl/dsl_spec.rb
@@ -217,6 +218,7 @@ specification_version: 4
217
218
  summary: ''
218
219
  test_files:
219
220
  - spec/singularity_dsl/application_spec.rb
221
+ - spec/singularity_dsl/cli/cli_spec.rb
220
222
  - spec/singularity_dsl/dsl/batch_spec.rb
221
223
  - spec/singularity_dsl/dsl/changeset_spec.rb
222
224
  - spec/singularity_dsl/dsl/dsl_spec.rb