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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d69bd0b76c1544df14fd10e1c784b66ad88eca61
4
- data.tar.gz: 96f8c19cec88808b2d24294e0ce9c0a1083a2990
3
+ metadata.gz: 5879afcde9bdcb15af3a1e7f184f6a6f970da13d
4
+ data.tar.gz: 8334ffcd146bb1dd3034fb8733e8cf0772b2654d
5
5
  SHA512:
6
- metadata.gz: 7be5522e7cb6cc150fee7be52291cb29ddabc557af5e2e87b4c0416018ef9ba99f9a4e182f76038c79c99dff899cd161fab5247f9bd94f5b556eb6ed90efdfbc
7
- data.tar.gz: 4dffdc8d6e54cb63b9a1d0e58784720a056a7383a451f1db30900a7e5a7177311f0486cec4ce992d4798105194b44b07b3a9eba6e18a7e18b7482fa03a679f30
6
+ metadata.gz: 3c9bd07cc8289ecbc106f4c766cf40732da829e7fcf1c3bda42f228f1e3f495c2690eb6b1aad69895ce85c1bfa31076b42789ffc9455a2c5dd85c87b59928969
7
+ data.tar.gz: 88eb7463a3f55bf40bab5d3c7c7f615b3622f4dfa40f3711751331661d098a039169ffb015f30b6954d54225d7cd0d20605d0b678167df7ebc14e9efd65365e9
data/.rubocop.yml CHANGED
@@ -17,7 +17,7 @@ HashSyntax:
17
17
  EnforcedStyle: hash_rockets
18
18
  LineLength:
19
19
  Enabled: false
20
- SingleSpaceBeforeFirstArg:
20
+ SpaceBeforeFirstArg:
21
21
  Enabled: false
22
22
  StringLiterals:
23
23
  Enabled: false
data/.travis.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  language: ruby
2
2
 
3
- rvm: 2.1
3
+ sudo: false
4
+
5
+ rvm: 2.3.1
4
6
 
5
7
  script: bundle exec rake test
6
8
 
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.24.1"
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,10 @@
1
+ This demo shows how to use buildtasks and Docker for package building.
2
+
3
+ ```sh
4
+ $ docker-compose build
5
+ $ docker-compose run demo1
6
+ $ docker-compose run demo2
7
+ $ ls -1 pkg/
8
+ periodicnoise_1.1_amd64.deb
9
+ python-pytrac_0.4_all.deb
10
+ ```
@@ -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
@@ -0,0 +1,7 @@
1
+ require "buildtasks"
2
+
3
+ BuildTasks::GitBuildpackage.define do
4
+ name "periodicnoise"
5
+ version "debian/1.2"
6
+ source "https://github.com/Jimdo/periodicnoise"
7
+ end
@@ -0,0 +1,3 @@
1
+ require "buildtasks"
2
+
3
+ BuildTasks::FPMCookery.define
@@ -0,0 +1,8 @@
1
+ class PythonPytrac < FPM::Cookery::PythonRecipe
2
+ homepage "https://github.com/Jimdo/pytrac"
3
+ name "pytrac"
4
+ maintainer "Daniel Bonkowski <bonko@jimdo.com>"
5
+ build_depends ["python-setuptools"]
6
+ depends ["python"]
7
+ version "0.4"
8
+ end
@@ -21,7 +21,7 @@ module BuildTasks
21
21
 
22
22
  def validate_attributes
23
23
  unless File.exist?(recipe)
24
- fail InvalidAttributeError, "recipe file '#{recipe}' not found"
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
- fail "PUBLISH_DIR variable not set in environment" unless publish_dir
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
- fail MissingAttributeError, "name" unless name
31
- fail MissingAttributeError, "version" unless version
32
- fail MissingAttributeError, "source" unless source
30
+ raise MissingAttributeError, "name" unless name
31
+ raise MissingAttributeError, "version" unless version
32
+ raise MissingAttributeError, "source" unless source
33
33
 
34
- patches.each { |p| fail Errno::ENOENT, p unless File.exist?(abspath(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
- fail Errno::ENOENT, control_file unless File.exist?(control_file)
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
- fail "PUBLISH_DIR variable not set in environment" unless publish_dir
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.gsub("/", "-")}"
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
- fail ArgumentError, "#{symbol} must be of kind #{kinds}"
7
+ raise ArgumentError, "#{symbol} must be of kind #{kinds}"
8
8
  end
9
9
  end
10
10
 
@@ -2,7 +2,7 @@ module BuildTasks
2
2
  module Mixins
3
3
  module Tasks
4
4
  def sudo(cmd)
5
- return cmd if Process.uid == 0
5
+ return cmd if Process.uid.zero?
6
6
  "sudo " + cmd
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module BuildTasks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3".freeze
3
3
  end
@@ -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.25.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? "build").to be_truthy
23
- expect(Rake::Task.task_defined? "publish").to be_truthy
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? "build").to be_truthy
18
- expect(Rake::Task.task_defined? "publish").to be_truthy
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
@@ -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 => Fixnum)
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])
@@ -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 "shutdown -fr").to eq "sudo shutdown -fr"
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 "shutdown -fr").to eq "shutdown -fr"
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.2
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: 2015-05-11 00:00:00.000000000 Z
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.24.1
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.24.1
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.2.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