Skip to content

Commit 65623d6

Browse files
committed
Gem setup
1 parent f5aa88f commit 65623d6

72 files changed

Lines changed: 141 additions & 994 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
.bundle/
2-
log/*.log
3-
pkg/
4-
test/dummy/db/*.sqlite3
5-
test/dummy/db/*.sqlite3-journal
6-
test/dummy/db/*.sqlite3-*
7-
test/dummy/log/*.log
8-
test/dummy/storage/
9-
test/dummy/tmp/
1+
*.gem
2+
*.orig
3+
4+
/.rspec_failures
5+
/.rubocop-*
6+
/Gemfile.lock
7+
8+
/_misc/
9+
/coverage/
10+
11+
/.bundle/
12+
/log/*.log
13+
/pkg/
14+
/test/dummy/db/*.sqlite3
15+
/test/dummy/db/*.sqlite3-journal
16+
/test/dummy/db/*.sqlite3-*
17+
/test/dummy/log/*.log
18+
/test/dummy/storage/
19+
/test/dummy/tmp/

.rubocop.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
inherit_from:
2+
- https://relaxed.ruby.style/rubocop.yml
3+
4+
AllCops:
5+
Exclude:
6+
- bin/*
7+
8+
Gemspec/RequiredRubyVersion:
9+
Enabled: false
10+
11+
Naming/FileName:
12+
Enabled: false
13+
14+
Layout/LineLength:
15+
Enabled: true
16+
Max: 120
17+
18+
Style/HashEachMethods:
19+
Enabled: true
20+
21+
Style/HashTransformKeys:
22+
Enabled: true
23+
24+
Style/HashTransformValues:
25+
Enabled: true

Gemfile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3-
4-
# Declare your gem's dependencies in administrate-materialize-theme.gemspec.
5-
# Bundler will treat runtime dependencies like base dependencies, and
6-
# development dependencies will be added by default to the :development group.
75
gemspec
8-
9-
# Declare any dependencies that are still in development here instead of in
10-
# your gemspec. These might include edge Rails or gems from your path or
11-
# Git. Remember to move these dependencies to your gemspec before releasing
12-
# your gem to rubygems.org.
13-
14-
# To use a debugger
15-
# gem 'byebug', group: [:development, :test]

README.md

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
1-
# Administrate::Materialize::Theme
2-
Short description and motivation.
1+
# Administrate Materialize Theme
2+
A Material theme form [Administrate](https://github.com/thoughtbot/administrate), based on [Materialize](https://materializecss.com) framework.
33

4-
## Usage
5-
How to use my plugin.
4+
Features:
5+
- Material design responsive theme;
6+
- customizable using SASS variables;
7+
- allow to use *Materialize* in the admin.
8+
9+
![screenshot](screenshot.png)
610

711
## Installation
8-
Add this line to your application's Gemfile:
12+
- If not already installed Administrate, set it up
13+
- Add to *Gemfile*: `gem 'administrate-materialize-theme'` (and execute `bundle`)
14+
- Edit *app/assets/config/manifest.js*, adding at the end:
915

10-
```ruby
11-
gem 'administrate-materialize-theme'
16+
```js
17+
//= link administrate-materialize-theme/theme.css
18+
//= link administrate-materialize-theme/theme.js
1219
```
1320

14-
And then execute:
15-
```bash
16-
$ bundle
21+
- Edit *app/views/layouts/admin/application.html.erb* (you can generate it using `rails generate administrate:views:layout`), adding before head closing tag:
22+
23+
```html
24+
<%= stylesheet_link_tag 'administrate-materialize-theme/theme', media: 'all' %>
25+
<%= javascript_include_tag 'administrate-materialize-theme/theme' %>
1726
```
1827

19-
Or install it yourself as:
20-
```bash
21-
$ gem install administrate-materialize-theme
28+
## Customizations
29+
To change Materialize variables it's necessary to create a new *.scss* (or *.sass*) file like this one (ex. *admin.scss*):
30+
31+
```scss
32+
// app/assets/stylesheets/admin.scss
33+
$primary-color: #FB1;
34+
@import 'administrate-materialize-theme/theme';
2235
```
2336

24-
## Contributing
25-
Contribution directions go here.
37+
And replace the link tag in the *application.html.erb* with: `<%= stylesheet_link_tag 'admin', media: 'all' %>`
38+
39+
For the complete list of options take a look [here](app/assets/stylesheets/administrate-materialize-theme/components/_variables.scss).
40+
41+
## Do you like it? Star it!
42+
If you use this component just star it. A developer is more motivated to improve a project when there
43+
is some interest.
44+
45+
## Contributors
46+
- [Mattia Roccoberton](https://blocknot.es/): author
2647

2748
## License
2849
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Rakefile

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1 @@
1-
begin
2-
require 'bundler/setup'
3-
rescue LoadError
4-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5-
end
6-
7-
require 'rdoc/task'
8-
9-
RDoc::Task.new(:rdoc) do |rdoc|
10-
rdoc.rdoc_dir = 'rdoc'
11-
rdoc.title = 'Administrate::Materialize::Theme'
12-
rdoc.options << '--line-numbers'
13-
rdoc.rdoc_files.include('README.md')
14-
rdoc.rdoc_files.include('lib/**/*.rb')
15-
end
16-
17-
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18-
load 'rails/tasks/engine.rake'
19-
20-
load 'rails/tasks/statistics.rake'
21-
22-
require 'bundler/gem_tasks'
23-
24-
require 'rake/testtask'
25-
26-
Rake::TestTask.new(:test) do |t|
27-
t.libs << 'test'
28-
t.pattern = 'test/**/*_test.rb'
29-
t.verbose = false
30-
end
31-
32-
task default: :test
1+
# frozen_string_literal: true
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1+
# frozen_string_literal: true
2+
13
$:.push File.expand_path("lib", __dir__)
24

35
# Maintain your gem's version:
4-
require "administrate/materialize/theme/version"
6+
require "administrate-materialize-theme/version"
57

68
# Describe your gem and declare its dependencies:
79
Gem::Specification.new do |spec|
810
spec.name = "administrate-materialize-theme"
9-
spec.version = Administrate::Materialize::Theme::VERSION
11+
spec.version = AdministrateMaterializeTheme::VERSION
1012
spec.authors = ["Mattia Roccoberton"]
1113
spec.email = ["mat@blocknot.es"]
12-
spec.homepage = "TODO"
13-
spec.summary = "TODO: Summary of Administrate::Materialize::Theme."
14-
spec.description = "TODO: Description of Administrate::Materialize::Theme."
14+
spec.homepage = "https://blocknot.es"
15+
spec.summary = "Administrate Materialize Theme"
16+
spec.description = "A Material theme for Administrate based on Materialize framework"
1517
spec.license = "MIT"
1618

1719
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
1820
# to allow pushing to a single host or delete this section to allow pushing to any host.
1921
if spec.respond_to?(:metadata)
20-
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
22+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
2123
else
2224
raise "RubyGems 2.0 or newer is required to protect against " \
2325
"public gem pushes."
2426
end
2527

26-
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
28+
spec.files = Dir["{app,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
2729

28-
spec.add_dependency "rails", "~> 6.0.3", ">= 6.0.3.2"
30+
spec.add_dependency 'administrate', '~> 0.14.0'
2931

30-
spec.add_development_dependency "sqlite3"
32+
spec.add_dependency 'rubocop', '~> 0.89.1'
3133
end

bin/rails

Lines changed: 0 additions & 14 deletions
This file was deleted.

bin/rubocop

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rubocop", "rubocop")

config/routes.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
require 'administrate-materialize-theme/engine'
4+
5+
module AdministrateMaterializeTheme
6+
end

0 commit comments

Comments
 (0)