arkenstone 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +19 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1148 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +3 -0
- data/LICENSE +674 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/arkenstone.gemspec +34 -0
- data/bin/arkenstone +21 -0
- data/bin/console +7 -0
- data/bin/setup +7 -0
- data/lib/arkenstone.rb +12 -0
- data/lib/arkenstone/app_builder.rb +118 -0
- data/lib/arkenstone/generators/app_generator.rb +56 -0
- data/lib/arkenstone/templates/.travis.yml.erb +3 -0
- data/lib/arkenstone/templates/Gemfile.erb +52 -0
- data/lib/arkenstone/templates/README.md.erb +1 -0
- data/lib/arkenstone/templates/_flashes.html.erb +3 -0
- data/lib/arkenstone/templates/_form.html.erb +13 -0
- data/lib/arkenstone/templates/application.html.erb +16 -0
- data/lib/arkenstone/templates/application.scss +7 -0
- data/lib/arkenstone/templates/database.yml.erb +12 -0
- data/lib/arkenstone/templates/database_cleaner.rb +21 -0
- data/lib/arkenstone/templates/en.yml.erb +3 -0
- data/lib/arkenstone/templates/factories.rb +2 -0
- data/lib/arkenstone/templates/high_voltage.rb +4 -0
- data/lib/arkenstone/templates/home.html.erb +2 -0
- data/lib/arkenstone/templates/rails +9 -0
- data/lib/arkenstone/templates/rails_helper.rb +16 -0
- data/lib/arkenstone/templates/rake +9 -0
- data/lib/arkenstone/templates/simple_form.en.yml +31 -0
- data/lib/arkenstone/templates/simple_form.rb +165 -0
- data/lib/arkenstone/templates/spring +15 -0
- data/lib/arkenstone/templates/user.rb +3 -0
- data/lib/arkenstone/version.rb +5 -0
- data/spec/arkenstone_spec.rb +7 -0
- data/spec/features/new_project_spec.rb +136 -0
- data/spec/features/new_project_with_authentication_spec.rb +24 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/support/features/new_project.rb +57 -0
- metadata +183 -0
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Arkenstone
|
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)
|
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?
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application’s Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "arkenstone"
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself with:
|
24
|
+
|
25
|
+
$ gem install arkenstone
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
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:
|
32
|
+
|
33
|
+
$ arkenstone path/to/app
|
34
|
+
|
35
|
+
Check out the `--help` option to see the available configuration options.
|
36
|
+
|
37
|
+
---
|
38
|
+
|
39
|
+
[(ↄ) Copyleft](http://www.gnu.org/licenses/copyleft.en.html)
|
40
|
+
Nicholas Gunther Scheurich under the
|
41
|
+
[GNU General Public License](http://www.gnu.org/licenses/gpl.txt)
|
data/Rakefile
ADDED
data/arkenstone.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "arkenstone/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "arkenstone"
|
8
|
+
spec.version = Arkenstone::VERSION
|
9
|
+
spec.license = "GPL-3.0"
|
10
|
+
spec.author = "Nicholas Scheurich"
|
11
|
+
spec.email = "nick@scheurich.me"
|
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
|
20
|
+
spec.homepage = "https://github.com/ngscheurich/arkenstone"
|
21
|
+
|
22
|
+
spec.files = `git ls-files`.split("\n")
|
23
|
+
spec.bindir = "bin"
|
24
|
+
spec.executables = ["arkenstone"]
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
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"
|
31
|
+
spec.add_development_dependency "pry", "~> 0.1"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
34
|
+
end
|
data/bin/arkenstone
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
|
5
|
+
source_path = (Pathname.new(__FILE__).dirname + "../lib").expand_path
|
6
|
+
$LOAD_PATH << source_path
|
7
|
+
|
8
|
+
require "arkenstone"
|
9
|
+
|
10
|
+
module Arkenstone
|
11
|
+
class AppBuilder < Rails::AppBuilder
|
12
|
+
GEM_PATH = (Pathname.new(__FILE__).dirname + "..").expand_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
templates_relative = File.join("..", "lib/arkenstone/templates")
|
17
|
+
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
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/arkenstone.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "arkenstone/version"
|
2
|
+
require "arkenstone/generators/app_generator"
|
3
|
+
require "arkenstone/app_builder"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "pry"
|
7
|
+
rescue LoadError
|
8
|
+
puts "Pry is not installed; debugging via `binding.pry` will not be available."
|
9
|
+
end
|
10
|
+
|
11
|
+
module Arkenstone
|
12
|
+
end
|
@@ -0,0 +1,118 @@
|
|
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
|
@@ -0,0 +1,56 @@
|
|
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
|
@@ -0,0 +1,52 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= app_name %>
|
@@ -0,0 +1,13 @@
|
|
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 %>
|
@@ -0,0 +1,16 @@
|
|
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>
|
@@ -0,0 +1,21 @@
|
|
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
|