dronr 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/CHANGELOG +0 -0
- data/COMINGSOON +108 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +82 -0
- data/Rakefile +2 -0
- data/TODO +4 -0
- data/bin/dronr +6 -0
- data/dronr.gemspec +29 -0
- data/lib/dronr/cli.rb +76 -0
- data/lib/dronr/drone.rb +44 -0
- data/lib/dronr/drones/cleanup.rb +11 -0
- data/lib/dronr/drones/compass.rb +15 -0
- data/lib/dronr/drones/dotenv.rb +15 -0
- data/lib/dronr/drones/draper.rb +11 -0
- data/lib/dronr/drones/dronr.rb +19 -0
- data/lib/dronr/drones/factory_girl.rb +11 -0
- data/lib/dronr/drones/foundation.rb +15 -0
- data/lib/dronr/drones/foundation_icons.rb +15 -0
- data/lib/dronr/drones/git.rb +11 -0
- data/lib/dronr/drones/heroku.rb +11 -0
- data/lib/dronr/drones/migrant.rb +11 -0
- data/lib/dronr/drones/postgresql.rb +15 -0
- data/lib/dronr/drones/rspec.rb +20 -0
- data/lib/dronr/drones/slim.rb +11 -0
- data/lib/dronr/drones/underscore.rb +15 -0
- data/lib/dronr/drones.rb +23 -0
- data/lib/dronr/manager.rb +167 -0
- data/lib/dronr/register/canonical.yml +37 -0
- data/lib/dronr/register/standard.yml +27 -0
- data/lib/dronr/register.rb +91 -0
- data/lib/dronr/version.rb +3 -0
- data/lib/dronr.rb +17 -0
- data/spec/dronr/drone_spec.rb +75 -0
- data/spec/dronr/register_spec.rb +152 -0
- data/spec/fixtures/register_drone_not_found.yml +8 -0
- data/spec/fixtures/register_invalid.yml +8 -0
- data/spec/fixtures/register_keys_missing.yml +2 -0
- data/spec/fixtures/register_malformed.yml +7 -0
- data/spec/fixtures/register_template.yml +9 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/fixture_path.rb +9 -0
- data/spec/support/sample_drones.rb +15 -0
- data/spec/tmp/dronr.yml +7 -0
- metadata +200 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2d4f3a0a153eb347c2d172a10b0c22861543222b
|
4
|
+
data.tar.gz: 0789e70d405b9e51f16ce6f28d70267316ec081e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e33cc38e6284fa1f3137fc298b29558e6ce156eb498005b4842017cfdc9b381896fb0bbbb599d2396266195e13fe9df6de69a5404923c903e6a1b43aa77d09c1
|
7
|
+
data.tar.gz: 421fc5cb03e75c5fb3ba36f1ff0cb553845e9c6086d470155f9f4191e894a360d4e70320f475670177dace8f1b78f12e3d4f0285c0ddbd6d50e6462dff12c98c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG
ADDED
File without changes
|
data/COMINGSOON
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
.env
|
2
|
+
quiet_assets
|
3
|
+
letter_opener
|
4
|
+
js-routes
|
5
|
+
momentjs-rails
|
6
|
+
compass-rails
|
7
|
+
faker
|
8
|
+
simple_form
|
9
|
+
show_for
|
10
|
+
mapbox-rails
|
11
|
+
|
12
|
+
rabl-rails
|
13
|
+
gon
|
14
|
+
draper
|
15
|
+
|
16
|
+
email_validator
|
17
|
+
active_attr
|
18
|
+
|
19
|
+
|
20
|
+
incoming:
|
21
|
+
# core:
|
22
|
+
|
23
|
+
# app:
|
24
|
+
# - foreman
|
25
|
+
# - resque
|
26
|
+
# - sidekiq
|
27
|
+
|
28
|
+
# database:
|
29
|
+
- postgresql
|
30
|
+
- migrant
|
31
|
+
|
32
|
+
# templating:
|
33
|
+
- slim
|
34
|
+
|
35
|
+
# assets:
|
36
|
+
- foundation
|
37
|
+
- foundation_icons
|
38
|
+
- underscore
|
39
|
+
|
40
|
+
# development:
|
41
|
+
- dotenv
|
42
|
+
- rspec
|
43
|
+
# - guard
|
44
|
+
# - guard_rspec
|
45
|
+
- factory_girl
|
46
|
+
|
47
|
+
# integration:
|
48
|
+
# - shippable
|
49
|
+
|
50
|
+
# deployment:
|
51
|
+
# - heroku
|
52
|
+
|
53
|
+
# team:
|
54
|
+
# - slack
|
55
|
+
|
56
|
+
- cleanup
|
57
|
+
|
58
|
+
- git
|
59
|
+
|
60
|
+
bundled:
|
61
|
+
|
62
|
+
finished:
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
select2-rails
|
67
|
+
|
68
|
+
gritter
|
69
|
+
|
70
|
+
|
71
|
+
# app/workers
|
72
|
+
|
73
|
+
'resque'
|
74
|
+
'resque-web', require: 'resque_web'
|
75
|
+
gem 'resque-scheduler'
|
76
|
+
gem 'resque-retry'
|
77
|
+
gem 'resque-loner'
|
78
|
+
gem 'redis'
|
79
|
+
|
80
|
+
# OAuth for configurable routes
|
81
|
+
gem 'simple_admin_auth'
|
82
|
+
|
83
|
+
foreman
|
84
|
+
timecop
|
85
|
+
|
86
|
+
# spec
|
87
|
+
|
88
|
+
|
89
|
+
group :test do
|
90
|
+
gem 'simplecov', require: false
|
91
|
+
gem 'shoulda-matchers'
|
92
|
+
# gem 'webmock', '~> 1.13.0'
|
93
|
+
# gem 'vcr'
|
94
|
+
gem 'rspec-xml'
|
95
|
+
end
|
96
|
+
|
97
|
+
group :doc do
|
98
|
+
gem 'sdoc', require: false
|
99
|
+
end
|
100
|
+
|
101
|
+
# deploy
|
102
|
+
gem 'capistrano', '~> 3.2'
|
103
|
+
gem 'capistrano-rails', '~> 1.1'
|
104
|
+
gem 'honeybadger'
|
105
|
+
|
106
|
+
# lib
|
107
|
+
gem 'nokogiri'
|
108
|
+
gem 'color'
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 recombinary
|
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,82 @@
|
|
1
|
+
This is a long-overdue rewrite of a previous project of mine, [jeriko/app_drone](https://github.com/jeriko/app_drone)
|
2
|
+
|
3
|
+
# Dronr
|
4
|
+
|
5
|
+
Dronr is your Rails 4 workhorse. Boring application setup, fully automated!
|
6
|
+
|
7
|
+
Dronr is opinionated, designed to promote best practices and coding patterns, and doesn't aim to provide installations for the totality of existing things.
|
8
|
+
|
9
|
+
## Getting started
|
10
|
+
|
11
|
+
### Installation
|
12
|
+
|
13
|
+
$ gem install dronr
|
14
|
+
|
15
|
+
### Create a brand new app
|
16
|
+
|
17
|
+
$ dronr new MyApp
|
18
|
+
|
19
|
+
You can also supply a path to a valid register file
|
20
|
+
|
21
|
+
$ dronr new MyApp --template templates/prototyping.yml
|
22
|
+
|
23
|
+
Or try a popular configuration (coming soon)
|
24
|
+
|
25
|
+
$ dronr new MyApp --template https://dronr.recombinary.com/templates/api_server.yml
|
26
|
+
|
27
|
+
|
28
|
+
#### Under the hood
|
29
|
+
|
30
|
+
The `dronr new` command runs like so:
|
31
|
+
|
32
|
+
1. Generate app structure (like `rails new`) with custom config (e.g. `--skip-test-unit` if RSpec was declared)
|
33
|
+
2. Install dronr gem in newly generated app & generate binstub
|
34
|
+
3. Set up register file if a template register was supplied (more on this later)
|
35
|
+
4. Invoke `dronr up` to run any new drones
|
36
|
+
|
37
|
+
### Bootstrapping an existing app (coming soon)
|
38
|
+
|
39
|
+
If your app was not generated with the `dronr new` command, you can bootstrap it by navigating to the app directory and running:
|
40
|
+
|
41
|
+
$ bundle exec dronr bootstrap
|
42
|
+
|
43
|
+
with an optional template argument
|
44
|
+
|
45
|
+
$ bundle exec dronr bootstrap --template templates/prototyping.yml
|
46
|
+
|
47
|
+
This will install the dronr gem, generate a binstub, and copy the template register.
|
48
|
+
|
49
|
+
Be aware that existing apps might already have undergone manual installation of some drones you may want to add. I'll add more info here later.
|
50
|
+
|
51
|
+
|
52
|
+
# Drones
|
53
|
+
|
54
|
+
## Listing drones
|
55
|
+
|
56
|
+
Coming soon.
|
57
|
+
|
58
|
+
## Adding a drone
|
59
|
+
|
60
|
+
Register a drone for installation by adding it's name to the 'incoming' list in .dronr.yml
|
61
|
+
|
62
|
+
incoming:
|
63
|
+
- rspec
|
64
|
+
- simple_form
|
65
|
+
- ...
|
66
|
+
|
67
|
+
Whenever you're ready to run new changes:
|
68
|
+
|
69
|
+
$ bin/dronr up
|
70
|
+
|
71
|
+
Drone work their way from `incoming`, to `bundled` (once a drone's gems have been installed), to `finished` (once a drone's installation commands have been executed).
|
72
|
+
|
73
|
+
Note that it may take multiple iterations of `dronr up` to complete the entire process. This is because gems & config are changing so code may need to be reloaded.
|
74
|
+
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
1. Fork it ( https://github.com/[my-github-username]/dronr/fork )
|
79
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
80
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
81
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
82
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/TODO
ADDED
data/bin/dronr
ADDED
data/dronr.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dronr/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dronr"
|
8
|
+
spec.version = Dronr::VERSION
|
9
|
+
spec.authors = ["Dan Davey"]
|
10
|
+
spec.email = ["dan@recombinary.com"]
|
11
|
+
spec.summary = %q{Dev automation for Rails apps}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
|
25
|
+
spec.add_dependency "rails", "~> 4"
|
26
|
+
spec.add_dependency "pry"
|
27
|
+
spec.add_dependency "thor"
|
28
|
+
spec.add_dependency "thor-rails"
|
29
|
+
end
|
data/lib/dronr/cli.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Dronr
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
# TODO you need a better way to detect if dronr is being run within a Rails app.
|
7
|
+
# Maybe don't detect, just load Thor::Rails for the specific methods that require it?
|
8
|
+
# esp. since it's currently impossible to run full path commands e.g. `~/Code/appname/bin/dronr up`
|
9
|
+
IS_RAILS_APP = File.exists? File.join(Dir.getwd, 'config/environment.rb')
|
10
|
+
|
11
|
+
if IS_RAILS_APP
|
12
|
+
require 'thor/rails'
|
13
|
+
include Thor::Rails
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'new', 'Generates a new Rails app, with dronr installed'
|
17
|
+
option :template
|
18
|
+
|
19
|
+
def new(app_name)
|
20
|
+
app_requirement(false)
|
21
|
+
|
22
|
+
# TODO allow CLI params thru
|
23
|
+
# # args = Rails::Generators::ARGVScrubber.new([]).prepare!
|
24
|
+
# args = [app_name]
|
25
|
+
|
26
|
+
template_register = if template_path = options[:template]
|
27
|
+
Register.load(template_path)
|
28
|
+
else
|
29
|
+
Register.new
|
30
|
+
end
|
31
|
+
|
32
|
+
Dronr::Manager.from_scratch(app_name, template_register)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# desc 'stage', 'Generates a new Rails app, with dronr installed'
|
37
|
+
# def stage
|
38
|
+
# load_app
|
39
|
+
# app_requirement(true)
|
40
|
+
|
41
|
+
# app_generator = Rails::Generators::AppGenerator.new [Rails.root], {}, destination_root: Rails.root
|
42
|
+
# manager = Dronr::Manager.new(app_generator)
|
43
|
+
# manager.stage
|
44
|
+
# end
|
45
|
+
|
46
|
+
desc 'up', 'Installs all pending drones based on dronr.yml'
|
47
|
+
option :loop
|
48
|
+
|
49
|
+
def up
|
50
|
+
app_requirement(true)
|
51
|
+
|
52
|
+
Dronr::Manager.existing({ loop: options[:loop] })
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# def yank
|
57
|
+
# app_requirement(true)
|
58
|
+
# # CONFIRM ARE YOU SURE?
|
59
|
+
|
60
|
+
# # self destruct, yank self completely
|
61
|
+
# end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def app_requirement(required)
|
68
|
+
if IS_RAILS_APP
|
69
|
+
raise "FATAL: Existing app detected: #{::Rails.application}" if !required
|
70
|
+
else
|
71
|
+
raise "FATAL: App not found" if required
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
data/lib/dronr/drone.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Dronr
|
2
|
+
|
3
|
+
class Drone
|
4
|
+
|
5
|
+
attr_accessor :state
|
6
|
+
def initialize(state=nil)
|
7
|
+
@state = state
|
8
|
+
end
|
9
|
+
|
10
|
+
class DroneNotFoundError < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.find_class_by_human_name(human_name)
|
14
|
+
class_name = human_name.camelize
|
15
|
+
begin
|
16
|
+
"Dronr::Drones::#{class_name}".constantize
|
17
|
+
rescue Exception => e
|
18
|
+
raise DroneNotFoundError.new(human_name), "`#{human_name}` is not a valid Drone name (looked for #{class_name})"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def human_name
|
23
|
+
self.class.to_s.demodulize.underscore
|
24
|
+
end
|
25
|
+
|
26
|
+
def args_for_app_create
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
%w{bundle install finish}.each do |directive|
|
31
|
+
|
32
|
+
define_singleton_method(directive) do |&block|
|
33
|
+
instance_variable_set :"@#{directive}_block", block
|
34
|
+
end
|
35
|
+
|
36
|
+
define_singleton_method("#{directive}_block") do |&block|
|
37
|
+
instance_variable_get :"@#{directive}_block"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dronr
|
2
|
+
module Drones
|
3
|
+
class Dronr < Drone
|
4
|
+
|
5
|
+
bundle do
|
6
|
+
gem 'dronr', "~> #{::Dronr::VERSION}", group: :development
|
7
|
+
end
|
8
|
+
|
9
|
+
bundle do
|
10
|
+
gem 'dronr', path: '../../dronr', group: :development
|
11
|
+
end if ENV['DEBUG']
|
12
|
+
|
13
|
+
install do
|
14
|
+
bundle_command 'binstub dronr'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Dronr
|
2
|
+
module Drones
|
3
|
+
class Rspec < Drone
|
4
|
+
|
5
|
+
def args_for_app_create
|
6
|
+
{ skip_test_unit: true }
|
7
|
+
end
|
8
|
+
|
9
|
+
bundle do
|
10
|
+
gem 'rspec-rails', group: %w(development test)
|
11
|
+
end
|
12
|
+
|
13
|
+
install do
|
14
|
+
generate('rspec:install')
|
15
|
+
bundle_command 'binstub rspec-core'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/dronr/drones.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Dronr
|
2
|
+
module Drones
|
3
|
+
|
4
|
+
extend ActiveSupport::Autoload
|
5
|
+
|
6
|
+
autoload :Cleanup
|
7
|
+
autoload :Compass
|
8
|
+
autoload :Dotenv
|
9
|
+
autoload :Dronr
|
10
|
+
autoload :Draper
|
11
|
+
autoload :FactoryGirl
|
12
|
+
autoload :Foundation
|
13
|
+
autoload :FoundationIcons
|
14
|
+
autoload :Git
|
15
|
+
autoload :Heroku
|
16
|
+
autoload :Migrant
|
17
|
+
autoload :Postgresql
|
18
|
+
autoload :Rspec
|
19
|
+
autoload :Slim
|
20
|
+
autoload :Underscore
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|