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
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6
5
- before_script: git config --global user.email "travis@travis-ci.org" && git config --global user.name "Travis CI"
@@ -1,118 +0,0 @@
1
- module Arkenstone
2
- class AppBuilder < Rails::AppBuilder
3
- def gemfile
4
- template "Gemfile.erb", "Gemfile"
5
- end
6
-
7
- def readme
8
- template "README.md.erb", "README.md"
9
- end
10
-
11
- def set_ruby_version
12
- create_file ".ruby-version", "#{Arkenstone::RUBY_VERSION}\n"
13
- end
14
-
15
- def set_up_authentication
16
- template "user.rb", "app/models/user.rb"
17
- inject_into_file(
18
- "app/controllers/application_controller.rb",
19
- " include Clearance::Controller\n\n",
20
- after: "class ApplicationController < ActionController::Base"
21
- )
22
- end
23
-
24
- def create_simple_form_files
25
- copy_file "simple_form.rb", "config/initializers/simple_form.rb"
26
- copy_file "simple_form.en.yml", "config/locales/simple_form.en.yml"
27
- copy_file "_form.html.erb", "lib/templates/html/scaffold/_form.html.erb"
28
- end
29
-
30
- def set_up_database
31
- template "database.yml.erb", "config/database.yml",
32
- force: true
33
- end
34
-
35
- def customize_application_layout
36
- template "application.html.erb", "app/views/layouts/application.html.erb",
37
- force: true
38
- end
39
-
40
- def config_travis_ci
41
- template ".travis.yml.erb", ".travis.yml"
42
- end
43
-
44
- def create_partials_directory
45
- empty_directory "app/views/application"
46
- end
47
-
48
- def create_flashes_partial
49
- copy_file "_flashes.html.erb", "app/views/application/_flashes.html.erb"
50
- end
51
-
52
- def create_factories_file
53
- copy_file "factories.rb", "spec/factories.rb"
54
- end
55
-
56
- def set_up_rspec
57
- bundle_command "exec rails generate rspec:install"
58
- end
59
-
60
- def customize_rails_helper
61
- remove_file "spec/rails_helper.rb"
62
- copy_file "rails_helper.rb", "spec/rails_helper.rb"
63
- end
64
-
65
- def set_up_database_cleaner
66
- copy_file "database_cleaner.rb", "spec/support/database_cleaner.rb"
67
- end
68
-
69
- def clean_up_ruby_files
70
- files = `grep '^ *#[^!]' -l -r --include=*.rb .`.split("\n")
71
-
72
- files.each do |file|
73
- gsub_file file, /^ *#.*\n/, ""
74
- gsub_file file, /\n$/, ""
75
- end
76
- end
77
-
78
- def set_up_style_sheets
79
- remove_file "app/assets/stylesheets/application.css"
80
- copy_file "application.scss",
81
- "app/assets/stylesheets/application.scss"
82
- end
83
-
84
- def set_up_bitters
85
- run "bitters install --path app/assets/stylesheets"
86
- end
87
-
88
- def configure_locale
89
- template "en.yml.erb", "config/locales/en.yml",
90
- force: true
91
- end
92
-
93
- def create_home_page
94
- template "home.html.erb", "app/views/pages/home.html.erb"
95
- copy_file "high_voltage.rb", "config/initializers/high_voltage.rb"
96
- end
97
-
98
- def create_binstubs
99
- copy_file "rails", "bin/rails", force: true
100
- copy_file "rake", "bin/rake", force: true
101
- copy_file "spring", "bin/spring"
102
- end
103
-
104
- def initialize_git_repo
105
- git :init
106
- end
107
-
108
- def create_initial_git_commit
109
- git add: "."
110
- git commit: "-m 'Initial commit [via Arkenstone]'"
111
- end
112
-
113
- def create_github_repo
114
- run "hub create"
115
- git push: "origin master"
116
- end
117
- end
118
- end
@@ -1,56 +0,0 @@
1
- require "rails/generators"
2
- require "rails/generators/rails/app/app_generator"
3
-
4
- module Arkenstone
5
- class AppGenerator < Rails::Generators::AppGenerator
6
- class_option :skip_test, type: :boolean, aliases: "-T", default: true,
7
- desc: "Skip test files"
8
-
9
- class_option :skip_spring, type: :boolean, default: true,
10
- desc: "Don't install Spring application preloader"
11
-
12
- class_option :authentication, type: :boolean, aliases: "-A", default: false,
13
- desc: "Create User model and configure authentication"
14
-
15
- class_option :database, type: :string, aliases: "-d", default: "postgresql",
16
- desc: "Configure for selected database (options: #{DATABASES.join("/")})"
17
-
18
- class_option :github, type: :boolean, aliases: "-H", default: false,
19
- desc: "Create a GitHub repository with the same name as the project"
20
-
21
- def finish_template
22
- invoke :forge_the_arkenstone
23
- super
24
- end
25
-
26
- def forge_the_arkenstone
27
- build :set_ruby_version
28
- build :set_up_authentication if options[:authentication]
29
- build :create_simple_form_files
30
- build :customize_application_layout
31
- build :set_up_database
32
- build :config_travis_ci
33
- build :create_factories_file
34
- build :create_partials_directory
35
- build :create_flashes_partial
36
- build :set_up_rspec
37
- build :customize_rails_helper
38
- build :set_up_database_cleaner
39
- build :clean_up_ruby_files
40
- build :set_up_style_sheets
41
- build :set_up_bitters
42
- build :configure_locale
43
- build :create_home_page
44
- build :create_binstubs
45
- build :initialize_git_repo
46
- build :create_initial_git_commit
47
- build :create_github_repo if options[:github]
48
- end
49
-
50
- protected
51
-
52
- def get_builder_class
53
- Arkenstone::AppBuilder
54
- end
55
- end
56
- end
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - <%= Arkenstone::RUBY_VERSION %>
@@ -1,52 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- ruby "<%= Arkenstone::RUBY_VERSION %>"
4
-
5
- gem "autoprefixer-rails"
6
- gem "bitters"
7
- gem "bourbon"
8
- gem "coffee-rails", "~> 4.1.0"
9
- gem "flutie"
10
- gem "haml-rails", "~> 0.9"
11
- gem "high_voltage"
12
- gem "jbuilder", "~> 2.0"
13
- gem "jquery-rails"
14
- gem "neat"
15
- gem "normalize-rails", "~> 3.0.0"
16
- gem "pg"
17
- gem "puma"
18
- gem "rails", "4.2.4"
19
- gem "sass-rails", "~> 5.0"
20
- gem "simple_form", "3.2.1"
21
- gem "title"
22
- gem "sdoc", "~> 0.4.0", group: :doc
23
- gem "sqlite3"
24
- gem "turbolinks"
25
- gem "uglifier", ">= 1.3.0"
26
-
27
- <% if options[:authentication] %>
28
- gem "clearance"
29
- <% end %>
30
-
31
- group :development do
32
- gem "faker"
33
- gem "spring"
34
- gem "quiet_assets"
35
- gem "web-console", "~> 2.0"
36
- end
37
-
38
- group :development, :test do
39
- gem "awesome_print"
40
- gem "dotenv-rails"
41
- gem "factory_girl_rails"
42
- gem "pry-byebug"
43
- gem "pry-rails"
44
- gem "rspec-rails", "~> 3.4.0"
45
- end
46
-
47
- group :test do
48
- gem "capybara-webkit"
49
- gem "database_cleaner"
50
- gem "shoulda-matchers"
51
- gem "timecop"
52
- end
@@ -1 +0,0 @@
1
- # <%= app_name %>
@@ -1,3 +0,0 @@
1
- <% flash.each do |key, value| %>
2
- <div class="flash flash--#{key}"><%= value %></div>
3
- <% end %>
@@ -1,13 +0,0 @@
1
- <%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2
- <%%= f.error_notification %>
3
-
4
- <div class="form-inputs">
5
- <%- attributes.each do |attribute| -%>
6
- <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7
- <%- end -%>
8
- </div>
9
-
10
- <div class="form-actions">
11
- <%%= f.button :submit %>
12
- </div>
13
- <%% end %>
@@ -1,16 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="<%= I18n.locale %>">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="ROBOTS" content="NOODP" />
6
- <meta name="viewport" content="initial-scale=1" />
7
- <title><%%= page_title %></title>
8
- <%%= stylesheet_link_tag "application", media: "all" %>
9
- <%%= csrf_meta_tags %>
10
- </head>
11
-
12
- <body class="<%%= body_class %>">
13
- <%%= yield %>
14
- <%%= javascript_include_tag "application" %>
15
- </body>
16
- </html>
@@ -1,7 +0,0 @@
1
- @charset "utf-8";
2
-
3
- @import "normalize-rails";
4
- @import "bourbon";
5
- @import "base/grid-settings";
6
- @import "neat";
7
- @import "base/base";
@@ -1,12 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- encoding: unicode
4
- pool: 5
5
-
6
- development:
7
- <<: *default
8
- database: <%= app_name %>_development
9
-
10
- test:
11
- <<: *default
12
- database: <%= app_name %>_test
@@ -1,21 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before(:suite) do
3
- DatabaseCleaner.clean_with(:deletion)
4
- end
5
-
6
- config.before(:each) do
7
- DatabaseCleaner.strategy = :transaction
8
- end
9
-
10
- config.before(:each, js: true) do
11
- DatabaseCleaner.strategy = :deletion
12
- end
13
-
14
- config.before(:each) do
15
- DatabaseCleaner.start
16
- end
17
-
18
- config.after(:each) do
19
- DatabaseCleaner.clean
20
- end
21
- end
@@ -1,3 +0,0 @@
1
- en:
2
- titles:
3
- application: <%= app_name.humanize.titleize %>
@@ -1,2 +0,0 @@
1
- FactoryGirl.define do
2
- end
@@ -1,4 +0,0 @@
1
- HighVoltage.configure do |config|
2
- config.home_page = "home"
3
- end
4
- 2
@@ -1,2 +0,0 @@
1
- <h1><%= app_name %></h1>
2
- <p>You can find me at app/views/pages/home.html.erb.</p>
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
- APP_PATH = File.expand_path('../../config/application', __FILE__)
8
- require_relative '../config/boot'
9
- require 'rails/commands'
@@ -1,16 +0,0 @@
1
- ENV["RAILS_ENV"] ||= "test"
2
- require File.expand_path("../../config/environment", __FILE__)
3
- abort("The Rails environment is running in production mode!") if Rails.env.production?
4
- require "spec_helper"
5
- require "rspec/rails"
6
-
7
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
8
-
9
- ActiveRecord::Migration.maintain_test_schema!
10
-
11
- RSpec.configure do |config|
12
- config.use_transactional_fixtures = false
13
- config.infer_spec_type_from_file_location!
14
- config.filter_rails_from_backtrace!
15
- config.include Features, type: :feature
16
- end
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
- require_relative '../config/boot'
8
- require 'rake'
9
- Rake.application.run
@@ -1,31 +0,0 @@
1
- en:
2
- simple_form:
3
- "yes": 'Yes'
4
- "no": 'No'
5
- required:
6
- text: 'required'
7
- mark: '*'
8
- # You can uncomment the line below if you need to overwrite the whole required html.
9
- # When using html, text and mark won't be used.
10
- # html: '<abbr title="required">*</abbr>'
11
- error_notification:
12
- default_message: "Please review the problems below:"
13
- # Examples
14
- # labels:
15
- # defaults:
16
- # password: 'Password'
17
- # user:
18
- # new:
19
- # email: 'E-mail to sign in.'
20
- # edit:
21
- # email: 'E-mail.'
22
- # hints:
23
- # defaults:
24
- # username: 'User name to sign in.'
25
- # password: 'No special characters, please.'
26
- # include_blanks:
27
- # defaults:
28
- # age: 'Rather not say'
29
- # prompts:
30
- # defaults:
31
- # age: 'Select your age'
@@ -1,165 +0,0 @@
1
- # Use this setup block to configure all options available in SimpleForm.
2
- SimpleForm.setup do |config|
3
- # Wrappers are used by the form builder to generate a
4
- # complete input. You can remove any component from the
5
- # wrapper, change the order or even add your own to the
6
- # stack. The options given below are used to wrap the
7
- # whole input.
8
- config.wrappers :default, class: :input,
9
- hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
- ## Extensions enabled by default
11
- # Any of these extensions can be disabled for a
12
- # given input by passing: `f.input EXTENSION_NAME => false`.
13
- # You can make any of these extensions optional by
14
- # renaming `b.use` to `b.optional`.
15
-
16
- # Determines whether to use HTML5 (:email, :url, ...)
17
- # and required attributes
18
- b.use :html5
19
-
20
- # Calculates placeholders automatically from I18n
21
- # You can also pass a string as f.input placeholder: "Placeholder"
22
- b.use :placeholder
23
-
24
- ## Optional extensions
25
- # They are disabled unless you pass `f.input EXTENSION_NAME => true`
26
- # to the input. If so, they will retrieve the values from the model
27
- # if any exists. If you want to enable any of those
28
- # extensions by default, you can change `b.optional` to `b.use`.
29
-
30
- # Calculates maxlength from length validations for string inputs
31
- b.optional :maxlength
32
-
33
- # Calculates pattern from format validations for string inputs
34
- b.optional :pattern
35
-
36
- # Calculates min and max from length validations for numeric inputs
37
- b.optional :min_max
38
-
39
- # Calculates readonly automatically from readonly attributes
40
- b.optional :readonly
41
-
42
- ## Inputs
43
- b.use :label_input
44
- b.use :hint, wrap_with: { tag: :span, class: :hint }
45
- b.use :error, wrap_with: { tag: :span, class: :error }
46
-
47
- ## full_messages_for
48
- # If you want to display the full error message for the attribute, you can
49
- # use the component :full_error, like:
50
- #
51
- # b.use :full_error, wrap_with: { tag: :span, class: :error }
52
- end
53
-
54
- # The default wrapper to be used by the FormBuilder.
55
- config.default_wrapper = :default
56
-
57
- # Define the way to render check boxes / radio buttons with labels.
58
- # Defaults to :nested for bootstrap config.
59
- # inline: input + label
60
- # nested: label > input
61
- config.boolean_style = :nested
62
-
63
- # Default class for buttons
64
- config.button_class = 'btn'
65
-
66
- # Method used to tidy up errors. Specify any Rails Array method.
67
- # :first lists the first message for each field.
68
- # Use :to_sentence to list all errors for each field.
69
- # config.error_method = :first
70
-
71
- # Default tag used for error notification helper.
72
- config.error_notification_tag = :div
73
-
74
- # CSS class to add for error notification helper.
75
- config.error_notification_class = 'error_notification'
76
-
77
- # ID to add for error notification helper.
78
- # config.error_notification_id = nil
79
-
80
- # Series of attempts to detect a default label method for collection.
81
- # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
82
-
83
- # Series of attempts to detect a default value method for collection.
84
- # config.collection_value_methods = [ :id, :to_s ]
85
-
86
- # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
87
- # config.collection_wrapper_tag = nil
88
-
89
- # You can define the class to use on all collection wrappers. Defaulting to none.
90
- # config.collection_wrapper_class = nil
91
-
92
- # You can wrap each item in a collection of radio/check boxes with a tag,
93
- # defaulting to :span.
94
- # config.item_wrapper_tag = :span
95
-
96
- # You can define a class to use in all item wrappers. Defaulting to none.
97
- # config.item_wrapper_class = nil
98
-
99
- # How the label text should be generated altogether with the required text.
100
- # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
101
-
102
- # You can define the class to use on all labels. Default is nil.
103
- # config.label_class = nil
104
-
105
- # You can define the default class to be used on forms. Can be overriden
106
- # with `html: { :class }`. Defaulting to none.
107
- # config.default_form_class = nil
108
-
109
- # You can define which elements should obtain additional classes
110
- # config.generate_additional_classes_for = [:wrapper, :label, :input]
111
-
112
- # Whether attributes are required by default (or not). Default is true.
113
- # config.required_by_default = true
114
-
115
- # Tell browsers whether to use the native HTML5 validations (novalidate form option).
116
- # These validations are enabled in SimpleForm's internal config but disabled by default
117
- # in this configuration, which is recommended due to some quirks from different browsers.
118
- # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
119
- # change this configuration to true.
120
- config.browser_validations = false
121
-
122
- # Collection of methods to detect if a file type was given.
123
- # config.file_methods = [ :mounted_as, :file?, :public_filename ]
124
-
125
- # Custom mappings for input types. This should be a hash containing a regexp
126
- # to match as key, and the input type that will be used when the field name
127
- # matches the regexp as value.
128
- # config.input_mappings = { /count/ => :integer }
129
-
130
- # Custom wrappers for input types. This should be a hash containing an input
131
- # type as key and the wrapper that will be used for all inputs with specified type.
132
- # config.wrapper_mappings = { string: :prepend }
133
-
134
- # Namespaces where SimpleForm should look for custom input classes that
135
- # override default inputs.
136
- # config.custom_inputs_namespaces << "CustomInputs"
137
-
138
- # Default priority for time_zone inputs.
139
- # config.time_zone_priority = nil
140
-
141
- # Default priority for country inputs.
142
- # config.country_priority = nil
143
-
144
- # When false, do not use translations for labels.
145
- # config.translate_labels = true
146
-
147
- # Automatically discover new inputs in Rails' autoload path.
148
- # config.inputs_discovery = true
149
-
150
- # Cache SimpleForm inputs discovery
151
- # config.cache_discovery = !Rails.env.development?
152
-
153
- # Default class for inputs
154
- # config.input_class = nil
155
-
156
- # Define the default class of the input wrapper of the boolean input.
157
- config.boolean_label_class = 'checkbox'
158
-
159
- # Defines if the default input wrapper class should be included in radio
160
- # collection wrappers.
161
- # config.include_default_input_wrapper_class = true
162
-
163
- # Defines which i18n scope will be used in Simple Form.
164
- # config.i18n_scope = 'simple_form'
165
- end