calapog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9cf1e98f504826844d7ba6688eb406dfa0cb1551
4
+ data.tar.gz: 5eb940ea55d6e19e377b768d33bc88fe9f2bb4f0
5
+ SHA512:
6
+ metadata.gz: 9708e0d2cb92feda1cfd9fede5386553089152a3a31fcab0dd88ff25da64a1189c921fbe203104d028febe9eaf43d248f1ae4827aacd5037d10dee4636f176a6
7
+ data.tar.gz: b918e4730c5d7ef1aca887d979a31aa919e2cebe9a08210cf87d42cf80094dec5f0a0f0b8623f91723d65fb3540bb02d10a0857e153c8db8629dee89a05eb488
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .gem
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in calapog.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Nick Stalter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Calapog
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/calapog`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'calapog'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install calapog
22
+
23
+ ## Usage
24
+
25
+ `calapog generate SharedClassPage` will generate the following scaffold(replace Class with the name of your page):
26
+
27
+ * `features/pages/shared_class_name.rb` with the following code:
28
+
29
+ ```ruby
30
+ class SharedClassPage < CommonPage
31
+
32
+ def trait
33
+
34
+ end
35
+
36
+ def page_data_file
37
+ 'class_page'
38
+ end
39
+
40
+ private
41
+ end
42
+ ```
43
+
44
+ * `features/android/pages/class_name.rb` with the following code:
45
+
46
+ ```ruby
47
+ class Android::ClassPage < SharedClassPage
48
+ include Calabash::Android
49
+
50
+ private
51
+ end
52
+ ```
53
+
54
+ * `features/ios/pages/class_name.rb` with the following code:
55
+
56
+ ```ruby
57
+ class IOS::ClassPage < SharedClassPage
58
+ include Calabash::IOS
59
+
60
+ private
61
+ end
62
+ ```
63
+
64
+ ## Contributing
65
+
66
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/calapog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
67
+
68
+
69
+ ## License
70
+
71
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
72
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/calapog ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "calapog"
4
+
5
+ Calapog::Main.start(ARGV)
data/calapog.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'calapog/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "calapog"
8
+ spec.version = Calapog::VERSION
9
+ spec.authors = ["Nick Stalter"]
10
+ spec.email = ["nickstalter@gmail.com"]
11
+ spec.summary = %q{Calabash Page Object Generator to be paired with my boilerplate}
12
+ spec.description = %q{CALAbash Page Object Generator is to be used for generating cross platform pages to cut down on the amount of code we have to write}
13
+ spec.homepage = "https://gitlab.com/distortia/calapog"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.bindir = 'bin'
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'thor', "~> 0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Calapog
2
+ VERSION = "0.1.0"
3
+ end
data/lib/calapog.rb ADDED
@@ -0,0 +1,61 @@
1
+ require "calapog/version"
2
+ # require "calapog/cli"
3
+ require 'thor'
4
+
5
+ module Calapog
6
+ class Main < Thor
7
+ desc "generate SharedClassPage", "This will generate the appropriate Calabash page object pages"
8
+ long_desc <<-GENERATE
9
+ `generate SharedClassPage` scaffolds the 3 seperate pages required for cross platform calabash page object play.\n
10
+ Default directory structure is:\n
11
+ shared_class_page => /features/pages/\n
12
+ class_page => /features/android/pages & /features/ios/pages\n
13
+ GENERATE
14
+ def generate(name)
15
+ puts "Generating: features/pages/#{name}"
16
+ # class_name, file_name, data_file_name
17
+ Template.shared_template(name, Utility.underscore(name), Utility.unshare(Utility.underscore(name)))
18
+ puts "Generating: features/android/pages/#{Utility.unshare(Utility.underscore(name))}"
19
+ # class_name, file_name, shared_class_name
20
+ Template.android_template(Utility.unshare(name), Utility.unshare(Utility.underscore(name)), name)
21
+ puts "Generating: features/ios/pages/#{Utility.unshare(Utility.underscore(name))}"
22
+ # class_name, file_name, shared_class_name
23
+ Template.ios_template(Utility.unshare(name), Utility.unshare(Utility.underscore(name)), name)
24
+ end
25
+ end
26
+
27
+ class Utility
28
+ def self.underscore(camel_cased_word)
29
+ camel_cased_word.to_s.gsub(/::/, '/').
30
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
31
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
32
+ tr("-", "_").
33
+ downcase
34
+ end
35
+
36
+ def self.unshare(name)
37
+ return name.gsub('Shared', '') if name.include? 'Shared'
38
+ return name.gsub('shared_', '') if name.include? 'shared'
39
+ end
40
+ end
41
+
42
+ class Template
43
+ def self.shared_template(class_name, file_name, data_file_name)
44
+ File.open("features/pages/#{file_name}.rb", "w+") do |file|
45
+ file.write "class #{class_name} < CommonPage\n\n def trait\n\n end\n\n def page_data_file\n '#{data_file_name}'\n end\n\n private\nend"
46
+ end
47
+ end
48
+
49
+ def self.android_template(class_name, file_name, shared_class_name)
50
+ File.open("features/android/pages/#{file_name}.rb", "w+") do |file|
51
+ file.write "class Android::#{class_name} < #{shared_class_name}\n include Calabash::Android\n\n private\nend"
52
+ end
53
+ end
54
+
55
+ def self.ios_template(class_name, file_name, shared_class_name)
56
+ File.open("features/ios/pages/#{file_name}.rb", "w+") do |file|
57
+ file.write "class IOS::#{class_name} < #{shared_class_name}\n include Calabash::IOS\n\n private\nend"
58
+ end
59
+ end
60
+ end
61
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: calapog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nick Stalter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: CALAbash Page Object Generator is to be used for generating cross platform
56
+ pages to cut down on the amount of code we have to write
57
+ email:
58
+ - nickstalter@gmail.com
59
+ executables:
60
+ - calapog
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/calapog
71
+ - calapog.gemspec
72
+ - lib/calapog.rb
73
+ - lib/calapog/version.rb
74
+ homepage: https://gitlab.com/distortia/calapog
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Calabash Page Object Generator to be paired with my boilerplate
98
+ test_files: []