arkenstone 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.hound.yml +2 -0
  4. data/.ruby-style.yml +245 -0
  5. data/.ruby-version +1 -1
  6. data/Gemfile +3 -1
  7. data/README.md +31 -21
  8. data/arkenstone.gemspec +8 -11
  9. data/bin/arkenstone +2 -10
  10. data/circle.yml +9 -0
  11. data/lib/arkenstone.rb +1 -2
  12. data/lib/arkenstone/forge.rb +41 -0
  13. data/lib/arkenstone/templates/Vagrantfile.erb +13 -0
  14. data/lib/arkenstone/templates/ansible/roles/base/tasks/main.yml +26 -0
  15. data/lib/arkenstone/templates/ansible/roles/postgresql/tasks/main.yml +14 -0
  16. data/lib/arkenstone/templates/ansible/roles/rails/defaults/main.yml +3 -0
  17. data/lib/arkenstone/templates/ansible/roles/rails/tasks/main.yml +31 -0
  18. data/lib/arkenstone/templates/ansible/roles/ruby/defaults/main.yml +5 -0
  19. data/lib/arkenstone/templates/ansible/roles/ruby/tasks/main.yml +26 -0
  20. data/lib/arkenstone/templates/ansible/site.yml +9 -0
  21. data/lib/arkenstone/version.rb +1 -3
  22. data/ruby.yml +243 -0
  23. data/spec/features/new_project_spec.rb +11 -120
  24. data/spec/features/new_project_with_ansible_spec.rb +20 -0
  25. data/spec/features/new_project_with_ubuntu_trusty_spec.rb +14 -0
  26. data/spec/features/new_project_with_virtualbox_spec.rb +14 -0
  27. data/spec/spec_helper.rb +7 -0
  28. data/spec/support/features/new_project.rb +7 -23
  29. metadata +41 -60
  30. data/.codeclimate.yml +0 -19
  31. data/.rubocop.yml +0 -1148
  32. data/.travis.yml +0 -5
  33. data/lib/arkenstone/app_builder.rb +0 -118
  34. data/lib/arkenstone/generators/app_generator.rb +0 -56
  35. data/lib/arkenstone/templates/.travis.yml.erb +0 -3
  36. data/lib/arkenstone/templates/Gemfile.erb +0 -52
  37. data/lib/arkenstone/templates/README.md.erb +0 -1
  38. data/lib/arkenstone/templates/_flashes.html.erb +0 -3
  39. data/lib/arkenstone/templates/_form.html.erb +0 -13
  40. data/lib/arkenstone/templates/application.html.erb +0 -16
  41. data/lib/arkenstone/templates/application.scss +0 -7
  42. data/lib/arkenstone/templates/database.yml.erb +0 -12
  43. data/lib/arkenstone/templates/database_cleaner.rb +0 -21
  44. data/lib/arkenstone/templates/en.yml.erb +0 -3
  45. data/lib/arkenstone/templates/factories.rb +0 -2
  46. data/lib/arkenstone/templates/high_voltage.rb +0 -4
  47. data/lib/arkenstone/templates/home.html.erb +0 -2
  48. data/lib/arkenstone/templates/rails +0 -9
  49. data/lib/arkenstone/templates/rails_helper.rb +0 -16
  50. data/lib/arkenstone/templates/rake +0 -9
  51. data/lib/arkenstone/templates/simple_form.en.yml +0 -31
  52. data/lib/arkenstone/templates/simple_form.rb +0 -165
  53. data/lib/arkenstone/templates/spring +0 -15
  54. data/lib/arkenstone/templates/user.rb +0 -3
  55. data/spec/features/new_project_with_authentication_spec.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e89bd200f8cd6f7c287c5328df0e21fe7f50e13e
4
- data.tar.gz: aae8281958c25d78cba66d8134d87f212ea6b9c3
3
+ metadata.gz: c7fd46f443ea20d4749e6c11f7a8e5a3fee2311f
4
+ data.tar.gz: 48a4dc33a72ed7b485d39e8ba34e22495adb9895
5
5
  SHA512:
6
- metadata.gz: 711555134772363a6124262fe1c7156bb1df555588aa2c2b9d10e1625172de85794c9faab34eddd6ed0d06022f8e12e1688ce30d394b33a71ae04433f186ab5b
7
- data.tar.gz: 38351343ebd8ec994e8ac647280785498acb9f32c928a842830f3d8412346df010fb3cd28b6152f86ebc95ce032d41b2db6009629aed972ec80f1c60088a04aa
6
+ metadata.gz: 59736589fdab7ebe84e29051b0fe62923f2d159be1905433d706f763d7a241ed17a8b4b1c8e86eed779c74b4b91f312ada8ee52ae49c0313a16b075abbd20e2b
7
+ data.tar.gz: fdc9f06d40f87504da7440e42dd96d1c5ebbb5fcdd1cca99634fbdcfd51ccba036fa843854b8e5b6ad4a9b4e60192700659c7973fcd14778b86a57ead4d64092
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .#*
11
+ *.gem
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .ruby-style.yml
@@ -0,0 +1,245 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ - "db/schema.rb"
5
+ UseCache: false
6
+ Style/CollectionMethods:
7
+ Description: Preferred collection methods.
8
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
9
+ Enabled: true
10
+ PreferredMethods:
11
+ collect: map
12
+ collect!: map!
13
+ find: detect
14
+ find_all: select
15
+ reduce: inject
16
+ Style/DotPosition:
17
+ Description: Checks the position of the dot in multi-line method calls.
18
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
19
+ Enabled: true
20
+ EnforcedStyle: trailing
21
+ SupportedStyles:
22
+ - leading
23
+ - trailing
24
+ Style/FileName:
25
+ Description: Use snake_case for source file names.
26
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
27
+ Enabled: false
28
+ Exclude: []
29
+ Style/GuardClause:
30
+ Description: Check for conditionals that can be replaced with guard clauses
31
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
32
+ Enabled: false
33
+ MinBodyLength: 1
34
+ Style/IfUnlessModifier:
35
+ Description: Favor modifier if/unless usage when you have a single-line body.
36
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
37
+ Enabled: false
38
+ MaxLineLength: 80
39
+ Style/OptionHash:
40
+ Description: Don't use option hashes when you can use keyword arguments.
41
+ Enabled: false
42
+ Style/PercentLiteralDelimiters:
43
+ Description: Use `%`-literal delimiters consistently
44
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
45
+ Enabled: false
46
+ PreferredDelimiters:
47
+ "%": "()"
48
+ "%i": "()"
49
+ "%q": "()"
50
+ "%Q": "()"
51
+ "%r": "{}"
52
+ "%s": "()"
53
+ "%w": "()"
54
+ "%W": "()"
55
+ "%x": "()"
56
+ Style/PredicateName:
57
+ Description: Check the names of predicate methods.
58
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
59
+ Enabled: true
60
+ NamePrefix:
61
+ - is_
62
+ - has_
63
+ - have_
64
+ NamePrefixBlacklist:
65
+ - is_
66
+ Exclude:
67
+ - spec/**/*
68
+ Style/RaiseArgs:
69
+ Description: Checks the arguments passed to raise/fail.
70
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
71
+ Enabled: false
72
+ EnforcedStyle: exploded
73
+ SupportedStyles:
74
+ - compact
75
+ - exploded
76
+ Style/SignalException:
77
+ Description: Checks for proper usage of fail and raise.
78
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
79
+ Enabled: false
80
+ EnforcedStyle: semantic
81
+ SupportedStyles:
82
+ - only_raise
83
+ - only_fail
84
+ - semantic
85
+ Style/SingleLineBlockParams:
86
+ Description: Enforces the names of some block params.
87
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
88
+ Enabled: false
89
+ Methods:
90
+ - reduce:
91
+ - a
92
+ - e
93
+ - inject:
94
+ - a
95
+ - e
96
+ Style/SingleLineMethods:
97
+ Description: Avoid single-line methods.
98
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
99
+ Enabled: false
100
+ AllowIfMethodIsEmpty: true
101
+ Style/StringLiterals:
102
+ Description: Checks if uses of quotes match the configured preference.
103
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
104
+ Enabled: true
105
+ EnforcedStyle: double_quotes
106
+ SupportedStyles:
107
+ - single_quotes
108
+ - double_quotes
109
+ Style/StringLiteralsInInterpolation:
110
+ Description: Checks if uses of quotes inside expressions in interpolated strings
111
+ match the configured preference.
112
+ Enabled: true
113
+ EnforcedStyle: single_quotes
114
+ SupportedStyles:
115
+ - single_quotes
116
+ - double_quotes
117
+ Style/TrailingCommaInArguments:
118
+ Description: 'Checks for trailing comma in argument lists.'
119
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
120
+ Enabled: false
121
+ EnforcedStyleForMultiline: no_comma
122
+ SupportedStyles:
123
+ - comma
124
+ - consistent_comma
125
+ - no_comma
126
+ Style/TrailingCommaInLiteral:
127
+ Description: 'Checks for trailing comma in array and hash literals.'
128
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
129
+ Enabled: false
130
+ EnforcedStyleForMultiline: no_comma
131
+ SupportedStyles:
132
+ - comma
133
+ - consistent_comma
134
+ - no_comma
135
+ Metrics/AbcSize:
136
+ Description: A calculated magnitude based on number of assignments, branches, and
137
+ conditions.
138
+ Enabled: false
139
+ Max: 15
140
+ Metrics/ClassLength:
141
+ Description: Avoid classes longer than 100 lines of code.
142
+ Enabled: false
143
+ CountComments: false
144
+ Max: 100
145
+ Metrics/ModuleLength:
146
+ CountComments: false
147
+ Max: 100
148
+ Description: Avoid modules longer than 100 lines of code.
149
+ Enabled: false
150
+ Metrics/CyclomaticComplexity:
151
+ Description: A complexity metric that is strongly correlated to the number of test
152
+ cases needed to validate a method.
153
+ Enabled: false
154
+ Max: 6
155
+ Metrics/MethodLength:
156
+ Description: Avoid methods longer than 10 lines of code.
157
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
158
+ Enabled: false
159
+ CountComments: false
160
+ Max: 10
161
+ Metrics/ParameterLists:
162
+ Description: Avoid parameter lists longer than three or four parameters.
163
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
164
+ Enabled: false
165
+ Max: 5
166
+ CountKeywordArgs: true
167
+ Metrics/PerceivedComplexity:
168
+ Description: A complexity metric geared towards measuring complexity for a human
169
+ reader.
170
+ Enabled: false
171
+ Max: 7
172
+ Metrics/LineLength:
173
+ Max: 90
174
+ Lint/AssignmentInCondition:
175
+ Description: Don't use assignment in conditions.
176
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
177
+ Enabled: false
178
+ AllowSafeAssignment: true
179
+ Style/InlineComment:
180
+ Description: Avoid inline comments.
181
+ Enabled: false
182
+ Style/AccessorMethodName:
183
+ Description: Check the naming of accessor methods for get_/set_.
184
+ Enabled: false
185
+ Style/Alias:
186
+ Description: Use alias_method instead of alias.
187
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
188
+ Enabled: false
189
+ Style/Documentation:
190
+ Description: Document classes and non-namespace modules.
191
+ Enabled: false
192
+ Style/DoubleNegation:
193
+ Description: Checks for uses of double negation (!!).
194
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
195
+ Enabled: false
196
+ Style/EachWithObject:
197
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
198
+ Enabled: false
199
+ Style/EmptyLiteral:
200
+ Description: Prefer literals to Array.new/Hash.new/String.new.
201
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
202
+ Enabled: false
203
+ Style/ModuleFunction:
204
+ Description: Checks for usage of `extend self` in modules.
205
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
206
+ Enabled: false
207
+ Style/OneLineConditional:
208
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
209
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
210
+ Enabled: false
211
+ Style/PerlBackrefs:
212
+ Description: Avoid Perl-style regex back references.
213
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
214
+ Enabled: false
215
+ Style/Send:
216
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
217
+ may overlap with existing methods.
218
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
219
+ Enabled: false
220
+ Style/SpecialGlobalVars:
221
+ Description: Avoid Perl-style global variables.
222
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
223
+ Enabled: false
224
+ Style/VariableInterpolation:
225
+ Description: Don't interpolate global, instance and class variables directly in
226
+ strings.
227
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
228
+ Enabled: false
229
+ Style/WhenThen:
230
+ Description: Use when x then ... for one-line cases.
231
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
232
+ Enabled: false
233
+ Lint/EachWithObjectArgument:
234
+ Description: Check for immutable argument given to each_with_object.
235
+ Enabled: true
236
+ Lint/HandleExceptions:
237
+ Description: Don't suppress exception.
238
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
239
+ Enabled: false
240
+ Lint/LiteralInCondition:
241
+ Description: Checks of literals used in conditions.
242
+ Enabled: false
243
+ Lint/LiteralInInterpolation:
244
+ Description: Checks for literals used in interpolation.
245
+ Enabled: false
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.0
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
+
3
+ ruby "2.3.0"
2
4
 
3
5
  gemspec
data/README.md CHANGED
@@ -1,38 +1,48 @@
1
- # Arkenstone
1
+ # The Arkenstone
2
2
 
3
- [![Build Status](https://travis-ci.org/ngscheurich/arkenstone.svg?branch=master)](https://travis-ci.org/ngscheurich/arkenstone)
4
- [![Code Climate](https://codeclimate.com/github/ngscheurich/arkenstone/badges/gpa.svg)](https://codeclimate.com/github/ngscheurich/arkenstone)
3
+ [![Build Status](https://circleci.com/gh/ngscheurich/arkenstone.svg?&style=shield)](https://circleci.com/gh/ngscheurich/arkenstone)
4
+ [![Code Coverage](https://codecov.io/github/ngscheurich/arkenstone/coverage.svg?branch=master)](https://codecov.io/github/ngscheurich/arkenstone?branch=master)
5
5
 
6
- The Arkenstone is a Ruby on Rails application generator set up to use my
7
- preferred development configuration. It is heavily influenced by thoughtbot’s
8
- Suspenders; I simply prefer to have something that I’ve pruned from infancy
9
- and just totally *get*, you know?
6
+ The Arkenstone is a Ruby on Rails development environment generator. Its
7
+ goal is to provide an easy way to spin up a new Vagrant box provisioned
8
+ for Rails development.
10
9
 
11
10
  ## Installation
12
11
 
13
- Add this line to your application’s Gemfile:
12
+ $ gem install arkenstone
14
13
 
15
- ```ruby
16
- gem "arkenstone"
17
- ```
14
+ ## Usage
18
15
 
19
- And then execute:
16
+ The Arkenstone provides you with the command line application `arkenstone`.
17
+ To create a new Arkenstone environment:
20
18
 
21
- $ bundle
19
+ $ arkenstone new path/to/app
22
20
 
23
- Or install it yourself with:
21
+ Check out the `arkenstone help new` option to see the available
22
+ configuration options.
24
23
 
25
- $ gem install arkenstone
24
+ Once, you’ve generated your new environment, `cd` over to `path/to/app`
25
+ and run:
26
26
 
27
- ## Usage
27
+ $ vagrant up
28
+
29
+ Now go grab a cup of coffee or a glass of Scotch—this part might take a
30
+ while. The Arkenstone is busy building a new Vagrant box and doing some
31
+ initial work for you like:
28
32
 
29
- The Arkenstone provides you with the command line application `arkenstone`,
30
- which behaves essentially like `rails new`. To create a Rails app with
31
- The Arkenstone, simply:
33
+ - Installing system software depencies
34
+ - Building and installing Ruby
35
+ - Installing and setting up PostgreSQL
36
+ - Generating a new Rails app with [Suspenders](https://github.com/thoughtbot/suspenders)
32
37
 
33
- $ arkenstone path/to/app
38
+ When your new environment is complete, SSH into it and fire up
39
+ the Rails server:
34
40
 
35
- Check out the `--help` option to see the available configuration options.
41
+ $ vagrant ssh
42
+ $ cd /vagrant && bin/rails server -b 0.0.0.0
43
+
44
+ You should now be able to visit your Rails app on your host machine at
45
+ [http://localhost:3001](http://localhost:3001). Voilà!
36
46
 
37
47
  ---
38
48
 
@@ -10,13 +10,11 @@ Gem::Specification.new do |spec|
10
10
  spec.author = "Nicholas Scheurich"
11
11
  spec.email = "nick@scheurich.me"
12
12
 
13
- spec.summary = "A Rails bootstrapper"
14
- spec.description = <<-EOS
15
- The Arkenstone is a Ruby on Rails application generator set up to use my
16
- preferred development configuration. It is heavily influenced by thoughtbot’s
17
- Suspenders; I simply prefer to have something that I’ve pruned from infancy
18
- and just totally *get*, you know?
19
- EOS
13
+ spec.summary = "A Rails development environment generator"
14
+ spec.description = <<-DESC
15
+ The Arkenstone is a Ruby on Rails development environment generator.
16
+ Its goal is to provide an easy way to spin up a new Vagrant box provisioned for Rails development.
17
+ DESC
20
18
  spec.homepage = "https://github.com/ngscheurich/arkenstone"
21
19
 
22
20
  spec.files = `git ls-files`.split("\n")
@@ -24,11 +22,10 @@ and just totally *get*, you know?
24
22
  spec.executables = ["arkenstone"]
25
23
  spec.require_paths = ["lib"]
26
24
 
27
- spec.add_runtime_dependency "rails", "~>4.2", ">=4.2.0"
28
-
29
- spec.add_development_dependency "bitters", "~> 0.1"
30
- spec.add_development_dependency "bundler", "~> 1.0"
25
+ spec.add_development_dependency "codecov", "~> 0"
31
26
  spec.add_development_dependency "pry", "~> 0.1"
32
27
  spec.add_development_dependency "rake", "~> 10.0"
33
28
  spec.add_development_dependency "rspec", "~> 3.4"
29
+ spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
30
+ spec.add_development_dependency "thor", "~> 0"
34
31
  end
@@ -7,15 +7,7 @@ $LOAD_PATH << source_path
7
7
 
8
8
  require "arkenstone"
9
9
 
10
- module Arkenstone
11
- class AppBuilder < Rails::AppBuilder
12
- GEM_PATH = (Pathname.new(__FILE__).dirname + "..").expand_path
13
- end
14
- end
15
-
16
10
  templates_relative = File.join("..", "lib/arkenstone/templates")
17
11
  templates_root = File.expand_path(templates_relative, File.dirname(__FILE__))
18
- Arkenstone::AppGenerator.source_root templates_root
19
- Arkenstone::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root
20
- Arkenstone::AppGenerator.source_paths << templates_root
21
- Arkenstone::AppGenerator.start
12
+ Arkenstone::Forge.source_root templates_root
13
+ Arkenstone::Forge.start(ARGV)
@@ -0,0 +1,9 @@
1
+ dependencies:
2
+ override:
3
+ - bin/setup
4
+ - git config --global user.email "test@circleci.com"
5
+ - git config --global user.name "CircleCI"
6
+
7
+ test:
8
+ override:
9
+ - bundle exec rspec -r rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml
@@ -1,6 +1,5 @@
1
1
  require "arkenstone/version"
2
- require "arkenstone/generators/app_generator"
3
- require "arkenstone/app_builder"
2
+ require "arkenstone/forge"
4
3
 
5
4
  begin
6
5
  require "pry"
@@ -0,0 +1,41 @@
1
+ require "thor"
2
+
3
+ module Arkenstone
4
+ class Forge < Thor
5
+ include Thor::Actions
6
+
7
+ PROVISIONERS = %w(ansible).freeze
8
+
9
+ option :box, type: :string, aliases: "-B", default: "ubuntu/trusty64",
10
+ desc: "Vagrant base box"
11
+
12
+ option :port, type: :numeric, default: "3001",
13
+ desc: "Port on the host to forward Rails server to"
14
+
15
+ option :provider, type: :string, aliases: "-P", default: "virtualbox",
16
+ desc: "Vagrant VM provider"
17
+
18
+ option :provisioner, type: :string, aliases: "-p", default: "ansible",
19
+ desc: "Vagrant provisioner (options: #{PROVISIONERS.join('/')})"
20
+
21
+ desc "new APP_PATH [options]", "Generate a new Rails environment at APP_PATH"
22
+ def new(app_path)
23
+ @app_path = app_path
24
+ vagrant
25
+ provisioner
26
+ end
27
+
28
+ private
29
+
30
+ def vagrant
31
+ template "Vagrantfile.erb", "#{@app_path}/Vagrantfile"
32
+ end
33
+
34
+ def provisioner
35
+ case options[:provisioner]
36
+ when "ansible"
37
+ directory "ansible", "#{@app_path}/provisioners/ansible"
38
+ end
39
+ end
40
+ end
41
+ end