hands_engine 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -6,8 +6,8 @@ Engines will be available on Rails 3.1 as the new plugin generator and invoked a
6
6
 
7
7
  == Usage
8
8
 
9
- $ hands path/ENGINE_NAME Ex: hands_engine sites/vwvarejo
10
- $ hands path/ENGINE_NAME -t themes Ex: hands_engine sites/vwvarejo -t themes
9
+ $ hands path/ENGINE_NAME Ex: hands sites/vwvarejo
10
+ $ hands path/ENGINE_NAME -t themes Ex: hands sites/vwvarejo -t themes
11
11
 
12
12
  Give --help to see supported options.
13
13
 
@@ -1,3 +1,3 @@
1
1
  module HandsEngine
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/lib/hands_engine.rb CHANGED
@@ -6,14 +6,27 @@ require "active_support/core_ext/string"
6
6
  require "rails/generators"
7
7
  require "rails/generators/rails/app/app_generator"
8
8
 
9
+ # Interact with Hands Engine by using:
10
+ #
11
+ # *Default*
12
+ # $ hands path/ENGINE_NAME Ex: hands sites/vwvarejo
13
+ #
14
+ # *Themes*
15
+ # $ hands path/ENGINE_NAME -t themes Ex: hands sites/vwvarejo -t themes
16
+ #
9
17
  class HandsEngine < Thor::Group
10
18
  include Thor::Actions
11
19
  check_unknown_options!
12
20
 
21
+
22
+ # Load template (_root_ or _themes_), _root_ is default option
13
23
  def self.source_root
14
24
  @_source_root ||= File.expand_path('../templates', __FILE__)
15
25
  end
16
26
 
27
+ # Show the current step and the message of the task
28
+ #
29
+ # Ex: "STEP #{@step}", #{message.inspect}
17
30
  def self.say_step(message)
18
31
  @step = (@step || 0) + 1
19
32
  class_eval <<-METHOD, __FILE__, __LINE__ + 1
@@ -33,6 +46,7 @@ class HandsEngine < Thor::Group
33
46
 
34
47
  say_step "Vendoring Rails 3 application at #{name.underscore}"
35
48
 
49
+ # Invoke rails generator and creates a rails 3.1 app
36
50
  def invoke_rails_app_generator
37
51
  invoke Rails::Generators::AppGenerator,
38
52
  [ File.expand_path(path, destination_root) ]
@@ -40,6 +54,8 @@ class HandsEngine < Thor::Group
40
54
 
41
55
  say_step "Removing unneeded files #{name.underscore}"
42
56
 
57
+ # Removes unnecessary files,
58
+ # If themes removes extra files
43
59
  def remove_uneeded_rails_files
44
60
  inside path do
45
61
  remove_file ".gitignore"
@@ -88,6 +104,8 @@ class HandsEngine < Thor::Group
88
104
 
89
105
  say_step "Creating site engine #{name.underscore}"
90
106
 
107
+ # If the argument is _-t_ _themes_ uses /themes template,
108
+ # If not uses /root template
91
109
  def create_root
92
110
  self.destination_root = File.expand_path(path, destination_root)
93
111
  set_accessors!
@@ -103,7 +121,7 @@ class HandsEngine < Thor::Group
103
121
 
104
122
  protected
105
123
 
106
- # if themes site return true
124
+ # Returns true if argument options is _-t_ _themes_" in command line
107
125
  def themes?
108
126
  options[:themes] == "themes"
109
127
  end
@@ -114,14 +132,16 @@ class HandsEngine < Thor::Group
114
132
  self.class.source_root
115
133
  end
116
134
 
135
+ # App name Ex: vwvarejo
117
136
  def name
118
137
  @name ||= File.basename(destination_root)
119
138
  end
120
-
139
+ # Ex: MyApp
121
140
  def camelized
122
141
  @camelized ||= name.camelize
123
142
  end
124
143
 
144
+ # Ex: my_app
125
145
  def underscored
126
146
  @underscored ||= name.underscore
127
147
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hands_engine
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.0
5
+ version: 1.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bruno S. Barros (Hands Mobile)
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-16 00:00:00 -03:00
13
+ date: 2011-05-17 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency