architects-toolkit 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 990cca038b4838ad7ffdf6149d2dc3b4df308909
4
+ data.tar.gz: e82916b93553242a06c4a66a7140c8cda2061976
5
+ SHA512:
6
+ metadata.gz: 53c24dd38b139c544f2ee58a14e4b735d87bd04e961b297e16b2ee17a394222204c234fe82127856cf31545af3c196258405d2757b12ac7b48bd0530649ca4b4
7
+ data.tar.gz: f6cac11ca0465f685040db1da620944e4d2aed167c731ed23a79b6ec589e741f2aaa899d04675a40916fad90b9f40de52709efa13a301bc5f101717fc93431f0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ distro/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in architects-toolkit.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,190 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ architects-toolkit (0.1.5)
5
+ brief (>= 1.9.0)
6
+ datapimp (>= 1.0.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.2.1)
12
+ i18n (~> 0.7)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
16
+ tzinfo (~> 1.1)
17
+ addressable (2.3.8)
18
+ autoparse (0.3.3)
19
+ addressable (>= 2.3.1)
20
+ extlib (>= 0.9.15)
21
+ multi_json (>= 1.0.0)
22
+ axiom-types (0.1.1)
23
+ descendants_tracker (~> 0.0.4)
24
+ ice_nine (~> 0.11.0)
25
+ thread_safe (~> 0.3, >= 0.3.1)
26
+ axlsx (2.0.1)
27
+ htmlentities (~> 4.3.1)
28
+ nokogiri (>= 1.4.1)
29
+ rubyzip (~> 1.0.0)
30
+ brief (1.9.1)
31
+ activesupport (>= 4.0)
32
+ commander (>= 4.2.1)
33
+ github-fs
34
+ github-markdown (~> 0.6.8)
35
+ hashie (< 3.0)
36
+ inflecto
37
+ nokogiri (= 1.6.5)
38
+ virtus (>= 1.0.3)
39
+ builder (3.2.2)
40
+ coderay (1.1.0)
41
+ coercible (1.0.0)
42
+ descendants_tracker (~> 0.0.1)
43
+ colored (1.2)
44
+ commander (4.3.1)
45
+ highline (~> 1.7.1)
46
+ datapimp (1.0.2)
47
+ activesupport (>= 4.0.0)
48
+ axlsx
49
+ colored
50
+ commander
51
+ dnsimple-ruby
52
+ dropbox-api (>= 0.4.6)
53
+ fog-aws
54
+ github-fs
55
+ google_drive
56
+ hashie (< 3.0)
57
+ launchy
58
+ nokogiri (= 1.6.5)
59
+ oauth (~> 0.4.7)
60
+ octokit (>= 3.0.0)
61
+ pry
62
+ rack-contrib
63
+ rack-proxy
64
+ uri_template
65
+ descendants_tracker (0.0.4)
66
+ thread_safe (~> 0.3, >= 0.3.1)
67
+ dnsimple-ruby (1.7.1)
68
+ httparty (~> 0.12)
69
+ dropbox-api (0.4.6)
70
+ hashie (~> 2.0.5)
71
+ multi_json (~> 1.7.9)
72
+ oauth (~> 0.4.7)
73
+ equalizer (0.0.11)
74
+ excon (0.45.1)
75
+ extlib (0.9.16)
76
+ faraday (0.9.1)
77
+ multipart-post (>= 1.2, < 3)
78
+ fog-aws (0.1.1)
79
+ fog-core (~> 1.27)
80
+ fog-json (~> 1.0)
81
+ fog-xml (~> 0.1)
82
+ ipaddress (~> 0.8)
83
+ fog-core (1.29.0)
84
+ builder
85
+ excon (~> 0.38)
86
+ formatador (~> 0.2)
87
+ mime-types
88
+ net-scp (~> 1.1)
89
+ net-ssh (>= 2.1.3)
90
+ fog-json (1.0.0)
91
+ multi_json (~> 1.0)
92
+ fog-xml (0.1.1)
93
+ fog-core
94
+ nokogiri (~> 1.5, >= 1.5.11)
95
+ formatador (0.2.5)
96
+ github-fs (0.0.1)
97
+ activesupport (> 3.2.0)
98
+ octokit
99
+ rack
100
+ github-markdown (0.6.8)
101
+ google-api-client (0.7.1)
102
+ addressable (>= 2.3.2)
103
+ autoparse (>= 0.3.3)
104
+ extlib (>= 0.9.15)
105
+ faraday (>= 0.9.0)
106
+ jwt (>= 0.1.5)
107
+ launchy (>= 2.1.1)
108
+ multi_json (>= 1.0.0)
109
+ retriable (>= 1.4)
110
+ signet (>= 0.5.0)
111
+ uuidtools (>= 2.1.0)
112
+ google_drive (1.0.0)
113
+ google-api-client (>= 0.7.0)
114
+ nokogiri (>= 1.4.4, != 1.5.2, != 1.5.1)
115
+ oauth (>= 0.3.6)
116
+ oauth2 (>= 0.5.0)
117
+ hashie (2.0.5)
118
+ highline (1.7.1)
119
+ htmlentities (4.3.3)
120
+ httparty (0.13.3)
121
+ json (~> 1.8)
122
+ multi_xml (>= 0.5.2)
123
+ i18n (0.7.0)
124
+ ice_nine (0.11.1)
125
+ inflecto (0.0.2)
126
+ ipaddress (0.8.0)
127
+ json (1.8.2)
128
+ jwt (1.4.1)
129
+ launchy (2.4.3)
130
+ addressable (~> 2.3)
131
+ method_source (0.8.2)
132
+ mime-types (2.4.3)
133
+ mini_portile (0.6.2)
134
+ minitest (5.5.1)
135
+ multi_json (1.7.9)
136
+ multi_xml (0.5.5)
137
+ multipart-post (2.0.0)
138
+ net-scp (1.2.1)
139
+ net-ssh (>= 2.6.5)
140
+ net-ssh (2.9.2)
141
+ nokogiri (1.6.5)
142
+ mini_portile (~> 0.6.0)
143
+ oauth (0.4.7)
144
+ oauth2 (1.0.0)
145
+ faraday (>= 0.8, < 0.10)
146
+ jwt (~> 1.0)
147
+ multi_json (~> 1.3)
148
+ multi_xml (~> 0.5)
149
+ rack (~> 1.2)
150
+ octokit (3.8.0)
151
+ sawyer (~> 0.6.0, >= 0.5.3)
152
+ pry (0.10.1)
153
+ coderay (~> 1.1.0)
154
+ method_source (~> 0.8.1)
155
+ slop (~> 3.4)
156
+ rack (1.6.0)
157
+ rack-contrib (1.2.0)
158
+ rack (>= 0.9.1)
159
+ rack-proxy (0.5.17)
160
+ rack
161
+ rake (10.4.2)
162
+ retriable (2.0.2)
163
+ rubyzip (1.0.0)
164
+ sawyer (0.6.0)
165
+ addressable (~> 2.3.5)
166
+ faraday (~> 0.8, < 0.10)
167
+ signet (0.5.1)
168
+ addressable (>= 2.2.3)
169
+ faraday (>= 0.9.0.rc5)
170
+ jwt (>= 0.1.5)
171
+ multi_json (>= 1.0.0)
172
+ slop (3.6.0)
173
+ thread_safe (0.3.5)
174
+ tzinfo (1.2.2)
175
+ thread_safe (~> 0.1)
176
+ uri_template (0.7.0)
177
+ uuidtools (2.1.5)
178
+ virtus (1.0.5)
179
+ axiom-types (~> 0.1)
180
+ coercible (~> 1.0)
181
+ descendants_tracker (~> 0.0, >= 0.0.3)
182
+ equalizer (~> 0.0, >= 0.0.9)
183
+
184
+ PLATFORMS
185
+ ruby
186
+
187
+ DEPENDENCIES
188
+ architects-toolkit!
189
+ bundler (~> 1.9)
190
+ rake (~> 10.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jonathan Soeder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Architects::Toolkit
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'architects-toolkit'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install architects-toolkit
18
+
19
+ ## Usage
20
+
21
+ The Architects Toolkit is a wrapper around a multitude of gems that we
22
+ use in development and design:
23
+
24
+ - brief (https://github.com/datapimp/brief)
25
+ - datapimp (https://github.com/datapimp/datapimp)
26
+
27
+ Any command you can run in either of these gems, will work here:
28
+
29
+ Run the help command to see available options:
30
+
31
+ ```
32
+ archi help
33
+ ```
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/[my-github-username]/architects-toolkit/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+ Dir[File.join(Dir.pwd, 'tasks', '*.rake')].each { |f| load f }
3
+
4
+ require "bundler/gem_tasks"
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ Distribution.configure do |config|
10
+ config.package_name = 'archi'
11
+ config.version = Architects::Toolkit::VERSION
12
+ config.rb_version = '20150210-2.1.5'
13
+ config.packaging_dir = File.expand_path 'packaging'
14
+ config.native_extensions = [
15
+ 'github-markdown-0.6.8',
16
+ 'escape_utils-1.0.1',
17
+ 'charlock_holmes-0.7.3',
18
+ 'posix-spawn-0.3.9',
19
+ 'nokogumbo-1.3.0',
20
+ 'rugged-0.21.4',
21
+ 'nokogiri-1.6.5'
22
+ ]
23
+ end
24
+
25
+ task :default => :spec
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'architects/toolkit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "architects-toolkit"
8
+ spec.version = Architects::Toolkit::VERSION
9
+ spec.authors = ["Jonathan Soeder"]
10
+ spec.email = ["jonathan.soeder@gmail.com"]
11
+
12
+ spec.description = %q{Packages up different CLI utilities for working with the Architects.io Blueprint, and ALM Platform}
13
+ spec.summary = %q{Packages up different CLI utilities for working with the Architects.io Blueprint, and ALM Platform}
14
+ spec.homepage = "https://architects.io/architects-toolkit"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ #if spec.respond_to?(:metadata)
23
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
24
+ #end
25
+
26
+ spec.add_dependency 'brief', '~> 1.9.2'
27
+ spec.add_dependency 'datapimp', '~> 1.0.2'
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.9"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ end
data/bin/archi ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "pathname"
5
+
6
+ $:.unshift Pathname(File.dirname(__FILE__)).join("..","lib")
7
+
8
+ # support for the traveling ruby env
9
+ ENV['BRIEF_PWD'] = ENV['DATAPIMP_PWD'] = ENV['ARCHI_PWD'] if ENV['ARCHI_PWD']
10
+
11
+ require "pry"
12
+ require 'colored'
13
+ require 'architects/toolkit'
14
+ require 'datapimp'
15
+ require 'datapimp/cli'
16
+ require 'brief'
17
+ require 'brief/dsl'
18
+
19
+ args = ARGV.to_a.dup
20
+
21
+ if args.shift.to_s.strip.downcase == "run"
22
+ require(args.first) if args.first
23
+
24
+ if args.empty?
25
+ code = STDIN.read
26
+
27
+ if code.length > 0
28
+ eval(code)
29
+ end
30
+ end
31
+ else
32
+ require "commander/import"
33
+
34
+ program :name, 'archit'
35
+ program :version, Architects::Toolkit::VERSION || "1.0.1"
36
+ program :description, 'architects toolkit for writing blueprints'
37
+
38
+ Datapimp::Cli.load_commands()
39
+ Brief.load_commands()
40
+ end
41
+
42
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "architects/toolkit"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ require "architects/toolkit/version"
2
+ require "brief"
3
+ require "datapimp"
4
+
5
+ module Architects
6
+ module Toolkit
7
+ # Your code goes here...
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Architects
2
+ module Toolkit
3
+ VERSION = "0.1.6"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+
3
+ export ARCHI_PWD=$PWD
4
+ export BRIEF_PWD=$PWD
5
+ export DATAPIMP_PWD=$PWD
6
+ set -e
7
+
8
+ TARGET_FILE=$0
9
+
10
+ cd `dirname $TARGET_FILE`
11
+ TARGET_FILE=`basename $TARGET_FILE`
12
+
13
+ # Iterate down a (possible) chain of symlinks
14
+ while [ -L "$TARGET_FILE" ]
15
+ do
16
+ TARGET_FILE=`readlink $TARGET_FILE`
17
+ cd `dirname $TARGET_FILE`
18
+ TARGET_FILE=`basename $TARGET_FILE`
19
+ done
20
+
21
+ # Compute the canonicalized name by finding the physical path
22
+ # for the directory we're in and appending the target file.
23
+ PHYS_DIR=`pwd -P`
24
+ RESULT=$PHYS_DIR/$TARGET_FILE
25
+
26
+ # Figure out where this script is located.
27
+ SELFDIR=$(dirname "$RESULT")
28
+
29
+ # Tell Bundler where the Gemfile and gems are.
30
+ export BUNDLE_GEMFILE="$SELFDIR/lib/app/Gemfile"
31
+ unset BUNDLE_IGNORE_CONFIG
32
+
33
+ # Run the actual app using the bundled Ruby interpreter.
34
+ exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/bin/archi" "$@"
@@ -0,0 +1,15 @@
1
+ module Distribution
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
5
+
6
+ def self.configure
7
+ self.configuration ||= Configuration.new
8
+ yield configuration
9
+ end
10
+
11
+ class Configuration
12
+ attr_accessor :package_name, :packaging_dir, :version, :rb_version,
13
+ :native_extensions
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+
3
+ module Distribution
4
+ class Executable
5
+ include PackageHelpers
6
+ extend Forwardable
7
+
8
+ attr_reader :package
9
+
10
+ def_delegators :@package, :dir, :package_name
11
+
12
+ def initialize(package)
13
+ @package = package
14
+ end
15
+
16
+ def self.create(package)
17
+ executable = new(package)
18
+ executable.copy_wrapper
19
+ executable
20
+ end
21
+
22
+ def copy_wrapper
23
+ print_to_console 'Creating exexutable...'
24
+
25
+ FileUtils.cp 'packaging/wrapper.sh', "#{dir}/#{package_name}"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,85 @@
1
+ require 'fileutils'
2
+ require 'forwardable'
3
+
4
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
5
+
6
+ module Distribution
7
+ class Package
8
+ extend Forwardable
9
+ include PackageHelpers
10
+
11
+ attr_reader :config, :dir, :tarball, :package, :arch, :root
12
+
13
+ def_delegators :@config, :version, :rb_version, :package_name,
14
+ :packaging_dir, :native_extensions
15
+
16
+ def initialize(arch)
17
+ abort 'Ruby 2.1.x required' if RUBY_VERSION !~ /^2\.1\./
18
+
19
+ @arch = arch
20
+ @config = ::Distribution.configuration
21
+ @dir = "#{package_name}-#{version}-#{arch}"
22
+ @package = self
23
+ @root = File.expand_path '.'
24
+ end
25
+
26
+ def self.create(args)
27
+ new(*args).build
28
+ end
29
+
30
+ def build
31
+ initialize_install_dir
32
+ copy_project
33
+ install_ruby_and_gems
34
+ create_executable
35
+ post_cleanup
36
+ @tarball = create_tarball
37
+ clean_dir
38
+ end
39
+
40
+ private
41
+
42
+ def clean_dir
43
+ FileUtils.cd root do
44
+ FileUtils.remove_dir(dir, true) if Dir.exist? dir
45
+ end
46
+ end
47
+
48
+ def post_cleanup
49
+ print_to_console 'Cleaning up...'
50
+
51
+ files = ["#{packaging_dir}/traveling-ruby-#{rb_version}-#{arch}.tar.gz"]
52
+
53
+ files.each { |file| FileUtils.rm file if File.exist? file }
54
+ end
55
+
56
+ def create_tarball
57
+ Tarball.new self
58
+ end
59
+
60
+ def create_executable
61
+ Executable.create self
62
+ end
63
+
64
+ def install_ruby_and_gems
65
+ TravellingRuby.install self
66
+ end
67
+
68
+ def initialize_install_dir
69
+ clean_dir
70
+
71
+ FileUtils.cd root do
72
+ FileUtils.mkdir_p "#{dir}/lib/app"
73
+ end
74
+ end
75
+
76
+ def copy_project
77
+ print_to_console 'Copying project...'
78
+
79
+ %w(architects-toolkit.gemspec Gemfile Gemfile.lock lib bin)
80
+ .each do |folder|
81
+ FileUtils.cp_r File.join(root, folder), "#{dir}/lib/app"
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,12 @@
1
+ module Distribution
2
+ module PackageHelpers
3
+ def curl(file)
4
+ system "curl -L -O --fail --silent #{file}"
5
+ end
6
+
7
+ def print_to_console(msg)
8
+ arch = package.arch
9
+ puts "[#{arch}]:" + ' ' * (16 - arch.size) + '=>' + ' ' + msg
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+
3
+ require 'digest'
4
+ require 'octokit'
5
+ require 'pathname'
6
+
7
+ module Distribution
8
+ class Release
9
+ extend Forwardable
10
+ include PackageHelpers
11
+
12
+ attr_reader :tarball, :github, :package
13
+
14
+ def_delegators :@tarball, :package, :version, :file
15
+
16
+ def initialize(tarball)
17
+ @tarball = tarball
18
+ @github = Octokit::Client.new access_token: ENV['OCTODOWN_TOKEN']
19
+ end
20
+
21
+ def self.create(tarball)
22
+ release = new(tarball)
23
+ release.create_new_release
24
+ end
25
+
26
+ def create_new_release
27
+ print_to_console 'Publishing release to GitHub...'
28
+ github.create_release(
29
+ 'architects/architects-toolkit',
30
+ "v#{version}",
31
+ name: "v#{version}",
32
+ body: ReleaseNotes.new.content
33
+ )
34
+ end
35
+
36
+ def upload_asset
37
+ print_to_console 'Uploading to GitHub...'
38
+ github.upload_asset find_upload_url, file
39
+ end
40
+
41
+ private
42
+
43
+ def find_upload_url
44
+ Octokit.releases('architects/architects-toolkit').find do |n|
45
+ n.tag_name == "v#{version}"
46
+ end[:url]
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,14 @@
1
+ # Brief <%= version %>
2
+
3
+ Cheers to another great release!
4
+
5
+ ## Contributors
6
+
7
+ Thank you too all of you fabulous contributors! :clap:
8
+
9
+ <%= committers %>
10
+
11
+ ## SHA256 Sums
12
+
13
+ ```
14
+ <%= shasums %>```
@@ -0,0 +1,62 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+
3
+ require 'digest'
4
+ require 'erb'
5
+ require 'octokit'
6
+
7
+ module Distribution
8
+ class ReleaseNotes
9
+ attr_reader :version, :content, :github
10
+
11
+ def initialize
12
+ @version = `git tag | tail -1`.strip
13
+ @github = Octokit::Client.new access_token: ENV['OCTODOWN_TOKEN']
14
+ @content = render_template
15
+ end
16
+
17
+ private
18
+
19
+ def render_template
20
+ template_text = File.read 'tasks/distribution/release_notes.erb'
21
+ erb_template = ERB.new template_text
22
+ erb_template.result binding
23
+ end
24
+
25
+ # Show our committers
26
+ def committers
27
+ committer_logins_for(contributor_emails)
28
+ .map { |str| "- @#{str}" }
29
+ .join "\n"
30
+ end
31
+
32
+ def contributor_emails
33
+ `git log #{prev_release}.. --format="%aE"`
34
+ .split("\n")
35
+ .uniq
36
+ end
37
+
38
+ def committer_logins_for(emails)
39
+ emails.map do |email|
40
+ github.search_users("#{email} in:email")
41
+ .items
42
+ .first
43
+ .login
44
+ end
45
+ end
46
+
47
+ def prev_release
48
+ `git tag | tail -2 | head -1`.strip
49
+ end
50
+
51
+ def shasums
52
+ Dir['distro/*'].reduce '' do |a, e|
53
+ [].tap do |arr|
54
+ arr << a
55
+ arr << "#{File.basename e}: "
56
+ arr << ' ' * (36 - arr[1].size)
57
+ arr << "#{Digest::SHA256.hexdigest File.read(e)}\n"
58
+ end.join
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,47 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+
3
+ module Distribution
4
+ class Tarball
5
+ include PackageHelpers
6
+ extend Forwardable
7
+
8
+ attr_accessor :arch, :file, :version, :dir, :package
9
+
10
+ def_delegators :@package, :arch, :dir
11
+
12
+ def initialize(package)
13
+ @package = package
14
+ @file = search || build
15
+ @version = extract_version
16
+ end
17
+
18
+ def self.upload(package)
19
+ new(package).to_github
20
+ end
21
+
22
+ def to_github
23
+ Release.new(self).upload_asset
24
+ end
25
+
26
+ def build
27
+ print_to_console 'Creating tarball...'
28
+
29
+ FileUtils.mkdir_p 'distro'
30
+ system "tar -czf distro/#{dir}.tar.gz #{dir} > /dev/null"
31
+ FileUtils.remove_dir "#{dir}", true
32
+
33
+ File.new "distro/#{dir}.tar.gz"
34
+ end
35
+
36
+ private
37
+
38
+ def search
39
+ ball = Dir['distro/*.tar.gz'].find { |n| n.include? "#{arch}.tar.gz" }
40
+ File.new ball unless ball.nil?
41
+ end
42
+
43
+ def extract_version
44
+ file.path.match(/\*|\d+(\.\d+){0,2}(\.\*)?/)[0]
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,87 @@
1
+ Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }
2
+
3
+ module Distribution
4
+ class TravellingRuby
5
+ attr_reader :package
6
+
7
+ include PackageHelpers
8
+
9
+ def initialize(package)
10
+ @package = package
11
+ end
12
+
13
+ def self.install(package)
14
+ new(package)
15
+ .tap(&:download_runtime)
16
+ .tap(&:extract_to_folder)
17
+ .tap(&:install_gems)
18
+ .tap(&:install_native_extensions)
19
+ .tap(&:cleanup_files)
20
+ end
21
+
22
+ def install_gems
23
+ print_to_console 'Installing Gems...'
24
+
25
+ Bundler.with_clean_env do
26
+ FileUtils.cd "#{package.dir}/lib/app" do
27
+ system(
28
+ 'BUNDLE_IGNORE_CONFIG=1 bundle install ' \
29
+ '--path vendor --without development --jobs 2 ' \
30
+ '--quiet'
31
+ )
32
+ end
33
+ end
34
+ end
35
+
36
+ def extract_to_folder
37
+ FileUtils.mkdir "#{package.dir}/lib/ruby"
38
+
39
+ system(
40
+ "tar -xzf packaging/traveling-ruby-#{package.rb_version}-" \
41
+ "#{package.arch}.tar.gz " \
42
+ "-C #{package.dir}/lib/ruby " \
43
+ '&> /dev/null'
44
+ )
45
+ end
46
+
47
+ def download_runtime
48
+ print_to_console 'Downloading Ruby...'
49
+ ruby = "traveling-ruby-#{package.rb_version}-#{package.arch}.tar.gz"
50
+
51
+ FileUtils.cd Distribution.configuration.packaging_dir do
52
+ unless File.exist? ruby
53
+ curl "http://d6r77u77i8pq3.cloudfront.net/releases/#{ruby}"
54
+ end
55
+ end
56
+ end
57
+
58
+ def install_native_extensions
59
+ clean_old_extensions
60
+
61
+ package.native_extensions.each do |ext|
62
+ FileUtils.cd "#{package.dir}/lib/app/vendor/ruby/2.1.0/extensions" do
63
+ curl 'http://d6r77u77i8pq3.cloudfront.net/releases/' \
64
+ "traveling-ruby-gems-#{package.rb_version}-#{package.arch}/" \
65
+ "#{ext}.tar.gz"
66
+
67
+ system "tar xzf #{ext}.tar.gz && rm #{ext}.tar.gz > /dev/null"
68
+ end
69
+ end
70
+ end
71
+
72
+ def clean_old_extensions
73
+ files = Dir['lib/app/vendor/ruby/2.1.0/extensions/**/*']
74
+ files.each { |file| FileUtils.rm_rf file }
75
+ end
76
+
77
+ def cleanup_files
78
+ FileUtils.cd package.dir do
79
+ files = Dir['**/{test,spec,doc,example,examples,features,benchmark}']
80
+ files += Dir['**/{tasks,Rakefile}']
81
+ files += Dir['lib/ruby/lib/ruby/**/darkfish/images/**/*']
82
+ files += Dir['**/*.{h,c,cpp,rl,java,class,md,rdoc,txt,gif}']
83
+ files.each { |file| FileUtils.rm_rf file }
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,41 @@
1
+ include Distribution
2
+
3
+ namespace :distribution do
4
+ desc 'Package octodown into self-contained programs'
5
+ task :package do
6
+ %w(linux:x86 linux:x86_64 osx).each do |task|
7
+ fork do
8
+ Rake::Task["distribution:package:#{task}"].invoke
9
+ exit
10
+ end
11
+
12
+ sleep 0.01
13
+ end
14
+
15
+ Process.waitall
16
+ end
17
+
18
+ namespace :package do
19
+ namespace :linux do
20
+ desc 'Package for Linux x86'
21
+ task :x86 do
22
+ Package.create 'linux-x86'
23
+ end
24
+
25
+ desc 'Package for Linux x86_64'
26
+ task :x86_64 do
27
+ Package.create 'linux-x86_64'
28
+ end
29
+ end
30
+
31
+ desc 'Package for OS X'
32
+ task :osx do
33
+ Package.create 'osx'
34
+ end
35
+ end
36
+
37
+ desc 'Generate release notes'
38
+ task :release_notes do
39
+ # puts ReleaseNotes.new.content
40
+ end
41
+ end
data/tasks/upload.rake ADDED
@@ -0,0 +1,40 @@
1
+ include Distribution
2
+
3
+ desc 'Upload tarballs to GitHub'
4
+ task :upload do
5
+ ['upload:linux:x86', 'upload:linux:x86_64', 'upload:osx'].each do |task|
6
+ begin
7
+ Release.create Package.new('osx')
8
+ rescue
9
+ puts 'Release already uploaded, continuing...'
10
+ end
11
+
12
+ fork do
13
+ Rake::Task[task].invoke
14
+ exit
15
+ end
16
+
17
+ sleep 0.01
18
+ end
19
+
20
+ Process.waitall
21
+ end
22
+
23
+ namespace :upload do
24
+ namespace :linux do
25
+ desc 'Upload for Linux x86'
26
+ task :x86 do
27
+ Tarball.upload Package.new('x86')
28
+ end
29
+
30
+ desc 'Upload for Linux x86_64'
31
+ task :x86_64 do
32
+ Tarball.upload Package.new('x86_64')
33
+ end
34
+ end
35
+
36
+ desc 'Upload for OS X'
37
+ task :osx do
38
+ Tarball.upload Package.new('osx')
39
+ end
40
+ end
data/test.rb ADDED
@@ -0,0 +1 @@
1
+ puts Datapimp.config.current.keys.inspect
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: architects-toolkit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Soeder
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: brief
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.9.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.9.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: datapimp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Packages up different CLI utilities for working with the Architects.io
70
+ Blueprint, and ALM Platform
71
+ email:
72
+ - jonathan.soeder@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - CODE_OF_CONDUCT.md
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - architects-toolkit.gemspec
85
+ - bin/archi
86
+ - bin/console
87
+ - bin/setup
88
+ - lib/architects/toolkit.rb
89
+ - lib/architects/toolkit/version.rb
90
+ - packaging/wrapper.sh
91
+ - tasks/distribution/configuration.rb
92
+ - tasks/distribution/executable.rb
93
+ - tasks/distribution/package.rb
94
+ - tasks/distribution/package_helpers.rb
95
+ - tasks/distribution/release.rb
96
+ - tasks/distribution/release_notes.erb
97
+ - tasks/distribution/release_notes.rb
98
+ - tasks/distribution/tarball.rb
99
+ - tasks/distribution/travelling_ruby.rb
100
+ - tasks/package.rake
101
+ - tasks/upload.rake
102
+ - test.rb
103
+ homepage: https://architects.io/architects-toolkit
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Packages up different CLI utilities for working with the Architects.io Blueprint,
127
+ and ALM Platform
128
+ test_files: []