admiral-meteor 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rbenv-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/admiral-meteor.gemspec +27 -0
- data/lib/admiral-meteor.rb +1 -0
- data/lib/admiral-meteor/tasks.rb +89 -0
- metadata +151 -0
data/.gitignore
ADDED
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p547
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Peter T. Brown
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Admiral for Meteor
|
2
|
+
|
3
|
+
An Admiral module for building and deploying Meteor applications to AWS OpsWorks EC2 instances.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile (recommended):
|
8
|
+
|
9
|
+
gem 'admiral-meteor'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install admiral-meteor
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
On your command line type:
|
22
|
+
|
23
|
+
$ admiral meteor help
|
24
|
+
|
25
|
+
To see a list of available commands. Make sure your bundle bin is in your PATH.
|
26
|
+
|
27
|
+
The following commands are available:
|
28
|
+
|
29
|
+
```
|
30
|
+
Commands:
|
31
|
+
admiral meteor build # Build the Meteor app specifically for opsworks
|
32
|
+
admiral meteor help [COMMAND] # Describe subcommands or one specific subcommand
|
33
|
+
admiral meteor push # Push a build to S3
|
34
|
+
|
35
|
+
Options:
|
36
|
+
[--name=NAME] # Name of build file. Set in env with ADMIRAL_DEPLOY_NAME
|
37
|
+
# Default: fetching-app
|
38
|
+
[--branch=BRANCH] # The branch to build
|
39
|
+
# Default: master
|
40
|
+
[--tag=TAG] # Create a tag for this commit. e.g. v1.0.1
|
41
|
+
[--repo=REPO] # The git repo with your app source code. Defaults to the current working directory.
|
42
|
+
[--architecture=ARCHITECTURE] # The architecture to target for this build.
|
43
|
+
# Default: os.linux.x86_64
|
44
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "admiral-meteor"
|
7
|
+
spec.version = '0.0.1'
|
8
|
+
spec.authors = ["Peter T. Brown"]
|
9
|
+
spec.email = ["p@ptb.io "]
|
10
|
+
spec.description = %q{Admiral module for building and deploying Meteor application to AWS OpsWorks.}
|
11
|
+
spec.summary = %q{Admiral module for building and deploying Meteor application to AWS OpsWorks.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_dependency 'aws-sdk', '< 2'
|
23
|
+
spec.add_dependency 'git', '~> 1.2'
|
24
|
+
spec.add_dependency 'json', '~> 1.8'
|
25
|
+
|
26
|
+
spec.add_dependency 'admiral', '~> 0.0.1'
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "admiral-meteor/tasks"
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'aws-sdk-v1'
|
2
|
+
require 'thor'
|
3
|
+
require 'git'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Admiral
|
7
|
+
module Tasks
|
8
|
+
class Deploy < Thor
|
9
|
+
|
10
|
+
NAME = 'meteor'
|
11
|
+
USAGE = 'meteor <command> <options>'
|
12
|
+
DESCRIPTION = 'Commands for building meteor apps.'
|
13
|
+
|
14
|
+
namespace :meteor
|
15
|
+
|
16
|
+
default_command :push
|
17
|
+
|
18
|
+
class_option :name,
|
19
|
+
desc: 'Name of build file. Set in env with ADMIRAL_DEPLOY_NAME',
|
20
|
+
type: :string,
|
21
|
+
default: ENV['ADMIRAL_DEPLOY_NAME'] || 'build'
|
22
|
+
|
23
|
+
class_option :branch,
|
24
|
+
desc: 'The branch to build',
|
25
|
+
type: :string,
|
26
|
+
default: 'master'
|
27
|
+
|
28
|
+
class_option :tag,
|
29
|
+
desc: 'Create a tag for this commit. e.g. v1.0.1',
|
30
|
+
type: :string
|
31
|
+
|
32
|
+
class_option :repo,
|
33
|
+
desc: "The git repo with your app source code. Defaults to the current working directory.",
|
34
|
+
type: :string
|
35
|
+
|
36
|
+
class_option :architecture,
|
37
|
+
desc: 'The architecture to target for this build.',
|
38
|
+
default: 'os.linux.x86_64'
|
39
|
+
|
40
|
+
desc 'build', 'Build the Meteor app specifically for opsworks'
|
41
|
+
|
42
|
+
def build
|
43
|
+
Dir.mktmpdir do |tmpdir|
|
44
|
+
build_dir = "#{tmpdir}/admiral-build"
|
45
|
+
repo = options[:repo] || Dir.pwd
|
46
|
+
|
47
|
+
if options[:tag]
|
48
|
+
git = Git.open(repo)
|
49
|
+
puts "[admiral] Tagging release #{options[:tag]}."
|
50
|
+
git.add_tag(options[:tag], m: 'tagging release')
|
51
|
+
end
|
52
|
+
|
53
|
+
puts "[admiral] Creating new meteor build."
|
54
|
+
_git = Git.clone(repo, "#{tmpdir}/admiral-checkout")
|
55
|
+
branch = _git.branches[options[:branch]]
|
56
|
+
raise "Branch doesn't exist" unless branch
|
57
|
+
branch.checkout
|
58
|
+
|
59
|
+
_git.chdir do
|
60
|
+
`meteor build #{build_dir} --directory --architecture=#{options[:architecture]}`
|
61
|
+
end
|
62
|
+
|
63
|
+
`cp -a ./deploy #{build_dir}/bundle`
|
64
|
+
`mv #{build_dir}/bundle/main.js #{build_dir}/bundle/server.js`
|
65
|
+
`tar -C #{build_dir}/bundle/ -zcf ./#{options[:name]}.tar.gz .`
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
desc "push", "Push a build to S3"
|
71
|
+
|
72
|
+
option :bucket,
|
73
|
+
desc: 'S3 bucket name to hold builds. Set in env with ADMIRAL_DEPLOY_BUCKET.',
|
74
|
+
type: :string,
|
75
|
+
default: ENV['ADMIRAL_DEPLOY_BUCKET'] || 'builds'
|
76
|
+
|
77
|
+
def push
|
78
|
+
invoke :build
|
79
|
+
|
80
|
+
puts "[admiral] Pushing meteor build to S3."
|
81
|
+
s3 = AWS::S3.new
|
82
|
+
name = "#{options[:name]}.tar.gz"
|
83
|
+
build = s3.buckets[options[:bucket]].objects[name]
|
84
|
+
build.write(:file => "./#{name}")
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: admiral-meteor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Peter T. Brown
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-05-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aws-sdk
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - <
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - <
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: git
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.2'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: json
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.8'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.8'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: admiral
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.0.1
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.0.1
|
110
|
+
description: Admiral module for building and deploying Meteor application to AWS OpsWorks.
|
111
|
+
email:
|
112
|
+
- ! 'p@ptb.io '
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rbenv-version
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- admiral-meteor.gemspec
|
124
|
+
- lib/admiral-meteor.rb
|
125
|
+
- lib/admiral-meteor/tasks.rb
|
126
|
+
homepage: ''
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.23.2
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: Admiral module for building and deploying Meteor application to AWS OpsWorks.
|
151
|
+
test_files: []
|