mjollnir 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
- # Mjollnir
1
+ # Mjollnir - 0.2.0
2
2
 
3
3
  A gem for prepending and appending text to rails generated files.
4
4
 
5
- ## Usage
5
+ ## Installation
6
6
 
7
- add `gem 'mjollnir'` to your Gemfile
8
-
9
- Create a directory in your lib directory called `mjollnir`.
10
- Add four files to this directory:
7
+ Use the generator `rails g mjollnir:install`. This will create the four necessary files in your lib directory:
11
8
  1. `append.rb` - this file contains instructions for insertions at the end of generated files.
12
9
  2. `prepend.rb` - this file contains instructions for insertions at the beinning of generated files.
13
10
  3. `comment_starts.csv` - put lines in this file when you need to create block comments in different file types. For example, use a line, `rb,=start` for the start of a ruby block. When generating text in the `append.rb` or `prepend.rb` files, use `<%= universal_comment_start %>` to declare the start of any comment block, so long as that file type has been included in `comment_starts.csv`.
14
11
  4. `comment_ends.csv` - much like `comment_starts.csv`, but this file is for comment block ends in generated text. For example, use `erb,-->` to end a comment block. in an erb file. When generating text in the `append.rb` or `prepend.rb` files, use `<%= universal_comment_end %>` to declare the end of any comment block, so long as that file type has been included in `comment.ends.csv`.
15
12
 
13
+ The csv files are generated with some common default values. Do be careful when writing your append and prepends when writing haml or yml files, as these file types do not take block comments in the way the other files do.
14
+
15
+
16
16
  ## Variables
17
17
 
18
18
  The following usable variables for `append.rb` and `prepend.rb`:
@@ -46,7 +46,6 @@ The following usable variables for `append.rb` and `prepend.rb`:
46
46
  rb,=end
47
47
  scss,*/
48
48
  js,*/
49
- haml,#-
50
49
  coffee,###
51
50
  css,*/
52
51
  erb,-->
@@ -64,5 +63,7 @@ html,-->
64
63
 
65
64
  ## Planned changes
66
65
 
67
- 1. Version 0.2.0 will add a generator for the prepend, and append ruby files, as well as for the two csvs.
68
- 2. The change after that will be to automate some testing.
66
+ TODO
67
+ - Automated testing
68
+ - Add options for common licences
69
+ - Add example for haml and yml prepends
@@ -0,0 +1,27 @@
1
+ module Mjollnir
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ desc "Creates the four required files for mjollnir"
5
+
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ def create_lib_files
9
+ mjollnir_root = "lib/mjollnir"
10
+
11
+ empty_directory mjollnir_root
12
+
13
+ create_file mjollnir_root + "/prepend.rb", <<-FILE
14
+
15
+ FILE
16
+ create_file mjollnir_root + "/append.rb", <<-FILE
17
+
18
+ FILE
19
+ #create_file mjollnir_root + "/comment_starts.csv", File.join('comment_starts.csv')
20
+ template 'comment_starts.csv', File.join(mjollnir_root, 'comment_starts.csv')
21
+
22
+ #create_file mjollnir_root + "/comment_ends.csv", File.join('comment_ends.csv')
23
+ template 'comment_ends.csv', File.join(mjollnir_root, 'comment_ends.csv')
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ rb,=end
2
+ scss,*/
3
+ js,*/
4
+ coffee,###
5
+ css,*/
6
+ erb,-->
7
+ html,-->
@@ -0,0 +1,9 @@
1
+ rb,=begin
2
+ scss,/*
3
+ js,/*
4
+ haml,#-
5
+ coffee,###
6
+ css,/*
7
+ erb,<!--
8
+ html,<!--
9
+ yml,#
@@ -1,3 +1,3 @@
1
1
  module Mjollnir
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjollnir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-10 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A gem for prepending and appending generated files from any rails generator,
15
15
  though the power of Thor.
@@ -24,6 +24,9 @@ files:
24
24
  - LICENSE.txt
25
25
  - README.md
26
26
  - Rakefile
27
+ - lib/generators/mjollnir/install_generator.rb
28
+ - lib/generators/mjollnir/templates/comment_ends.csv
29
+ - lib/generators/mjollnir/templates/comment_starts.csv
27
30
  - lib/mjollnir.rb
28
31
  - lib/mjollnir/version.rb
29
32
  - mjollnir.gemspec