appjam 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -44,6 +44,19 @@ Add "Classes/user/" folder to the "Classes/apps" Group
44
44
 
45
45
  Xcode build and run
46
46
 
47
+ ==== Usage 3: add three20 submodule (## this require git installed)
48
+
49
+ $ cd todo
50
+
51
+ $ appjam submodule three20
52
+
53
+ $ open Todo.xcodeproj
54
+
55
+ Add "three20/src/Three20/Three20.xcodeproj" folder to the "Other Sources" Group
56
+ Add "three20/src/Three20.bundle" folder to the "Other Sources" Group
57
+
58
+ Xcode build and run
59
+
47
60
  == Contributing to appjam
48
61
 
49
62
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/lib/appjam.rb CHANGED
@@ -57,5 +57,5 @@ 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}.rb']
60
+ Appjam::Generators.load_paths << Dir[File.dirname(__FILE__) + '/appjam/generators/{project,model,submodule}.rb']
61
61
 
@@ -113,17 +113,17 @@ module Appjam
113
113
  result.blank? ? default : result
114
114
  end
115
115
 
116
- # Raise SystemExit if the app is inexistent
116
+ # Raise SystemExit if the app is iexistent
117
117
  def check_app_existence(app)
118
118
  unless File.exist?(destination_root(app))
119
119
  say
120
120
  say "================================================================="
121
- say "We didn't found #{app.underscore.downcase}! "
121
+ say "We didn't found #{app.underscore.camelize}! "
122
122
  say "================================================================="
123
123
  say
124
124
  # raise SystemExit
125
125
  end
126
- end
126
+ end
127
127
 
128
128
  # Ensure that project name is valid, else raise an NameError
129
129
  def valid_constant?(name)
@@ -133,6 +133,18 @@ module Appjam
133
133
  raise ::NameError, "Project name #{name} cannot start with non-word character"
134
134
  end
135
135
  end
136
+
137
+ ## Detect command and dump it's path
138
+ def which cmd
139
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
140
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
141
+ exts.each { |ext|
142
+ exe = "#{path}/#{cmd}#{ext}"
143
+ return exe if File.executable? exe
144
+ }
145
+ end
146
+ return nil
147
+ end
136
148
 
137
149
  module ClassMethods
138
150
  # Defines a class option to allow a component to be chosen and add to component type list
@@ -46,7 +46,8 @@ module Appjam
46
46
  puts
47
47
  puts colorize("APPJAM OPTIONS", { :foreground => :blue})
48
48
  opt = [{ :category => "objective c (iphone)", :command => "appjam project todo", :description => "generate iphone project skeleton"},
49
- { :category => "objective c (iphone)", :command => "appjam model user", :description => "generate iphone project data model"}]
49
+ { :category => "objective c (iphone)", :command => "appjam model user", :description => "generate iphone project data model"},
50
+ { :category => "objective c (iphone)", :command => "appjam submodule three20", :description => "fetch three20 subproject from github.com"}]
50
51
  View.render(opt, RENDER_OPTIONS)
51
52
  puts
52
53
  end
@@ -37,7 +37,7 @@ module Appjam
37
37
  File.exist?('Classes')
38
38
  end
39
39
 
40
- def create_app
40
+ def create_jam
41
41
  valid_constant?(options["#{self.to_s.downcase.intern}"] || name)
42
42
  @jam_name = (options["#{self.to_s.downcase.intern}"] || name).gsub(/\W/, "_").downcase
43
43
  @developer = "#{`whoami`.strip}"
@@ -48,14 +48,14 @@ module Appjam
48
48
 
49
49
  #empty_directory "#{@jam_name}"
50
50
 
51
- View.render(options)
52
- say (<<-TEXT).gsub(/ {10}/,'')
53
-
54
- =================================================================
55
- Your #{@jam_name} has been generated.
56
- =================================================================
57
-
58
- TEXT
51
+ # View.render(options)
52
+ # say (<<-TEXT).gsub(/ {10}/,'')
53
+ #
54
+ # =================================================================
55
+ # Your #{@jam_name} has been generated.
56
+ # =================================================================
57
+ #
58
+ # TEXT
59
59
  end
60
60
 
61
61
  class << self
@@ -21,7 +21,7 @@ module Appjam
21
21
  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
22
22
  class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
23
23
 
24
- def create_app
24
+ def create_model
25
25
  if in_app_root?
26
26
  valid_constant?(options[:model] || name)
27
27
  @model_name = (options[:app] || name).gsub(/\W/, "_").downcase
@@ -21,7 +21,7 @@ module Appjam
21
21
  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
22
22
  class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
23
23
 
24
- def create_app
24
+ def create_project
25
25
  valid_constant?(options[:project] || name)
26
26
  @project_name = (options[:app] || name).gsub(/\W/, "_").downcase
27
27
  @class_name = (options[:app] || name).gsub(/\W/, "_").capitalize
@@ -32,15 +32,15 @@ module Appjam
32
32
  self.behavior = :revoke if options[:destroy]
33
33
 
34
34
  eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '')
35
-
36
- say (<<-TEXT).gsub(/ {10}/,'')
37
35
 
36
+ say (<<-TEXT).gsub(/ {10}/,'')
37
+
38
38
  =================================================================
39
39
  Your #{@project_name} application has been generated.
40
40
  Open #{@project_name.capitalize}.xcodeproj
41
41
  Build and Run
42
42
  =================================================================
43
-
43
+
44
44
  TEXT
45
45
  end
46
46
  end # Project
@@ -0,0 +1,89 @@
1
+ require File.dirname(__FILE__) + '/jam'
2
+
3
+ module Appjam
4
+ module Generators
5
+ class Submodule < Jam
6
+
7
+ # Add this generator to our appjam
8
+ Appjam::Generators.add_generator(:submodule, self)
9
+
10
+ # Define the source submodule root
11
+ def self.source_root; File.expand_path(File.dirname(__FILE__)); end
12
+ def self.banner; "appjam submodule [name]"; end
13
+
14
+ # Include related modules
15
+ include Thor::Actions
16
+ include Appjam::Generators::Actions
17
+
18
+ desc "Description:\n\n\tappjam will generates an new PureMvc Model for iphone"
19
+
20
+ argument :name, :desc => "The name of your puremvc submodule"
21
+
22
+ class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
23
+ class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
24
+
25
+ def in_app_root?
26
+ File.exist?('Classes')
27
+ end
28
+
29
+ def create_app
30
+ if which('git') != nil
31
+ if in_app_root?
32
+ valid_constant?(options[:submodule] || name)
33
+ @submodule_name = (options[:app] || name).gsub(/W/, "_").downcase
34
+ @xcode_project_name = File.basename(Dir.glob('*.xcodeproj')[0],'.xcodeproj').downcase
35
+ @class_name = (options[:app] || name).gsub(/W/, "_").capitalize
36
+ @developer = "eiffel"
37
+ @created_on = Date.today.to_s
38
+ self.destination_root = options[:root]
39
+
40
+ if @submodule_name == 'three20'
41
+
42
+ eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '')
43
+
44
+ say (<<-TEXT).gsub(/ {10}/,'')
45
+
46
+ =================================================================
47
+ Three20 submodule has been imported
48
+
49
+ Open #{@xcode_project_name.capitalize}.xcodeproj
50
+ Add "three20/src/Three20/Three20.xcodeproj" folder to the "Other Sources" Group
51
+ Add "three20/src/Three20.bundle" folder to the "Other Sources" Group
52
+ Build and Run
53
+ =================================================================
54
+ TEXT
55
+ else
56
+ say "="*70
57
+ say "Only support three20 submodule now!"
58
+ say "="*70
59
+ end
60
+ else
61
+ puts
62
+ puts '-'*70
63
+ puts "You are not in an iphone project folder"
64
+ puts '-'*70
65
+ puts
66
+ end
67
+ else
68
+ say "="*70
69
+ say "Git was not installed!! check http://git-scm.com/ for installation."
70
+ say "="*70
71
+ end
72
+ end
73
+
74
+ end # Submodule
75
+ end # Generators
76
+ end # Appjam
77
+
78
+ __END__
79
+ unless File.exist?("./.git")
80
+ system "git init"
81
+ template "submodule/gitignore.tt", "./.gitignore"
82
+ system "git add ."
83
+ system "git commit -m 'init commit'"
84
+ end
85
+ system "rm -rf three20"
86
+ system "git submodule add git://github.com/facebook/three20.git three20"
87
+ system "git add ."
88
+ system "git commit -m 'import three20 submodule'"
89
+
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ build/
@@ -0,0 +1,3 @@
1
+ [submodule "three20"]
2
+ path = three20
3
+ url = git://github.com/facebook/three20.git
@@ -28,7 +28,14 @@ module Appjam
28
28
  end
29
29
 
30
30
  def create_app
31
- if in_app_root?
31
+ valid_constant?(options[:template] || name)
32
+ @project_name = (options[:app] || name).gsub(/\W/, "_").downcase
33
+ @class_name = (options[:app] || name).gsub(/\W/, "_").capitalize
34
+ @developer = "#{`whoami`.strip}"
35
+ @created_on = Date.today.to_s
36
+ self.destination_root = options[:root]
37
+
38
+ eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '')
32
39
 
33
40
  say (<<-TEXT).gsub(/ {10}/,'')
34
41
 
@@ -38,10 +45,14 @@ Your template has been generated.
38
45
 
39
46
  TEXT
40
47
  end
41
- end
48
+
42
49
  end # Template
43
50
  end # Generators
44
51
  end # Appjam
52
+
53
+ __END__
54
+ # put your template command here
55
+
45
56
  BLOCK
46
57
 
47
58
  namespace :appjam do
@@ -57,8 +68,6 @@ namespace :appjam do
57
68
  File.open(plugin_name, 'w') {|f| f.write(TEMPLATE) }
58
69
  end
59
70
 
60
-
61
-
62
71
  end # plugin
63
72
  end # appjam
64
73
 
@@ -2,7 +2,7 @@ module Appjam
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 5
5
+ PATCH = 6
6
6
  BUILD = ''
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').chomp('.')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appjam
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eiffel Q
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-06 00:00:00 Z
18
+ date: 2011-05-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :runtime
@@ -453,6 +453,9 @@ files:
453
453
  - lib/appjam/generators/project/utils/UIDevice.m
454
454
  - lib/appjam/generators/project/utils/URLEncodeString.h
455
455
  - lib/appjam/generators/project/utils/URLEncodeString.m
456
+ - lib/appjam/generators/submodule.rb
457
+ - lib/appjam/generators/submodule/gitignore.tt
458
+ - lib/appjam/generators/submodule/gitmodules.tt
456
459
  - lib/appjam/tasks.rb
457
460
  - lib/appjam/tasks/plugin.rb
458
461
  - lib/appjam/version.rb