buildtasks 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +3 -1
- data/buildtasks.gemspec +2 -2
- data/demo/Dockerfile +26 -0
- data/demo/README.md +10 -0
- data/demo/docker-compose.yml +15 -0
- data/demo/example1/Rakefile +7 -0
- data/demo/example2/Rakefile +3 -0
- data/demo/example2/recipe.rb +8 -0
- data/lib/buildtasks/fpm_cookery/tasks.rb +3 -3
- data/lib/buildtasks/git_buildpackage/tasks.rb +10 -10
- data/lib/buildtasks/mixins/dsl.rb +1 -1
- data/lib/buildtasks/mixins/tasks.rb +1 -1
- data/lib/buildtasks/version.rb +1 -1
- data/spec/fpm_cookery/dsl_spec.rb +1 -1
- data/spec/fpm_cookery/tasks_spec.rb +2 -2
- data/spec/git_buildpackage/tasks_spec.rb +2 -2
- data/spec/mixins/dsl_spec.rb +1 -1
- data/spec/mixins/tasks_spec.rb +2 -2
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5879afcde9bdcb15af3a1e7f184f6a6f970da13d
|
4
|
+
data.tar.gz: 8334ffcd146bb1dd3034fb8733e8cf0772b2654d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c9bd07cc8289ecbc106f4c766cf40732da829e7fcf1c3bda42f228f1e3f495c2690eb6b1aad69895ce85c1bfa31076b42789ffc9455a2c5dd85c87b59928969
|
7
|
+
data.tar.gz: 88eb7463a3f55bf40bab5d3c7c7f615b3622f4dfa40f3711751331661d098a039169ffb015f30b6954d54225d7cd0d20605d0b678167df7ebc14e9efd65365e9
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/buildtasks.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'buildtasks/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "buildtasks"
|
8
|
-
spec.version = BuildTasks::VERSION
|
8
|
+
spec.version = BuildTasks::VERSION.dup
|
9
9
|
spec.authors = ["Mathias Lafeldt"]
|
10
10
|
spec.email = ["mathias.lafeldt@jimdo.com"]
|
11
11
|
spec.summary = %q{Rake tasks to build Debian packages}
|
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rspec"
|
25
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
25
|
+
spec.add_development_dependency "rubocop", "~> 0.45.0"
|
26
26
|
end
|
data/demo/Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
FROM debian:jessie
|
2
|
+
|
3
|
+
ENV DEBIAN_FRONTEND noninteractive
|
4
|
+
RUN apt-get update && apt-get install -y \
|
5
|
+
build-essential \
|
6
|
+
curl \
|
7
|
+
devscripts \
|
8
|
+
equivs \
|
9
|
+
git-buildpackage \
|
10
|
+
git \
|
11
|
+
lsb-release \
|
12
|
+
make \
|
13
|
+
openssh-client \
|
14
|
+
pristine-tar \
|
15
|
+
rake \
|
16
|
+
rsync \
|
17
|
+
ruby \
|
18
|
+
ruby-dev \
|
19
|
+
rubygems \
|
20
|
+
wget
|
21
|
+
|
22
|
+
RUN echo "gem: --no-ri --no-rdoc" >/etc/gemrc
|
23
|
+
RUN gem install fpm -v 1.4.0
|
24
|
+
RUN gem install fpm-cookery -v 0.29.0
|
25
|
+
RUN gem install buildtasks -v 0.0.1
|
26
|
+
RUN gem install bundler -v 1.10.0
|
data/demo/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
demo1:
|
2
|
+
build: .
|
3
|
+
command: rake build publish PUBLISH_DIR=/pkg
|
4
|
+
volumes:
|
5
|
+
- example1:/data
|
6
|
+
- pkg:/pkg
|
7
|
+
working_dir: /data
|
8
|
+
|
9
|
+
demo2:
|
10
|
+
build: .
|
11
|
+
command: rake build publish PUBLISH_DIR=/pkg
|
12
|
+
volumes:
|
13
|
+
- example2:/data
|
14
|
+
- pkg:/pkg
|
15
|
+
working_dir: /data
|
@@ -21,7 +21,7 @@ module BuildTasks
|
|
21
21
|
|
22
22
|
def validate_attributes
|
23
23
|
unless File.exist?(recipe)
|
24
|
-
|
24
|
+
raise InvalidAttributeError, "recipe file '#{recipe}' not found"
|
25
25
|
end
|
26
26
|
|
27
27
|
if File.exist?("Gemfile")
|
@@ -29,7 +29,7 @@ module BuildTasks
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def define_tasks # rubocop:disable MethodLength
|
32
|
+
def define_tasks # rubocop:disable MethodLength,AbcSize
|
33
33
|
task :default => :build
|
34
34
|
|
35
35
|
file "Gemfile" do |t|
|
@@ -49,7 +49,7 @@ module BuildTasks
|
|
49
49
|
desc "Publish built packages"
|
50
50
|
task :publish => :build do
|
51
51
|
publish_dir = ENV["PUBLISH_DIR"]
|
52
|
-
|
52
|
+
raise "PUBLISH_DIR variable not set in environment" unless publish_dir
|
53
53
|
|
54
54
|
mkdir_p publish_dir
|
55
55
|
cp Dir["pkg/*.deb"], publish_dir
|
@@ -6,7 +6,7 @@ require "forwardable"
|
|
6
6
|
module BuildTasks
|
7
7
|
module GitBuildpackage
|
8
8
|
class Tasks < ::Rake::TaskLib
|
9
|
-
BUILD_CMD = 'debuild -i\.git -I.git -uc -us -b'
|
9
|
+
BUILD_CMD = 'debuild -i\.git -I.git -uc -us -b'.freeze
|
10
10
|
|
11
11
|
include BuildTasks::Mixins::Tasks
|
12
12
|
|
@@ -27,14 +27,14 @@ module BuildTasks
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def validate_attributes
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
raise MissingAttributeError, "name" unless name
|
31
|
+
raise MissingAttributeError, "version" unless version
|
32
|
+
raise MissingAttributeError, "source" unless source
|
33
33
|
|
34
|
-
patches.each { |p|
|
34
|
+
patches.each { |p| raise Errno::ENOENT, p unless File.exist?(abspath(p)) }
|
35
35
|
end
|
36
36
|
|
37
|
-
def update_changelog # rubocop:disable MethodLength
|
37
|
+
def update_changelog # rubocop:disable MethodLength,AbcSize
|
38
38
|
return unless changelog
|
39
39
|
|
40
40
|
text = changelog[:text]
|
@@ -50,7 +50,7 @@ module BuildTasks
|
|
50
50
|
sh "dch", "--no-auto-nmu", *args
|
51
51
|
end
|
52
52
|
|
53
|
-
def define_tasks # rubocop:disable MethodLength
|
53
|
+
def define_tasks # rubocop:disable MethodLength,AbcSize
|
54
54
|
task :default => :build
|
55
55
|
|
56
56
|
file git_dir do |t|
|
@@ -77,7 +77,7 @@ module BuildTasks
|
|
77
77
|
task :deps => :patch do
|
78
78
|
in_git_dir do
|
79
79
|
control_file = "debian/control"
|
80
|
-
|
80
|
+
raise Errno::ENOENT, control_file unless File.exist?(control_file)
|
81
81
|
env = "DEBIAN_FRONTEND=noninteractive"
|
82
82
|
sh sudo("#{env} mk-build-deps -i -r -t 'apt-get -y' #{control_file}")
|
83
83
|
end
|
@@ -95,7 +95,7 @@ module BuildTasks
|
|
95
95
|
desc "Publish built packages"
|
96
96
|
task :publish => :build do
|
97
97
|
publish_dir = ENV["PUBLISH_DIR"]
|
98
|
-
|
98
|
+
raise "PUBLISH_DIR variable not set in environment" unless publish_dir
|
99
99
|
|
100
100
|
mkdir_p publish_dir
|
101
101
|
cp Dir["*.deb"], publish_dir
|
@@ -109,7 +109,7 @@ module BuildTasks
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def git_dir
|
112
|
-
"git-#{version.to_s.
|
112
|
+
"git-#{version.to_s.tr('/', '-')}"
|
113
113
|
end
|
114
114
|
|
115
115
|
def in_git_dir
|
@@ -4,7 +4,7 @@ module BuildTasks
|
|
4
4
|
def _validate(symbol, arg, validation)
|
5
5
|
kinds = Array(validation.fetch(:kind_of))
|
6
6
|
unless kinds.any? { |k| arg.is_a?(k) }
|
7
|
-
|
7
|
+
raise ArgumentError, "#{symbol} must be of kind #{kinds}"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
data/lib/buildtasks/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe BuildTasks::FPMCookery::DSL do
|
|
5
5
|
|
6
6
|
it "initializes attributes" do
|
7
7
|
expect(subject.recipe).to eq "recipe.rb"
|
8
|
-
expect(subject.fpm_cookery_version).to eq "~> 0.
|
8
|
+
expect(subject.fpm_cookery_version).to eq "~> 0.27.0"
|
9
9
|
expect(subject.fpm_version).to eq "~> 1.3.3"
|
10
10
|
end
|
11
11
|
|
@@ -19,8 +19,8 @@ describe BuildTasks::FPMCookery::Tasks do
|
|
19
19
|
allow(File).to receive(:exist?).with("Gemfile").and_return(false)
|
20
20
|
|
21
21
|
BuildTasks::FPMCookery::Tasks.new(attributes)
|
22
|
-
expect(Rake::Task.task_defined?
|
23
|
-
expect(Rake::Task.task_defined?
|
22
|
+
expect(Rake::Task.task_defined?("build")).to be_truthy
|
23
|
+
expect(Rake::Task.task_defined?("publish")).to be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it "creates Gemfile to define gem dependencies" do
|
@@ -14,7 +14,7 @@ describe BuildTasks::GitBuildpackage::Tasks do
|
|
14
14
|
)
|
15
15
|
|
16
16
|
BuildTasks::GitBuildpackage::Tasks.new(attributes)
|
17
|
-
expect(Rake::Task.task_defined?
|
18
|
-
expect(Rake::Task.task_defined?
|
17
|
+
expect(Rake::Task.task_defined?("build")).to be_truthy
|
18
|
+
expect(Rake::Task.task_defined?("publish")).to be_truthy
|
19
19
|
end
|
20
20
|
end
|
data/spec/mixins/dsl_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe BuildTasks::Mixins::DSL do
|
|
32
32
|
expect do
|
33
33
|
c.set_or_return(:some_attribute, "some-value", :kind_of => String)
|
34
34
|
c.set_or_return(:some_attribute, :some_value, :kind_of => Symbol)
|
35
|
-
c.set_or_return(:some_attribute, 1234, :kind_of =>
|
35
|
+
c.set_or_return(:some_attribute, 1234, :kind_of => Integer)
|
36
36
|
c.set_or_return(:some_attribute, true, :kind_of => TrueClass)
|
37
37
|
c.set_or_return(:some_attribute, false, :kind_of => FalseClass)
|
38
38
|
c.set_or_return(:some_attribute, 1, :kind_of => [TrueClass, Integer])
|
data/spec/mixins/tasks_spec.rb
CHANGED
@@ -10,12 +10,12 @@ describe BuildTasks::Mixins::Tasks do
|
|
10
10
|
describe "#sudo" do
|
11
11
|
it "runs command via sudo if not root" do
|
12
12
|
allow(Process).to receive(:uid).and_return 1000
|
13
|
-
expect(c.sudo
|
13
|
+
expect(c.sudo("shutdown -fr")).to eq "sudo shutdown -fr"
|
14
14
|
end
|
15
15
|
|
16
16
|
it "runs command as-is if already root" do
|
17
17
|
allow(Process).to receive(:uid).and_return 0
|
18
|
-
expect(c.sudo
|
18
|
+
expect(c.sudo("shutdown -fr")).to eq "shutdown -fr"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildtasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Lafeldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.45.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.45.0
|
69
69
|
description: Rake tasks to build Debian packages
|
70
70
|
email:
|
71
71
|
- mathias.lafeldt@jimdo.com
|
@@ -81,6 +81,12 @@ files:
|
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
83
|
- buildtasks.gemspec
|
84
|
+
- demo/Dockerfile
|
85
|
+
- demo/README.md
|
86
|
+
- demo/docker-compose.yml
|
87
|
+
- demo/example1/Rakefile
|
88
|
+
- demo/example2/Rakefile
|
89
|
+
- demo/example2/recipe.rb
|
84
90
|
- lib/buildtasks.rb
|
85
91
|
- lib/buildtasks/exceptions.rb
|
86
92
|
- lib/buildtasks/fpm_cookery.rb
|
@@ -118,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
124
|
version: '0'
|
119
125
|
requirements: []
|
120
126
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.5.1
|
122
128
|
signing_key:
|
123
129
|
specification_version: 4
|
124
130
|
summary: Rake tasks to build Debian packages
|