thor-package 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/README.md +3 -0
- data/Rakefile +10 -0
- data/Thorfile +38 -0
- data/bin/scmversion +6 -0
- data/lib/thor-package.rb +61 -0
- data/lib/thor-package/version.rb +3 -0
- data/lib/thor/package.rb +1 -0
- data/thor-package.gemspec +26 -0
- metadata +146 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2012, Riot Games, Inc.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/Thorfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'thor'
|
3
|
+
require 'thor/scmversion'
|
4
|
+
require 'thor/package'
|
5
|
+
|
6
|
+
::SOURCE_ROOT = File.dirname(__FILE__)
|
7
|
+
::APPLICATION_NAME = "thor-package"
|
8
|
+
|
9
|
+
class ThorPackageProject < Thor
|
10
|
+
PROJECT_NAME = "thor-package"
|
11
|
+
namespace PROJECT_NAME
|
12
|
+
|
13
|
+
desc "build", "Build the gem"
|
14
|
+
def build
|
15
|
+
system("gem build -V '#{PROJECT_NAME}.gemspec'")
|
16
|
+
FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'pkg'))
|
17
|
+
FileUtils.mv("#{PROJECT_NAME}-#{current_version}.gem", 'pkg')
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "install", "Build and install latest to system gems"
|
21
|
+
def install
|
22
|
+
invoke "build", []
|
23
|
+
system("gem install pkg/#{PROJECT_NAME}-#{current_version}.gem")
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "release [TYPE]", "Bump version, make a build, and push to Rubygems"
|
27
|
+
def release(type='auto')
|
28
|
+
@current_version = nil
|
29
|
+
invoke "version:bump", [type]
|
30
|
+
invoke "build", []
|
31
|
+
system("gem push pkg/#{PROJECT_NAME}-#{current_version}.gem")
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def current_version
|
36
|
+
@current_version ||= ::ThorSCMVersion.versioner.from_path
|
37
|
+
end
|
38
|
+
end
|
data/bin/scmversion
ADDED
data/lib/thor-package.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'thor/actions'
|
2
|
+
|
3
|
+
module ThorPackage
|
4
|
+
class Tasks < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
namespace "package"
|
8
|
+
|
9
|
+
desc "build", "Build a tar from the files tracked by git"
|
10
|
+
def build
|
11
|
+
cleanup
|
12
|
+
run "git archive --format=tar -o #{pkg_path}/tarfile HEAD"
|
13
|
+
run "tar rf #{pkg_path}/tarfile VERSION" # Stick VERSION in the tar
|
14
|
+
run "gzip -9 #{pkg_path}/tarfile"
|
15
|
+
FileUtils.mv "#{pkg_path}/tarfile.gz", artifact_path
|
16
|
+
say "Built #{artifact_path}"
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
no_tasks do
|
21
|
+
def cleanup
|
22
|
+
FileUtils.rm_r(pkg_path, :force => true)
|
23
|
+
FileUtils.mkdir_p pkg_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def source_root
|
27
|
+
if defined?(::SOURCE_ROOT)
|
28
|
+
::SOURCE_ROOT
|
29
|
+
else
|
30
|
+
warn "::SOURCE_ROOT must be set to provide the path to the root of the source being packaged."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def pkg_path
|
35
|
+
File.join(source_root, 'pkg')
|
36
|
+
end
|
37
|
+
|
38
|
+
def artifact_path
|
39
|
+
File.join(pkg_path, artifact_filename)
|
40
|
+
end
|
41
|
+
|
42
|
+
def artifact_filename
|
43
|
+
"#{application_name}-#{current_version}.tar.gz"
|
44
|
+
end
|
45
|
+
|
46
|
+
def current_version
|
47
|
+
invoke "version:current"
|
48
|
+
File.read(File.join(source_root, "VERSION")).chomp
|
49
|
+
end
|
50
|
+
|
51
|
+
def application_name
|
52
|
+
if defined?(::APPLICATION_NAME)
|
53
|
+
::APPLICATION_NAME
|
54
|
+
else
|
55
|
+
warn "::APPLICATION_NAME should be set to the name of your application. Using 'application_name' for now."
|
56
|
+
"application_name"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/thor/package.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'thor-package'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/thor-package/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Josiah Kiehl"]
|
6
|
+
gem.email = ["josiah@skirmisher.net"]
|
7
|
+
gem.description = %q{Thor tasks to package a project}
|
8
|
+
gem.summary = %q{Set of tasks to assist in making packages from a git controlled project.}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "thor-package"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = ThorPackage::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'thor'
|
19
|
+
gem.add_development_dependency 'thor-scmversion'
|
20
|
+
gem.add_development_dependency 'webmock'
|
21
|
+
gem.add_development_dependency 'spork'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'vcr'
|
24
|
+
gem.add_development_dependency 'aruba'
|
25
|
+
gem.add_development_dependency 'rspec'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thor-package
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Josiah Kiehl
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: &70195708523500 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70195708523500
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor-scmversion
|
27
|
+
requirement: &70195708522800 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70195708522800
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: webmock
|
38
|
+
requirement: &70195708522000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70195708522000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: spork
|
49
|
+
requirement: &70195708521100 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70195708521100
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &70195708520200 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70195708520200
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: &70195708538940 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70195708538940
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: aruba
|
82
|
+
requirement: &70195708538400 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70195708538400
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rspec
|
93
|
+
requirement: &70195708537980 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70195708537980
|
102
|
+
description: Thor tasks to package a project
|
103
|
+
email:
|
104
|
+
- josiah@skirmisher.net
|
105
|
+
executables:
|
106
|
+
- scmversion
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- .gitignore
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- Thorfile
|
116
|
+
- bin/scmversion
|
117
|
+
- lib/thor-package.rb
|
118
|
+
- lib/thor-package/version.rb
|
119
|
+
- lib/thor/package.rb
|
120
|
+
- thor-package.gemspec
|
121
|
+
homepage: ''
|
122
|
+
licenses: []
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 1.8.11
|
142
|
+
signing_key:
|
143
|
+
specification_version: 3
|
144
|
+
summary: Set of tasks to assist in making packages from a git controlled project.
|
145
|
+
test_files: []
|
146
|
+
has_rdoc:
|