appjam 0.1.8.pre9 → 0.1.8.pre10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/appjam.rb +1 -1
- data/lib/appjam/generators/cli.rb +1 -1
- data/lib/appjam/generators/search.rb +70 -0
- data/lib/appjam/version.rb +1 -1
- metadata +5 -4
data/lib/appjam.rb
CHANGED
@@ -57,6 +57,6 @@ end # Appjam
|
|
57
57
|
##
|
58
58
|
# We add our generators to Appjam::Genererator
|
59
59
|
#
|
60
|
-
Appjam::Generators.load_paths << Dir[File.dirname(__FILE__) + '/appjam/generators/{project,model,submodule,gist}.rb']
|
60
|
+
Appjam::Generators.load_paths << Dir[File.dirname(__FILE__) + '/appjam/generators/{project,model,submodule,gist,search}.rb']
|
61
61
|
|
62
62
|
|
@@ -66,7 +66,7 @@ module Appjam
|
|
66
66
|
g.each_pair {|key,value|
|
67
67
|
gitopt = []
|
68
68
|
puts
|
69
|
-
puts colorize("Gist
|
69
|
+
puts colorize("Gist Category [#{key.gsub('_',' ')}]")
|
70
70
|
g[key].each { |k|
|
71
71
|
k.each_pair { |k1,v1|
|
72
72
|
gitopt << {:category => "#{key.gsub('_',' ')}", :command => "appjam gist #{k1}", :description => "#{k[k1][2]['description']}" }
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'cli-colorize'
|
3
|
+
require 'thor/group'
|
4
|
+
require 'hirb'
|
5
|
+
require File.dirname(__FILE__) + '/../view'
|
6
|
+
require File.dirname(__FILE__) + '/jam'
|
7
|
+
|
8
|
+
module Appjam
|
9
|
+
module Generators
|
10
|
+
class Search < Jam
|
11
|
+
include CLIColorize
|
12
|
+
|
13
|
+
CLIColorize.default_color = :red
|
14
|
+
RENDER_OPTIONS = { :fields => [:category,:command,:description] }
|
15
|
+
|
16
|
+
# Add this generator to our appjam
|
17
|
+
Appjam::Generators.add_generator(:search, self)
|
18
|
+
|
19
|
+
# Define the source root
|
20
|
+
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
21
|
+
def self.banner; "appjam search [option]"; end
|
22
|
+
|
23
|
+
# Include related modules
|
24
|
+
include Thor::Actions
|
25
|
+
include Appjam::Generators::Actions
|
26
|
+
|
27
|
+
desc "Description:\n\n\tappjam will search option"
|
28
|
+
|
29
|
+
argument :name, :desc => "The name of option"
|
30
|
+
|
31
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
32
|
+
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
33
|
+
|
34
|
+
def in_app_root?
|
35
|
+
File.exist?('Classes')
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_search
|
39
|
+
valid_constant?(options[:search] || name)
|
40
|
+
@gist_name = (options[:app] || name).gsub(/W/, "_").downcase
|
41
|
+
@gist_class_name = (options[:app] || name).gsub(/W/, "_").capitalize
|
42
|
+
@developer = "eiffel"
|
43
|
+
@created_on = Date.today.to_s
|
44
|
+
self.destination_root = options[:root]
|
45
|
+
puts
|
46
|
+
puts colorize("Available Options contains [#{@gist_name}]")
|
47
|
+
puts
|
48
|
+
require 'yaml'
|
49
|
+
g = YAML.load_file(File.expand_path(File.dirname(__FILE__) + '/gist.yml'))
|
50
|
+
gitopt = []
|
51
|
+
g.each_pair {|key,value|
|
52
|
+
# puts colorize("Gist Category [#{key.gsub('_',' ')}]")
|
53
|
+
g[key].each { |k|
|
54
|
+
k.each_pair { |k1,v1|
|
55
|
+
gist_name = k1.downcase
|
56
|
+
gist_desc = k[k1][2]['description'].downcase
|
57
|
+
if gist_name.include?(@gist_name) or gist_desc.include?(@gist_name)
|
58
|
+
gitopt << {:category => "#{key.gsub('_',' ')}", :command => "appjam gist #{k1}", :description => "#{k[k1][2]['description']}" }
|
59
|
+
end
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
View.render(gitopt, RENDER_OPTIONS)
|
64
|
+
puts
|
65
|
+
end
|
66
|
+
|
67
|
+
end # Search
|
68
|
+
end # Generators
|
69
|
+
end # Appjam
|
70
|
+
|
data/lib/appjam/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appjam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1923832045
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
9
|
- 8
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 0.1.8.
|
11
|
+
- 10
|
12
|
+
version: 0.1.8.pre10
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Eiffel Q
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-26 00:00:00 +08:00
|
21
21
|
default_executable: appjam
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -514,6 +514,7 @@ files:
|
|
514
514
|
- lib/appjam/generators/project/utils/UIDevice.m
|
515
515
|
- lib/appjam/generators/project/utils/URLEncodeString.h
|
516
516
|
- lib/appjam/generators/project/utils/URLEncodeString.m
|
517
|
+
- lib/appjam/generators/search.rb
|
517
518
|
- lib/appjam/generators/submodule.rb
|
518
519
|
- lib/appjam/generators/submodule/gitattributes.tt
|
519
520
|
- lib/appjam/generators/submodule/gitignore.tt
|