gennifer 0.1.1 → 0.1.3

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: d1b3a8efd28b28d53e021452d16636c554e4ece1
4
- data.tar.gz: b896d069ea8db92c0fab2fc33f20d07831452145
3
+ metadata.gz: f5a475dbd8aeb00c1cb876e28fc3b9ddca18901f
4
+ data.tar.gz: 5d224b6a60292c9b5c0e6f37c7420145e3e4d791
5
5
  SHA512:
6
- metadata.gz: 298caf3c9387282d75b39541e74ff91e3a5cfb1153ac6d2913a60652fefdf6d679af80b51e1b7507dc1ce5af8bfd61694b3a141a8af714e3f24ef00c9ee28ab4
7
- data.tar.gz: 0f118da76da19d189535f5900e33cc09bb13d3bd052d560de605277a35c921bd3959ca51c3b5f42262c2e03814b9bb3cc0828eccccf7ceeafeecc7e692145797
6
+ metadata.gz: 4c39cb6f29792b22c8a0edd131bc0bca5644e72a983c2d16e3a9c646702d636731348416a21f66193af98398158c1c1b807b16364b6e08491c6b1c57786fe211
7
+ data.tar.gz: a472a1e5d7c24f340fc2b73d0c80d2d786deb91b19398994c64de729a3158732522f20b46549290816c7e8064a307cd97d603a602f457d6c58c74e47aa48e117
data/README.md CHANGED
@@ -8,7 +8,8 @@ To install the gem:
8
8
 
9
9
  $ gem install gennifer
10
10
 
11
- To put default settings in the folder ~/.gennifer
11
+ You need some recipes to use gennifer. Before writing your own recipe, you are highly recommended to install the default settings and recipes.
12
+ To put default settings and recipes in the folder ~/.gennifer
12
13
 
13
14
  $ gen install
14
15
 
@@ -82,8 +83,9 @@ be in the following format.
82
83
  end
83
84
  end
84
85
 
85
- Apart from coding the whole recipe using ruby (like using mkdir, cp, mv in
86
- FileUtils), there are several method you can use in the recipe. For example,
86
+ You may write the whole recipe using ruby (like using mkdir, cp, mv in
87
+ FileUtils). However, there are several convenient helper methods you can
88
+ use in the recipe. For example,
87
89
  `create` will create a new directory in the target location if only the location
88
90
  is specified. And it will copy a file/directory
89
91
  from the resources folder if a resources location is specified in the second
@@ -1,9 +1,21 @@
1
1
  class AfterRecipe
2
2
  def recipe
3
- executable @full_path if check_argv('exe')
4
- `#{Settings::EDITOR} #{@full_path}` if check_argv('edit')
3
+ executable @full_path if (check_argv('-exe') or check_argv('-e'))
5
4
 
6
- if check_argv('bin') then
5
+ `#{Settings::EDITOR} #{@full_path}` if check_argv('-edit')
6
+
7
+ `#{Settings::EDITOR} #{@full_path}` if (check_argv('-open') or check_argv('-o'))
8
+
9
+ if (check_argv('-bin') or check_argv('-b')) then
10
+ new_location= File.expand_path(Settings::BINFOLDER + '/' + @full_name)
11
+ if File.exists?(new_location)
12
+ FileUtils.rm_rf(@full_path)
13
+ else
14
+ FileUtils.mv(@full_path , new_location)
15
+ end
16
+ end
17
+
18
+ if check_argv('-ebo') then
7
19
  new_location= File.expand_path(Settings::BINFOLDER + '/' + @full_name)
8
20
  if File.exists?(new_location)
9
21
  FileUtils.rm_rf(@full_path)
@@ -10,4 +10,12 @@ class ArticleRecipe
10
10
  create (@full_path + "/figures/sample-figure.pdf"), 'sample-figure.pdf'
11
11
 
12
12
  end
13
+
14
+ def example
15
+ 'gen MyProjectName article'
16
+ end
17
+
18
+ def explanation
19
+ 'generate a latex article project'
20
+ end
13
21
  end
@@ -10,4 +10,14 @@ class BeamerRecipe
10
10
  create (@full_path + "/figures/sample-figure.pdf"), 'sample-figure.pdf'
11
11
 
12
12
  end
13
+
14
+
15
+ def example
16
+ 'gen MyProjectName beamer'
17
+ end
18
+
19
+ def explanation
20
+ 'generate a latex beamer project'
21
+ end
22
+
13
23
  end
@@ -2,10 +2,25 @@ require "gennifer/version"
2
2
  require 'fileutils'
3
3
  require 'erb'
4
4
 
5
+
6
+
5
7
  # TODO: command to generate new recipes with commented hint/tutorial
6
8
  # TODO: write tests and test in windows
7
9
  # TODO: better treatment for duplicate files in bin folder
8
- # TODO: put help text in recipe and make the help command auto read it
10
+ # TODO: put help text in recipe and make the help command auto read it (can add an option to show verbose help or short help).... One way to do it is to add a method "help_text" to each recipe file. Probably should not show all the help text in every recipe every single time. Just hsow all of them when the user do "gen help all". (Advise them "gen help all" when they just do "gen help" or just type "gen")
11
+ # TODO: help text when the project type is available but with no name, say "gen article" should show the help text of article (current behaviour is to generate a article project with name article, which is strange)
12
+
13
+
14
+ # TODO: write a lot richer default recipe (at least it should support more file extension names)
15
+ # TODO: better advide when gennifer is installed but there is no settings file (or the settings files is not in the correct format)
16
+ # TODO: show help text or show better instructions (instead of 'recipe not found") when gen is run but no recipe is matached. (presumably this is the case of typo or wrong syntax)
17
+ # TODO: consider adding convention such as underscore before project type
18
+ # TODO: make the arguments available to the receipe as a hash. So that one can use erb to get the argument and generate more complicated files.
19
+ # TODO: better "bin recipe", moving the file to bin folder after create mey not be the best solution because it handle duplicate files poorly (or I can improve the afterrecipe to take into accoount those situation, or may a helper method)
20
+
21
+
22
+
23
+
9
24
 
10
25
  module Gennifer
11
26
  def self.gen(argv)
@@ -36,6 +51,7 @@ module Gennifer
36
51
 
37
52
 
38
53
  if (argv0 == 'help' or argv0 == '') then
54
+ help_text_old(argv1)
39
55
  help_text(argv1)
40
56
  else
41
57
  recipe_class = get_recipe_class(argv1)
@@ -83,6 +99,23 @@ module Gennifer
83
99
  end
84
100
 
85
101
  def self.help_text(argv1)
102
+ padding = "
103
+ "
104
+ puts "#{padding}More help text..........(under construction)"
105
+
106
+
107
+ recipe_class = get_recipe_class(argv1)
108
+ if recipe_class then
109
+ #puts "#{padding}Show help text for #{recipe_class}"
110
+ puts "#{padding}#{recipe_class.new.example} #{recipe_class.new.explanation}"
111
+ else
112
+ puts "#{padding}Show general help text"
113
+ end
114
+
115
+
116
+ end
117
+
118
+ def self.help_text_old(argv1)
86
119
 
87
120
  if argv1 == 'install' then
88
121
  puts "
@@ -108,7 +141,8 @@ module Gennifer
108
141
  "
109
142
  else
110
143
  puts "
111
- gen install install the default settings and recipe
144
+
145
+ gen install install the default settings and recipes
112
146
  gen myproject article generate a latex article project
113
147
  gen myproject exam generate a latex exam project
114
148
  gen myproject letter generate a latex letter project
@@ -118,6 +152,8 @@ module Gennifer
118
152
  gen myfile.rb bin generate a ruby file and make it executable,
119
153
  move the file to the bin folder and use the
120
154
  editor to open the file.
155
+ gen myfile py generate a python file with name myfile
156
+
121
157
  "
122
158
  end
123
159
  end
@@ -1,3 +1,3 @@
1
1
  module Gennifer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gennifer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chungsang Tom Lam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler