siracha 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/README.md +68 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/siracha +21 -0
- data/lib/generators/css_framework.rb +25 -0
- data/lib/siracha.rb +10 -0
- data/lib/siracha/action_methods.rb +4 -0
- data/lib/siracha/app_builder.rb +47 -0
- data/lib/siracha/app_generator.rb +25 -0
- data/lib/siracha/before_build.rb +20 -0
- data/lib/siracha/version.rb +5 -0
- data/lib/steps/1_add_gems.rb +41 -0
- data/lib/steps/2_simple_form.rb +6 -0
- data/lib/steps/3_devise.rb +9 -0
- data/lib/steps/lints.rb +2 -0
- data/lib/steps/rubocop.rb +8 -0
- data/lib/steps/test_configuration.rb +7 -0
- data/remove_comments.thor +13 -0
- data/siracha-0.1.0.gem +0 -0
- data/siracha.gemspec +37 -0
- data/templates/Gemfile.development +19 -0
- data/templates/Procfile +2 -0
- data/templates/bootstrap/stylesheets/_variables.scss +0 -0
- data/templates/bootstrap/stylesheets/application.scss +3 -0
- data/templates/dotfiles/.csscomb.json +237 -0
- data/templates/dotfiles/.editorconfig +14 -0
- data/templates/dotfiles/.eslintignore +5 -0
- data/templates/dotfiles/.eslintrc.json +333 -0
- data/templates/dotfiles/.haml-lint.yml +121 -0
- data/templates/dotfiles/.postcssrc.yml +4 -0
- data/templates/dotfiles/.rubocop.yml +225 -0
- data/templates/dotfiles/.scss-lint.yml +187 -0
- data/templates/dotfiles/.stylelintrc +84 -0
- data/templates/dotfiles/sass-lint.yml +124 -0
- data/templates/rubocop/.rubocop.yml.erb +222 -0
- data/templates/spec/rails_helper.rb +80 -0
- data/templates/spec/spec_helper.rb +104 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5c8f69c64e776fa145d537cd98f3ee8a3066144
|
4
|
+
data.tar.gz: cb5c5414ce3f1a98e2864f43320466502b542704
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 570dfd42c3b9d57254710b19b314fed666c00cd86fc733bfef04a601a2ff4d941f27c2f644630f95070ceacf914e7068d54515c8df4bf6b47cce1e704eab7f22
|
7
|
+
data.tar.gz: 9059f95d50459be07f28f14e775daffc2dfde4f4ffcec68bcd50ffdf2c20325ce9a746c858fe62a055348ccd1874519f9bf217a6acdc2c011014c413fa4064e5
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at quydoantran@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
## Siracha
|
2
|
+
|
3
|
+
Siracha is a rails generator I create to init project with `project_name` and some practice gems that I usually used.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install siracha:
|
8
|
+
|
9
|
+
gem install siracha
|
10
|
+
|
11
|
+
Then run:
|
12
|
+
|
13
|
+
siracha projectname
|
14
|
+
|
15
|
+
to create a rails app.
|
16
|
+
|
17
|
+
Rails application will be generate with gems:
|
18
|
+
|
19
|
+
- [Simple form][simpleform]
|
20
|
+
- [Devise][devise]
|
21
|
+
- [Cucumber][cucumber]
|
22
|
+
- [Rspec][rspec]
|
23
|
+
- [haml-lint][haml-lint]
|
24
|
+
- [scss-lint][scss_lint]
|
25
|
+
- [Rubocop][rubocop]
|
26
|
+
- [foreman][foreman]
|
27
|
+
- [benchmark-ips][benchmark-ips]
|
28
|
+
- [knapsack][knapsack]
|
29
|
+
- [stackprof][stackprof]
|
30
|
+
- [factory_girl][factory_girl]
|
31
|
+
- [Autoprefixer Rails][autoprefix-rails]
|
32
|
+
- [Title][title-gem]
|
33
|
+
- [Bundler Audit][bundler-audit]
|
34
|
+
- [Timecop][timecop] for testing time
|
35
|
+
|
36
|
+
run `siracha --help` for more info
|
37
|
+
|
38
|
+
## Using
|
39
|
+
|
40
|
+
I make it for me to be easier to add configuration step for generating next project. So I split each setting in to files.
|
41
|
+
You can add your setting by create a new file to `steps`.
|
42
|
+
|
43
|
+
## TODO
|
44
|
+
|
45
|
+
- [ ] Init Angular4 app
|
46
|
+
- [ ] Init Reactjs app with Redux, GraphQL, Immutable, and Replay
|
47
|
+
- [ ] Deploy to heroku
|
48
|
+
- [ ] Dockers
|
49
|
+
|
50
|
+
|
51
|
+
[simpleform]: https://github.com/plataformatec/simple_form
|
52
|
+
[devise]: https://github.com/plataformatec/devise
|
53
|
+
[cucumber]: https://github.com/cucumber/cucumber
|
54
|
+
[rspec]: https://github.com/rspec/rspec
|
55
|
+
[haml-lint]: https://github.com/brigade/haml-lint
|
56
|
+
[scss_lint]: https://github.com/brigade/scss-lint
|
57
|
+
[rubocop]: https://github.com/bbatsov/rubocop
|
58
|
+
[foreman]: https://github.com/ddollar/foreman
|
59
|
+
[benchmark-ips]: https://github.com/evanphx/benchmark-ips
|
60
|
+
[knapsack]: https://github.com/ArturT/knapsack
|
61
|
+
[stackprof]: https://github.com/tmm1/stackprof
|
62
|
+
[factory_girl]: https://github.com/thoughtbot/factory_girl
|
63
|
+
[autoprefix-rails]: https://github.com/ai/autoprefixer-rails
|
64
|
+
[title-gem]: https://github.com/calebthompson/title
|
65
|
+
[bundler-audit]: https://github.com/rubysec/bundler-audit
|
66
|
+
[timecop]: https://github.com/travisjeffery/timecop
|
67
|
+
|
68
|
+
[material]: https://material.angular.io/
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "siracha"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/siracha
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
5
|
+
$LOAD_PATH << source_path
|
6
|
+
|
7
|
+
require 'siracha'
|
8
|
+
if ARGV.empty?
|
9
|
+
puts "Please provide a path for the new application"
|
10
|
+
puts
|
11
|
+
puts "See --help for more info"
|
12
|
+
exit 0
|
13
|
+
elsif ['-v', '--version'].include? ARGV[0]
|
14
|
+
puts Siracha::VERSION
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
19
|
+
Siracha::AppGenerator.source_root templates_root
|
20
|
+
Siracha::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
21
|
+
Siracha::AppGenerator.start
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Siracha
|
2
|
+
module Generators
|
3
|
+
class BootstrapGenerator < Rails::Generators::AppBase
|
4
|
+
hide!
|
5
|
+
source_root File.expand_path("../../../templates/bootstrap", __FILE__)
|
6
|
+
|
7
|
+
def add_gems
|
8
|
+
gem 'bootstrap-sass', '~> 3.3.7'
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_bundle_install
|
12
|
+
bundle_command('install')
|
13
|
+
end
|
14
|
+
|
15
|
+
def css_template
|
16
|
+
remove_file('app/assets/stylesheets/application.css')
|
17
|
+
directory 'stylesheets', 'app/assets/stylesheets'
|
18
|
+
end
|
19
|
+
|
20
|
+
def js_configuration
|
21
|
+
gsub_file('app/assets/javascripts/application.js', Regexp.escape(%q(//= require_tree .)), "\n//= require bootstrap-sprockets\n")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/siracha.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
require 'siracha/version'
|
4
|
+
|
5
|
+
require 'generators/css_framework'
|
6
|
+
module Siracha
|
7
|
+
autoload :ActionMethods, 'siracha/action_methods'
|
8
|
+
autoload :AppBuilder, 'siracha/app_builder'
|
9
|
+
autoload :AppGenerator, 'siracha/app_generator'
|
10
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Siracha
|
2
|
+
class AppBuilder < ::Rails::AppBuilder
|
3
|
+
|
4
|
+
def app
|
5
|
+
before_build_app
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def leftovers
|
10
|
+
configure_generators
|
11
|
+
set_ruby_to_version_being_used
|
12
|
+
Dir[load_file_root + '/*.rb'].each do |file|
|
13
|
+
apply file
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_file_root
|
18
|
+
File.expand_path("../steps/", File.dirname(__FILE__))
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def before_build_app
|
24
|
+
apply File.join(__dir__, 'before_build.rb')
|
25
|
+
end
|
26
|
+
|
27
|
+
def configure_generators
|
28
|
+
config = <<-RUBY
|
29
|
+
config.generators do |generate|
|
30
|
+
generate.helper false
|
31
|
+
generate.javascripts false
|
32
|
+
generate.request_specs false
|
33
|
+
generate.routing_specs false
|
34
|
+
generate.stylesheets false
|
35
|
+
generate.test_framework :rspec
|
36
|
+
generate.view_specs false
|
37
|
+
end
|
38
|
+
RUBY
|
39
|
+
inject_into_class 'config/application.rb', 'Application', config
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_ruby_to_version_being_used
|
43
|
+
create_file '.ruby-version', "#{Siracha::RUBY_VERSION}\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Siracha
|
2
|
+
class AppGenerator < ::Rails::Generators::AppGenerator
|
3
|
+
# Default database is postgres
|
4
|
+
hide!
|
5
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql",
|
6
|
+
desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
7
|
+
|
8
|
+
class_option :devise, type: :string, default: nil, banner: 'ModelName',
|
9
|
+
desc: "Preconfigure for authorization default user"
|
10
|
+
|
11
|
+
class_option :webpack, type: :string, default: 'react',
|
12
|
+
desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"
|
13
|
+
|
14
|
+
# hook_for :css_framework, default: 'bootstrap'
|
15
|
+
|
16
|
+
private
|
17
|
+
def get_builder_class
|
18
|
+
Siracha::AppBuilder
|
19
|
+
end
|
20
|
+
|
21
|
+
def template_folder
|
22
|
+
File.expand_path( '../../templates/', __dir__)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Check if nodejs had installed
|
2
|
+
%w[yarn node].each do |app|
|
3
|
+
if `which #{app}`.blank?
|
4
|
+
say("requires to install #{app}", :red)
|
5
|
+
exit!
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
node_version = `node -v`.scan(/[\d\.]+/).first
|
10
|
+
if node_version.to_f < 6.4
|
11
|
+
say("requires Node.js >= v6.4 and you are using #{node_version}.", :red)
|
12
|
+
exit!
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
@install_devise = yes?("Do you want to install devise?")
|
17
|
+
|
18
|
+
@devise_modal_name = ask("What is devise modal name[user]?")
|
19
|
+
|
20
|
+
@install_rubocop = yes?("Do you want to add rubocop?")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
gem 'title'
|
2
|
+
gem 'webpacker'
|
3
|
+
gem 'nokogiri'
|
4
|
+
|
5
|
+
data_development_test_gem_group = <<-GEMGROUP
|
6
|
+
gem 'foreman'
|
7
|
+
gem 'brakeman', require: false
|
8
|
+
GEMGROUP
|
9
|
+
|
10
|
+
insert_into_file('Gemfile', "\n" + data_development_test_gem_group, after: /group\s?\:development,\s?\:test\s+do/)
|
11
|
+
insert_into_file('Gemfile', "\n" + File.read(File.join(template_folder, 'Gemfile.development')), after: /group\s?\:development\s+do/)
|
12
|
+
|
13
|
+
gem_group :test do
|
14
|
+
gem 'capybara-webkit', version: '~> 1.14.0'
|
15
|
+
gem 'cucumber-rails', require: false
|
16
|
+
gem 'rspec-rails', version: '~> 3.6.0'
|
17
|
+
gem 'spreewald'
|
18
|
+
gem 'poltergeist', version: '~> 1.9.0'
|
19
|
+
gem 'capybara-screenshot', version: '~> 1.0.0'
|
20
|
+
gem 'fuubar', version: '~> 2.2.0'
|
21
|
+
gem 'rspec-retry'
|
22
|
+
gem 'rspec_profiling'
|
23
|
+
gem 'rspec-set'
|
24
|
+
gem 'database_cleaner'
|
25
|
+
gem 'formulaic'
|
26
|
+
gem 'launchy'
|
27
|
+
gem 'shoulda-matchers'
|
28
|
+
gem 'email_spec'
|
29
|
+
gem 'json-schema'
|
30
|
+
gem 'sham_rack'
|
31
|
+
gem 'timecop'
|
32
|
+
gem 'webmock'
|
33
|
+
gem 'spinacks'
|
34
|
+
end
|
35
|
+
|
36
|
+
gem_group :development, :staging do
|
37
|
+
gem 'rack-mini-profiler', require: false
|
38
|
+
end
|
39
|
+
|
40
|
+
# Add Procfile
|
41
|
+
template 'Procfile', 'Procfile'
|