apexgen 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ apexgen (0.0.1)
5
+ active_support (~> 3.0.0)
6
+ gli (= 2.5.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ active_support (3.0.0)
12
+ activesupport (= 3.0.0)
13
+ activesupport (3.0.0)
14
+ aruba (0.5.1)
15
+ childprocess (~> 0.3.6)
16
+ cucumber (>= 1.1.1)
17
+ rspec-expectations (>= 2.7.0)
18
+ builder (3.1.4)
19
+ childprocess (0.3.6)
20
+ ffi (~> 1.0, >= 1.0.6)
21
+ cucumber (1.2.1)
22
+ builder (>= 2.1.2)
23
+ diff-lcs (>= 1.1.3)
24
+ gherkin (~> 2.11.0)
25
+ json (>= 1.4.6)
26
+ diff-lcs (1.1.3)
27
+ ffi (1.2.0)
28
+ gherkin (2.11.5)
29
+ json (>= 1.4.6)
30
+ gli (2.5.0)
31
+ json (1.7.5)
32
+ rake (10.0.2)
33
+ rdoc (3.12)
34
+ json (~> 1.4)
35
+ rspec-expectations (2.12.0)
36
+ diff-lcs (~> 1.1.3)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ apexgen!
43
+ aruba (~> 0.5.1)
44
+ rake
45
+ rdoc
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Bradley Dunn
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ = Apexgen - The missing Salesforce / Force.com Code Generator
2
+
3
+ Apexgen is the missing apex code generator for salesforce/force.com developers. It will allow developers, particularly those that favor using {ant}[http://ant.apache.org/] and the {salesforce migration tool}[http://www.salesforce.com/us/developer/docs/daas/index.htm] to manage their org's projects, the ability to quickly generate custom objects, triggers, classes and class methods, as well as tests and the different subsets of classes (including bulk and web service apex classes).
4
+
5
+ This project is under active development, so the current version may not have all the features described above. Here is the current list of features for this version(v.0.0.1):
6
+
7
+ * Object Generation:
8
+ 1. Will create an object directory in the current folder if one does not exist
9
+ 2. The following code will create a force.com object manifest file named "My_Object__c.object" with a text field(default type) named "My_Text__c" and a checkbox field named "My_Checkbox__c"
10
+
11
+ apexgen object MyObject MyText MyCheckbox:Checkbox
12
+
13
+ 3. Most field types are supported. Currently picklists, multiline picklists, and relationships are not supported.
14
+ 4. Default required values will be filled in for each field. Currently there is no way to override the defaults, but this feature will be present in future versions.
15
+
16
+ == Getting Started
17
+
18
+ Here is a brief synopsis on how to get started with using apexgen.
19
+
20
+ === Installation
21
+
22
+ Install:
23
+
24
+ gem install apexgen
25
+
26
+ === Usage
27
+
28
+ Create an object metadata document named "My Object" in an "objects" directory relative to current dir:
29
+
30
+ apexgen object MyObject MyText MyCheckbox:Checkbox MyCurrency:Currency
31
+
32
+ For more help:
33
+
34
+ apexgen help
35
+ apexgen --help
36
+ apexgen help object
37
+
38
+ == Contributing
39
+
40
+ Here is a brief synopsis on how to start contributing to apexgen.
41
+
42
+ 1. Install Bundler
43
+
44
+ gem install bundler
45
+
46
+ 2. Get the development dependencies
47
+
48
+ bundle install
49
+
50
+ The main binary, which has much of the initial code calls, is in bin/apexgen.
51
+ The rest of the code exists in lib/apexgen/ and all library include calls exist in lib/apexgen.rb
52
+ Cucumber (with aruba) tests exist in features/ and all step definitions are in features/step_definitions
53
+ Unit testing hasn't started yet on this project, but all unit tests will live in test/
54
+
55
+ == License
56
+
57
+ Apexgen is released under the {MIT License}[http://www.opensource.org/licenses/MIT]
58
+
59
+ :include:apexgen.rdoc
60
+
@@ -0,0 +1,44 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.rdoc"
9
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
10
+ rd.title = 'Your application title'
11
+ end
12
+
13
+ spec = eval(File.read('apexgen.gemspec'))
14
+
15
+ Gem::PackageTask.new(spec) do |pkg|
16
+ end
17
+ CUKE_RESULTS = 'results.html'
18
+ CLEAN << CUKE_RESULTS
19
+ desc 'Run features'
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
+ t.cucumber_opts = opts
24
+ t.fork = false
25
+ end
26
+
27
+ desc 'Run features tagged as work-in-progress (@wip)'
28
+ Cucumber::Rake::Task.new('features:wip') do |t|
29
+ tag_opts = ' --tags ~@pending'
30
+ tag_opts = ' --tags @wip'
31
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
+ t.fork = false
33
+ end
34
+
35
+ task :cucumber => :features
36
+ task 'cucumber:wip' => 'features:wip'
37
+ task :wip => 'features:wip'
38
+ require 'rake/testtask'
39
+ Rake::TestTask.new do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/*_test.rb']
42
+ end
43
+
44
+ task :default => [:test,:features]
@@ -0,0 +1,30 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','apexgen','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'apexgen'
5
+ s.version = Apexgen::VERSION
6
+ s.author = 'Brad Dunn'
7
+ s.email = 'brad@braddunn.com'
8
+ s.homepage = 'https://github.com/bdunn313/apexgen'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = %q{Apex code scaffolder for use on salesforce/force.com platforms}
11
+ s.description = %q{Apexgen allows you to generate object XML,
12
+ create scaffolding for triggers, classes and class methods,
13
+ as well as initialize a project. Currently, only object
14
+ XML generation is supported, however the other features described
15
+ above are in active development.}
16
+ s.license = 'MIT'
17
+ # Add your other files here if you make them
18
+ s.files = `git ls-files`.split("\n")
19
+ s.require_paths = ["lib"]
20
+ s.has_rdoc = true
21
+ s.extra_rdoc_files = ['README.rdoc','apexgen.rdoc']
22
+ s.rdoc_options << '--title' << 'apexgen' << '--main' << 'README.rdoc' << '-ri'
23
+ s.bindir = 'bin'
24
+ s.executables << 'apexgen'
25
+ s.add_development_dependency('rake')
26
+ s.add_development_dependency('rdoc')
27
+ s.add_development_dependency('aruba', '~> 0.5.1')
28
+ s.add_runtime_dependency('gli','2.5.0')
29
+ s.add_runtime_dependency('active_support', '~> 3.0.0')
30
+ end
@@ -0,0 +1,5 @@
1
+ = apexgen
2
+
3
+ Generate this with
4
+ apexgen rdoc
5
+ After you have described your command line interface
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'apexgen'
4
+
5
+ include GLI::App
6
+
7
+ program_desc 'A command line app to help generate basic scaffolding for different code used on the salesforce/force.com platforms'
8
+
9
+ version Apexgen::VERSION
10
+
11
+ # desc 'Describe some switch here'
12
+ # switch [:s,:switch]
13
+
14
+ # desc 'Describe some flag here'
15
+ # default_value 'the default'
16
+ # arg_name 'The name of the argument'
17
+ # flag [:f,:flagname]
18
+
19
+ desc 'Generate objects, complete with object fields and field settings.'
20
+ arg_name 'object_name [field...]'
21
+ command :object do |c|
22
+ # c.desc 'Describe a switch to object'
23
+ # c.switch :s
24
+
25
+ # c.desc 'Describe a flag to object'
26
+ # c.default_value 'default'
27
+ # c.flag :f
28
+ c.action do |global_options,options,args|
29
+ # If no arguments are specified, tell user they need to at least name their object
30
+ help_now! "You must specify a custom object name" if args.length == 0
31
+
32
+ # Get the object name
33
+ object_name = args.shift
34
+ # Make the new object
35
+ obj = Apexgen::CustomObject.new object_name, args
36
+ # Your command logic here
37
+
38
+ # If you have any errors, just raise them
39
+ # raise "that command made no sense"
40
+
41
+ # puts "object command ran"
42
+ end
43
+ end
44
+
45
+ pre do |global,command,options,args|
46
+ # Pre logic here
47
+ # Return true to proceed; false to abourt and not call the
48
+ # chosen command
49
+ # Use skips_pre before a command to skip this block
50
+ # on that command only
51
+ true
52
+ end
53
+
54
+ post do |global,command,options,args|
55
+ # Post logic here
56
+ # Use skips_post before a command to skip this
57
+ # block on that command only
58
+ end
59
+
60
+ on_error do |exception|
61
+ # Error logic here
62
+ # return false to skip default error handling
63
+ true
64
+ end
65
+
66
+ exit run(ARGV)
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "apexgen"
8
+ Then the exit status should be 0
@@ -0,0 +1,142 @@
1
+ Feature: Object
2
+ People should be able to create apex objects
3
+ using this application. People should also be
4
+ able to create fields when making the object,
5
+ and specify basic configurations for different
6
+ field types.
7
+
8
+ Scenario: Get help for custom object.
9
+ When I run `apexgen help object`
10
+ Then the stdout should contain "object - Generate objects, complete with object fields and field settings."
11
+
12
+ Scenario: Get help for custom object with help flag.
13
+ When I run `apexgen object --help`
14
+ Then the stdout should contain "object - Generate objects, complete with object fields and field settings."
15
+
16
+ Scenario: Try to create a custom object without a name.
17
+ When I run `apexgen object`
18
+ Then the stderr should contain "You must specify a custom object name"
19
+ And the stdout should contain "object - Generate objects, complete with object fields and field settings."
20
+
21
+ Scenario: Create a custom object.
22
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
23
+ When I successfully run `apexgen object TestObject`
24
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
25
+ And the file "objects/TestObject__c.object" in my current directory should contain "<pluralLabel>Test Objects"
26
+
27
+ Scenario: Create a custom object with one field. The field type defaults to Text.
28
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
29
+ When I successfully run `apexgen object TestObject SomeField`
30
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
31
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
32
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
33
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Text"
34
+
35
+ Scenario: Create a custom object with one field.
36
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
37
+ When I successfully run `apexgen object TestObject SomeField:text`
38
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
39
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
40
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
41
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Text"
42
+
43
+ Scenario: Create a custom object with one field. Type case should not matter.
44
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
45
+ When I successfully run `apexgen object TestObject SomeField:TeXt`
46
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
47
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
48
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
49
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Text"
50
+
51
+ Scenario: Create a custom object with a Text Area and a Text Area Long
52
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
53
+ When I successfully run `apexgen object TestObject SomeField:TextArea AnotherField:LongTextArea`
54
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
55
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
56
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
57
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>TextArea"
58
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
59
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
60
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>LongTextArea"
61
+ And the file "objects/TestObject__c.object" in my current directory should contain "<visibleLines>3"
62
+
63
+ Scenario: Create a custom object with a Rich Text Area and an Encrypted Text Field
64
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
65
+ When I successfully run `apexgen object TestObject SomeField:RichTextArea AnotherField:EncryptedText`
66
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
67
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
68
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
69
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Html"
70
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
71
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
72
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>EncryptedText"
73
+ And the file "objects/TestObject__c.object" in my current directory should contain "<maskChar>asterisk"
74
+
75
+ Scenario: Create a custom object with a Url and an Auto Number Field
76
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
77
+ When I successfully run `apexgen object TestObject SomeField:Url AnotherField:AutoNumber`
78
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
79
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
80
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
81
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Url"
82
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
83
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
84
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>AutoNumber"
85
+ And the file "objects/TestObject__c.object" in my current directory should contain "<displayFormat>{0000}"
86
+
87
+ Scenario: Create a custom object with a Checkbox and a Currency field
88
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
89
+ When I successfully run `apexgen object TestObject SomeField:Checkbox AnotherField:Currency`
90
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
91
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
92
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
93
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Checkbox"
94
+ And the file "objects/TestObject__c.object" in my current directory should contain "<defaultValue>false"
95
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
96
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
97
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Currency"
98
+ And the file "objects/TestObject__c.object" in my current directory should contain "<precision>14"
99
+
100
+ Scenario: Create a custom object with a DateTime and a Date field
101
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
102
+ When I successfully run `apexgen object TestObject SomeField:DateTime AnotherField:Date`
103
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
104
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
105
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
106
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>DateTime"
107
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
108
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
109
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Date"
110
+
111
+ Scenario: Create a custom object with a Geolocation and a Number field
112
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
113
+ When I successfully run `apexgen object TestObject SomeField:Geolocation AnotherField:Number`
114
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
115
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
116
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
117
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Location"
118
+ And the file "objects/TestObject__c.object" in my current directory should contain "<displayLocationInDecimal>false"
119
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
120
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
121
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Number"
122
+ And the file "objects/TestObject__c.object" in my current directory should contain "<precision>18"
123
+
124
+ Scenario: Create a custom object with a Percent and a Phone field
125
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
126
+ When I successfully run `apexgen object TestObject SomeField:Percent AnotherField:Phone`
127
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
128
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
129
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
130
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Percent"
131
+ And the file "objects/TestObject__c.object" in my current directory should contain "<precision>18"
132
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Another_Field__c"
133
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Another Field"
134
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Phone"
135
+
136
+ Scenario: Create a custom object with an field
137
+ Given the file "objects/TestObject__c.object" doesn't exist in my current directory
138
+ When I successfully run `apexgen object TestObject SomeField:Email`
139
+ Then a file named "objects/TestObject__c.object" should exist in my current directory
140
+ And the file "objects/TestObject__c.object" in my current directory should contain "<fullName>Some_Field__c"
141
+ And the file "objects/TestObject__c.object" in my current directory should contain "<label>Some Field"
142
+ And the file "objects/TestObject__c.object" in my current directory should contain "<type>Email"