potassium 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd782f1354793989cfaf9ee632caeeec257b26fc
4
- data.tar.gz: d26ed0b7bb9b6a7d8283a0e174cffd5758079d0b
3
+ metadata.gz: dbbae269a8525af660d5f14aabf1fcfba6983e58
4
+ data.tar.gz: 5760d02a273c5c3bf4ab3d97c380206c224af897
5
5
  SHA512:
6
- metadata.gz: 4a548bc74ca74368a90d165c2aa56f87d054f0de071b4fad939702658b815ee13e375e7418ef45cc29da7e72b9c515e8f58644f89b887321d6360c623ba2dd7e
7
- data.tar.gz: 2239c068a29d5e4ae00325ba104f4e94c265cbe58b19143dfda6d3222ecb19eddabe23b07dcfe96960045167048b048776e0dd4911079f56eeb37a1e84876dc2
6
+ metadata.gz: 1fe7819245a24592988c21856d674125ee563ef441b9058cabec7c00d0913c6777e814061bdfcf62ce85262451589b1b8513bdd3bf6bb77b69594fd5d1a281eb
7
+ data.tar.gz: fa72ded8a7c6d245dd957e387e1abea1978c22e4ca3ec7be3249d55541ee69c2c8ce9e6d6e3e0cf21890af68c684914fa29760909b67d1f5ff026a11960f1059
data/README.md CHANGED
@@ -1,31 +1,117 @@
1
1
  # Potassium
2
2
 
3
- TODO: Write a gem description
3
+ A Rails application generator from [Platanus](https://github.com/platanus), inspired by [Suspenders](https://github.com/thoughtbot/suspenders).
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Just install it globally:
8
8
 
9
- ```ruby
10
- gem 'potassium'
11
- ```
9
+ $ gem install potassium
12
10
 
13
- And then execute:
11
+ ## Usage
14
12
 
15
- $ bundle
13
+ Use the `potassium` command to create a new project:
16
14
 
17
- Or install it yourself as:
15
+ $ potassium create project-name
18
16
 
19
- $ gem install potassium
17
+ ## What's inside Potassium?
20
18
 
21
- ## Usage
19
+ Potassium Rails apps includes the following gems and technologies:
22
20
 
23
- TODO: Write usage instructions here
21
+ - [rbenv](https://github.com/sstephenson/rbenv) for managing the project's ruby version.
22
+ - [rbenv-vars](https://github.com/sstephenson/rbenv-vars) for keeping secrets and by-server configurations.
23
+ - [Bower](http://bower.io) for frontend assets packages.
24
+ - [EditorConfig](http://editorconfig.org) for keeping all our editor configurations the same.
25
+ - [pry](http://pryrepl.org) and [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug) for a less painful debugging experience.
26
+ - [RSpec](http://rspec.info) for unit and integration testing.
27
+ - [FactoryGirl](https://github.com/thoughtbot/factory_girl) for test factories.
28
+ - [Guard](http://guardgem.org) for continuous testing and other watch-related tasks.
29
+
30
+ And some optional integrations that will be asked for on project's creation:
31
+
32
+ - [PostgreSQL](http://www.postgresql.org) or [MySQL](https://www.mysql.com) for the database.
33
+ - [Devise](https://github.com/plataformatec/devise) for authentication.
34
+ - [ActiveAdmin](http://activeadmin.info) for admin interfaces.
35
+ - [Pundit](https://github.com/elabs/pundit) for role-based authorization.
24
36
 
25
37
  ## Contributing
26
38
 
27
- 1. Fork it ( https://github.com/[my-github-username]/potassium/fork )
28
- 2. Create your feature branch (`git checkout -b my-new-feature`)
29
- 3. Commit your changes (`git commit -am 'Add some feature'`)
30
- 4. Push to the branch (`git push origin my-new-feature`)
31
- 5. Create a new Pull Request
39
+ ### How do i add something new to Potassium?
40
+
41
+ In the [lib/potassium/templates/application](lib/potassium/templates/application) folder, you will find [the template](lib/potassium/templates/application/template.rb). You should follow the next conventions to add something:
42
+
43
+ *__NOTE:__ If you only want to use Potassium but not to add something new, the next parts shouldn't be necessary.*
44
+
45
+ #### Ask
46
+
47
+ If you need to ask something to the user before doing something, follow the next steps:
48
+
49
+ 1. Create a ruby file on the [recipes/asks](lib/potassium/templates/application/recipes/asks) folder.
50
+ 2. Then, ask something using the methods defined in [Inquirer](https://github.com/arlimus/inquirer.rb), that we use by default. Use the [DSL](docs/dsl.md) to store some information.
51
+ 3. Finally, register the **ask** you created in [the template](lib/potassium/templates/application/template.rb):
52
+
53
+ ```ruby
54
+ run_action(:asking) do
55
+ # ...
56
+ eval_file "recipes/asks/my_ask.rb"
57
+ end
58
+ ```
59
+
60
+ #### Install
61
+
62
+ Now, to add some behavior, thanks to the [DSL](docs/dsl.md) we have a kind of standard flow of what happens when a new project is created. To understand this better, please read [the template](lib/potassium/templates/application/template.rb). Anyway, the structure is like this:
63
+
64
+ 1. Clean the Gemfile and add the base gems that rails needs to work.
65
+ 2. Then, run all the **asks** recipes.
66
+ 3. Then, execute all the **recipes**, that are ruby files stored on the [recipes](lib/potassium/templates/application/recipes) folder. They specify what gems are needed and registers callbacks based on this process, usually to execute things after the gem installation happened or after some other recipe finished his work.
67
+ 4. Then, install the gems, filling the Gemfile before with all the gathered gems.
68
+ 5. Finally, create the database.
69
+
70
+ The main step is the 3, when we run the recipes. A recipe can do anything (because is a ruby script) but what should be their main responsabilities are to gather gems and register callbacks for the process.
71
+
72
+ For example, if we want to create an optional recipe to add a gem called `banana_split` that needs to run a generator, we can do the following.
73
+
74
+ 1. Create the **ask** file:
75
+
76
+ ```ruby
77
+ # application/recipes/ask/banana_split.rb
78
+ use_banana_split = Ask.confirm("Do you want to use Banana Split?")
79
+ set(:use_banana_split, true) if use_banana_split
80
+ ```
81
+
82
+ 2. Then, register the **ask**:
83
+
84
+ ```ruby
85
+ run_action(:asking) do
86
+ # ...
87
+ eval_file "recipes/asks/banana_split.rb"
88
+ end
89
+ ```
90
+
91
+ 3. Create the **recipe**. Register a gem using `gather_gem` and use a callback to run after the `gem_install` action succeded to run the generator. `gem_install` is one of the main actions that should be easily visible with a sneak peek in [the template](lib/potassium/templates/application/template.rb).
92
+
93
+ ```ruby
94
+ # application/recipes/banana_split.rb
95
+ if get(:use_banana_split)
96
+ gather_gem('banana_split', '~> 1.2')
97
+
98
+ after(:gem_install) do
99
+ generate('banana_split:install')
100
+ end
101
+ end
102
+ ```
103
+
104
+ 4. Register the **recipe**:
105
+
106
+ ```ruby
107
+ run_action(:recipe_loading) do
108
+ # ...
109
+ eval_file "recipes/banana_split.rb"
110
+ end
111
+ ```
112
+
113
+ 5. Ready, let's start working on your new project.
114
+
115
+ #### The DSL
116
+
117
+ To see some further documentation of what we added to the rails template's DSL, check the [DSL documentation](docs/dsl.md). Remember that the DSL we are documenting is an extension over the [Rails Application Template DSL](http://edgeguides.rubyonrails.org/rails_application_templates.html), that itself is a dsl based on [Thor](https://github.com/erikhuda/thor/wiki).
@@ -1,21 +1,3 @@
1
- # Rails Template
2
-
3
- On this template, we base our Rails applications.
4
-
5
- ## Usage
6
-
7
- Clone the template.
8
-
9
- ```bash
10
- $ git clone git@github.com:platanus/rails_template.git
11
- ```
12
-
13
- Create your new application based on template
14
-
15
- ```bash
16
- $ rails new my_new_app -m /path_to_template_root/app_template.rb
17
- ```
18
-
19
1
  ## The DSL
20
2
 
21
3
  The DSL to extend and add recipes defines methods divided in mixins called helpers.
data/lib/potassium/cli.rb CHANGED
@@ -9,7 +9,5 @@ module Potassium::CLI
9
9
 
10
10
  commands_from 'potassium/cli/commands'
11
11
 
12
- default_command :create
13
-
14
12
  exit Potassium::CLI.run(ARGV)
15
13
  end
@@ -1,3 +1,3 @@
1
1
  module Potassium
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potassium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,11 +94,11 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - bin/potassium
97
+ - docs/dsl.md
97
98
  - lib/potassium.rb
98
99
  - lib/potassium/cli.rb
99
100
  - lib/potassium/cli/commands/create.rb
100
101
  - lib/potassium/template_finder.rb
101
- - lib/potassium/templates/application/README.md
102
102
  - lib/potassium/templates/application/assets/.bowerrc
103
103
  - lib/potassium/templates/application/assets/.editorconfig
104
104
  - lib/potassium/templates/application/assets/.pryrc