packager-dsl 0.0.1 → 0.1.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.
@@ -1,21 +1,21 @@
1
- require './spec/executor/context.rb'
2
- describe Packager::Executor do
3
- include_context :executor
4
-
5
- it "creates an empty directory" do
6
- item = Packager::Struct::Package.new(
7
- :name => 'foo',
8
- :version => '0.0.1',
9
- :type => 'dir',
10
- )
11
- executor.execute_on([item])
12
- expect(executor.commands[0]).to eq(
13
- Packager::Struct::Command.new({
14
- :name => 'foo',
15
- :version => '0.0.1',
16
- :source => 'empty',
17
- :target => 'dir',
18
- })
19
- )
20
- end
21
- end
1
+ require './spec/executor/context.rb'
2
+ describe Packager::Executor do
3
+ include_context :executor
4
+
5
+ it "creates an empty directory" do
6
+ item = Packager::Struct::Package.new(
7
+ :name => 'foo',
8
+ :version => '0.0.1',
9
+ :type => 'dir',
10
+ )
11
+ executor.execute_on([item])
12
+ expect(executor.commands[0]).to eq(
13
+ Packager::Struct::Command.new({
14
+ :name => 'foo',
15
+ :version => '0.0.1',
16
+ :source => 'empty',
17
+ :target => 'dir',
18
+ })
19
+ )
20
+ end
21
+ end
@@ -1,18 +1,18 @@
1
- describe Packager::Struct::Command do
2
- it "creates a FPM command correctly" do
3
- cmd = Packager::Struct::Command.new(
4
- :name => 'foo',
5
- :version => '0.0.1',
6
- :target => 'test',
7
- )
8
- cmd.add_directory('foo')
9
- expect(cmd.to_system).to eq([
10
- 'fpm',
11
- '--name', 'foo',
12
- '--version', '0.0.1',
13
- '-s', 'dir',
14
- '-t', 'test',
15
- 'foo',
16
- ])
17
- end
18
- end
1
+ describe Packager::Struct::Command do
2
+ it "creates a FPM command correctly" do
3
+ cmd = Packager::Struct::Command.new(
4
+ :name => 'foo',
5
+ :version => '0.0.1',
6
+ :target => 'test',
7
+ )
8
+ cmd.add_directory('foo')
9
+ expect(cmd.to_system).to eq([
10
+ 'fpm',
11
+ '--name', 'foo',
12
+ '--version', '0.0.1',
13
+ '-s', 'dir',
14
+ '-t', 'test',
15
+ 'foo',
16
+ ])
17
+ end
18
+ end
@@ -1,4 +1,4 @@
1
- RSpec.shared_context :executor do
2
- subject(:executor) { Packager::Executor.new(:dryrun => true) }
3
-
4
- end
1
+ RSpec.shared_context :executor do
2
+ subject(:executor) { Packager::Executor.new(:dryrun => true) }
3
+
4
+ end
@@ -1,46 +1,46 @@
1
- require './spec/executor/context.rb'
2
- describe Packager::Executor do
3
- include_context :executor
4
-
5
- context "dependencies" do
6
- it "handles a dependency" do
7
- item = Packager::Struct::Package.new(
8
- :name => 'foo',
9
- :version => '0.0.1',
10
- :type => 'test',
11
- :requires => [ 'foo' ],
12
- )
13
- executor.execute_on([item])
14
- expect(executor.commands[0]).to eq(
15
- Packager::Struct::Command.new({
16
- :name => 'foo',
17
- :version => '0.0.1',
18
- :source => 'empty',
19
- :target => 'test',
20
- :requires => [ 'foo' ],
21
- })
22
- )
23
- end
24
- end
25
-
26
- context "provides" do
27
- it "handles a provides" do
28
- item = Packager::Struct::Package.new(
29
- :name => 'foo',
30
- :version => '0.0.1',
31
- :type => 'test',
32
- :provides => [ 'foo' ],
33
- )
34
- executor.execute_on([item])
35
- expect(executor.commands[0]).to eq(
36
- Packager::Struct::Command.new({
37
- :name => 'foo',
38
- :version => '0.0.1',
39
- :source => 'empty',
40
- :target => 'test',
41
- :provides => [ 'foo' ],
42
- })
43
- )
44
- end
45
- end
46
- end
1
+ require './spec/executor/context.rb'
2
+ describe Packager::Executor do
3
+ include_context :executor
4
+
5
+ context "dependencies" do
6
+ it "handles a dependency" do
7
+ item = Packager::Struct::Package.new(
8
+ :name => 'foo',
9
+ :version => '0.0.1',
10
+ :type => 'test',
11
+ :requires => [ 'foo' ],
12
+ )
13
+ executor.execute_on([item])
14
+ expect(executor.commands[0]).to eq(
15
+ Packager::Struct::Command.new({
16
+ :name => 'foo',
17
+ :version => '0.0.1',
18
+ :source => 'empty',
19
+ :target => 'test',
20
+ :requires => [ 'foo' ],
21
+ })
22
+ )
23
+ end
24
+ end
25
+
26
+ context "provides" do
27
+ it "handles a provides" do
28
+ item = Packager::Struct::Package.new(
29
+ :name => 'foo',
30
+ :version => '0.0.1',
31
+ :type => 'test',
32
+ :provides => [ 'foo' ],
33
+ )
34
+ executor.execute_on([item])
35
+ expect(executor.commands[0]).to eq(
36
+ Packager::Struct::Command.new({
37
+ :name => 'foo',
38
+ :version => '0.0.1',
39
+ :source => 'empty',
40
+ :target => 'test',
41
+ :provides => [ 'foo' ],
42
+ })
43
+ )
44
+ end
45
+ end
46
+ end
@@ -1,25 +1,25 @@
1
- describe Packager::Executor do
2
- class Packager::Struct::TestCommand < Packager::Struct.new(:command)
3
- def to_system
4
- command
5
- end
6
- end
7
-
8
- context "#execute_command" do
9
- it "handles errors" do
10
- cmd = Packager::Struct::TestCommand.new(
11
- :command => ["echo '{:error=>\"foo\"}'"]
12
- )
13
- expect {
14
- subject.execute_command(cmd)
15
- }.to raise_error('foo')
16
- end
17
-
18
- it "handles success" do
19
- cmd = Packager::Struct::TestCommand.new(
20
- :command => ["echo '{:path=>\"foo\"}'"]
21
- )
22
- expect(subject.execute_command(cmd)).to eq('foo')
23
- end
24
- end
25
- end
1
+ describe Packager::Executor do
2
+ class Packager::Struct::TestCommand < Packager::Struct.new(:command)
3
+ def to_system
4
+ command
5
+ end
6
+ end
7
+
8
+ context "#execute_command" do
9
+ it "handles errors" do
10
+ cmd = Packager::Struct::TestCommand.new(
11
+ :command => ["echo '{:error=>\"foo\"}'"]
12
+ )
13
+ expect {
14
+ subject.execute_command(cmd)
15
+ }.to raise_error('foo')
16
+ end
17
+
18
+ it "handles success" do
19
+ cmd = Packager::Struct::TestCommand.new(
20
+ :command => ["echo '{:path=>\"foo\"}'"]
21
+ )
22
+ expect(subject.execute_command(cmd)).to eq('foo')
23
+ end
24
+ end
25
+ end
@@ -1,33 +1,33 @@
1
- require './spec/executor/context.rb'
2
- require './spec/shared_context/workdir.rb'
3
- describe Packager::Executor do
4
- include_context :executor
5
- include_context :workdir
6
-
7
- it "creates a package with one file" do
8
- FileUtils.chdir(sourcedir) do
9
- FileUtils.touch('file1')
10
- end
11
-
12
- item = Packager::Struct::Package.new(
13
- :name => 'foo',
14
- :version => '0.0.1',
15
- :type => 'test',
16
- :files => [
17
- Packager::Struct::File.new(File.join(sourcedir, 'file1'), '/bar/file2'),
18
- ]
19
- )
20
- FileUtils.chdir(workdir) do
21
- executor.execute_on([item])
22
- end
23
- expect(executor.commands[0]).to eq(
24
- Packager::Struct::Command.new({
25
- :name => 'foo',
26
- :version => '0.0.1',
27
- :source => 'dir',
28
- :target => 'test',
29
- :directories => { 'bar' => true },
30
- })
31
- )
32
- end
33
- end
1
+ require './spec/executor/context.rb'
2
+ require './spec/shared_context/workdir.rb'
3
+ describe Packager::Executor do
4
+ include_context :executor
5
+ include_context :workdir
6
+
7
+ it "creates a package with one file" do
8
+ FileUtils.chdir(sourcedir) do
9
+ FileUtils.touch('file1')
10
+ end
11
+
12
+ item = Packager::Struct::Package.new(
13
+ :name => 'foo',
14
+ :version => '0.0.1',
15
+ :type => 'test',
16
+ :files => [
17
+ Packager::Struct::File.new(File.join(sourcedir, 'file1'), '/bar/file2'),
18
+ ]
19
+ )
20
+ FileUtils.chdir(workdir) do
21
+ executor.execute_on([item])
22
+ end
23
+ expect(executor.commands[0]).to eq(
24
+ Packager::Struct::Command.new({
25
+ :name => 'foo',
26
+ :version => '0.0.1',
27
+ :source => 'dir',
28
+ :target => 'test',
29
+ :directories => { 'bar' => true },
30
+ })
31
+ )
32
+ end
33
+ end
@@ -1,98 +1,98 @@
1
- # Q.V. the initial comment in spec/integration/files_spec.rb
2
- #
3
- # Missing features:
4
- # * dependencies
5
- # * before/after scripts
6
-
7
- require 'tempfile'
8
-
9
- require './spec/integration/context.rb'
10
- require './spec/shared_context/workdir.rb'
11
- describe 'FPM::Package::Test' do
12
- include_context :workdir
13
- include_context :test_package
14
-
15
- # This is to get access to the 'test' FPM type in the FPM executable.
16
- before(:all) {
17
- includedir = File.join(@dir,'spec/lib')
18
- @fpm = "ruby -I#{includedir} -rfpm/package/test `which fpm`"
19
- }
20
-
21
- # FIXME: 2>/dev/null is to suppress a Gem::Specification complaint about JSON.
22
- # After 'bundle install', Ruby 2.2 has JSON 1.8.3 and 1.8.1 (default) installed
23
- # and something gets confused because both are sufficient for JSON >= 1.7.7
24
- # You can disable it by setting the envvar VERBOSE=1
25
- def execute(cmd)
26
- cmd.unshift @fpm
27
- cmd.push '2>/dev/null' unless ENV['VERBOSE'] && ENV['VERBOSE'] != '0'
28
- return eval `#{cmd.join(' ')}`#
29
- end
30
-
31
- it "creates an empty package" do
32
- execute([
33
- '--name foo',
34
- '--version 0.0.1',
35
- '-s empty',
36
- '-t test',
37
- ])
38
-
39
- verify_test_package('foo.test', {
40
- 'name' => 'foo',
41
- 'version' => '0.0.1',
42
- })
43
- end
44
-
45
- it "creates an empty package with dependencies" do
46
- execute([
47
- '--name foo',
48
- '--version 0.0.2',
49
- '--depends baz',
50
- '--depends bar',
51
- '-s empty',
52
- '-t test',
53
- ])
54
-
55
- verify_test_package('foo.test', {
56
- 'name' => 'foo',
57
- 'version' => '0.0.2',
58
- 'requires' => [ 'bar', 'baz' ],
59
- })
60
- end
61
-
62
- it "creates an empty package with provides" do
63
- execute([
64
- '--name foo',
65
- '--version 0.0.2',
66
- '--provides baz',
67
- '--provides bar',
68
- '-s empty',
69
- '-t test',
70
- ])
71
-
72
- verify_test_package('foo.test', {
73
- 'name' => 'foo',
74
- 'version' => '0.0.2',
75
- 'provides' => [ 'bar', 'baz' ],
76
- })
77
- end
78
-
79
-
80
- it "creates a package with files" do
81
- append_to_file('foo', 'stuff')
82
-
83
- execute([
84
- '--name foo',
85
- '--version 0.0.1',
86
- '-s dir',
87
- '-t test',
88
- 'foo'
89
- ])
90
-
91
- verify_test_package('foo.test', {
92
- 'name' => 'foo',
93
- 'version' => '0.0.1',
94
- }, {
95
- 'foo' => 'stuff',
96
- })
97
- end
98
- end
1
+ # Q.V. the initial comment in spec/integration/files_spec.rb
2
+ #
3
+ # Missing features:
4
+ # * dependencies
5
+ # * before/after scripts
6
+
7
+ require 'tempfile'
8
+
9
+ require './spec/integration/context.rb'
10
+ require './spec/shared_context/workdir.rb'
11
+ describe 'FPM::Package::Test' do
12
+ include_context :workdir
13
+ include_context :test_package
14
+
15
+ # This is to get access to the 'test' FPM type in the FPM executable.
16
+ before(:all) {
17
+ includedir = File.join(@dir,'spec/lib')
18
+ @fpm = "ruby -I#{includedir} -rfpm/package/test `which fpm`"
19
+ }
20
+
21
+ # FIXME: 2>/dev/null is to suppress a Gem::Specification complaint about JSON.
22
+ # After 'bundle install', Ruby 2.2 has JSON 1.8.3 and 1.8.1 (default) installed
23
+ # and something gets confused because both are sufficient for JSON >= 1.7.7
24
+ # You can disable it by setting the envvar VERBOSE=1
25
+ def execute(cmd)
26
+ cmd.unshift @fpm
27
+ cmd.push '2>/dev/null' unless ENV['VERBOSE'] && ENV['VERBOSE'] != '0'
28
+ return eval `#{cmd.join(' ')}`#
29
+ end
30
+
31
+ it "creates an empty package" do
32
+ execute([
33
+ '--name foo',
34
+ '--version 0.0.1',
35
+ '-s empty',
36
+ '-t test',
37
+ ])
38
+
39
+ verify_test_package('foo.test', {
40
+ 'name' => 'foo',
41
+ 'version' => '0.0.1',
42
+ })
43
+ end
44
+
45
+ it "creates an empty package with dependencies" do
46
+ execute([
47
+ '--name foo',
48
+ '--version 0.0.2',
49
+ '--depends baz',
50
+ '--depends bar',
51
+ '-s empty',
52
+ '-t test',
53
+ ])
54
+
55
+ verify_test_package('foo.test', {
56
+ 'name' => 'foo',
57
+ 'version' => '0.0.2',
58
+ 'requires' => [ 'bar', 'baz' ],
59
+ })
60
+ end
61
+
62
+ it "creates an empty package with provides" do
63
+ execute([
64
+ '--name foo',
65
+ '--version 0.0.2',
66
+ '--provides baz',
67
+ '--provides bar',
68
+ '-s empty',
69
+ '-t test',
70
+ ])
71
+
72
+ verify_test_package('foo.test', {
73
+ 'name' => 'foo',
74
+ 'version' => '0.0.2',
75
+ 'provides' => [ 'bar', 'baz' ],
76
+ })
77
+ end
78
+
79
+
80
+ it "creates a package with files" do
81
+ append_to_file('foo', 'stuff')
82
+
83
+ execute([
84
+ '--name foo',
85
+ '--version 0.0.1',
86
+ '-s dir',
87
+ '-t test',
88
+ 'foo'
89
+ ])
90
+
91
+ verify_test_package('foo.test', {
92
+ 'name' => 'foo',
93
+ 'version' => '0.0.1',
94
+ }, {
95
+ 'foo' => 'stuff',
96
+ })
97
+ end
98
+ end