page_object_stubs 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89267a772ad21e08e93bed62d7b14fbd80980ced
4
- data.tar.gz: 0ab37018da064df14bbd8ddb30355067c12940ef
3
+ metadata.gz: 492eea0b43d7ad7166ada2f764bd0b3d499c2dac
4
+ data.tar.gz: 549e2f9a33cb1e4b45a10109857c530224c26ec8
5
5
  SHA512:
6
- metadata.gz: 56e0a0f78722d2d942e6d3db246c02101379e09e437a7cc196a1d2cc862ca254a3a236370a6170bcb85a7b099931f114a539857d773243f5d991dac22ffb4596
7
- data.tar.gz: 8a55b50cd2b826cc007063bfd17ae66dba18ba8607dbad6c46242a5e563a941dae338000d17c05fac2b17037219914c1c9f7fb86c381c95ff623d420d16a37ff
6
+ metadata.gz: 87f238ea9b222ba49cd73b0b8d036d3bbc42fe6891defbe1e514fa790bbb522e3986ae45532dd151a6b98062c096cee04fe83b554c019a2cb087d317230ab468
7
+ data.tar.gz: c9657aadac3e4c309d6440f119d0eb81590536290f4b8cadbb40e77374f2a06933bf61df1d46a016f1fe2b0d57fb671029a0678b26f282d5459b2b319f53fe81
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
 
11
11
  spec/actual_stub/
12
+ *.gem
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # PageObjectStubs [![Build Status](https://travis-ci.org/bootstraponline/page_object_stubs.svg?branch=master)](https://travis-ci.org/bootstraponline/page_object_stubs)
1
+ # PageObjectStubs [![Build Status](https://travis-ci.org/bootstraponline/page_object_stubs.svg?branch=master)](https://travis-ci.org/bootstraponline/page_object_stubs) [![Gem Version](https://badge.fury.io/rb/page_object_stubs.svg)](https://rubygems.org/gems/page_object_stubs)
2
2
 
3
- PageObject stub generator for RubyMine.
3
+ [PageObject](https://github.com/cheezy/page-object) stub generator for RubyMine.
4
4
 
5
5
  ```ruby
6
- targets = Dir.glob(File.join(__dir__, '..', 'page', '*_page.rb'))
7
- output = File.join(__dir__, '..', 'stub')
8
- PageObjectStubs.generate targets: targets, output: output
6
+ targets = Dir.glob(File.join(__dir__, '..', 'page', '*_page.rb'))
7
+ output_folder = File.join(__dir__, '..', 'stub')
8
+ PageObjectStubs.generate targets: targets, output_folder: output_folder, angularjs: false
9
9
  ```
10
10
 
11
11
  ```ruby
@@ -13,8 +13,9 @@ PageObjectStubs.generate targets: targets, output: output
13
13
  # target_filename_stub.rb
14
14
  #
15
15
  # @param [Hash] opts
16
- # @option opts [File] :targets Array of target files to create stubs from
17
- # @option opts [Dir] :output_folder Folder to create stubs in
16
+ # @option opts [Array<File>] :targets Array of target files to create stubs from (required)
17
+ # @option opts [Dir] :output_folder Folder to create stubs in (required)
18
+ # @option opts [Boolean] :angularjs Enable angularjs support (optional, default false)
18
19
  def generate opts={}
19
20
  ```
20
21
 
@@ -6,3 +6,4 @@ require 'fileutils'
6
6
  require_relative 'page_object_stubs/version'
7
7
  require_relative 'page_object_stubs/ast_processor'
8
8
  require_relative 'page_object_stubs/page_object_stubs'
9
+ require_relative 'page_object_stubs/raketask'
@@ -10,7 +10,7 @@ module PageObjectStubs
10
10
  # ```
11
11
  #
12
12
  # @param [Hash] opts
13
- # @option opts [File] :targets Array of target files to create stubs from (required)
13
+ # @option opts [Array<File>] :targets Array of target files to create stubs from (required)
14
14
  # @option opts [Dir] :output_folder Folder to create stubs in (required)
15
15
  # @option opts [Boolean] :angularjs Enable angularjs support (optional, default false)
16
16
  def generate opts={}
@@ -0,0 +1,32 @@
1
+ module PageObjectStubs
2
+ class << self
3
+
4
+ # Adds stubs task to Rake
5
+ #
6
+ # @param [Hash] opts
7
+ # @option opts [String] :task_name the name of the stubs task (optional)
8
+ # @option opts [String] :task_desc the description of the stubs task (optional)
9
+ # @option opts [lambda] :targets lambda that will return an array of targets (optional)
10
+ # @option opts [lambda] :targets lambda that will return the output folder (optional)
11
+ # @option opts [Boolean] :angularjs generate angularjs stubs. default true (optional)
12
+ def add_stubs_task opts={}
13
+ task_name = opts.fetch(:task_name, 'stubs')
14
+ task_desc = opts.fetch(:task_desc, 'Generate stubs')
15
+
16
+ # Get the dir that contains the Rakefile via Rake (__dir__ will not work)
17
+ targets = opts.fetch(:targets, lambda { Dir.glob(File.join(Rake.application.original_dir, 'page', '*_page.rb')) })
18
+ output_folder = opts.fetch(:output_folder, lambda { File.join(Rake.application.original_dir, 'helper', 'stub') })
19
+ angularjs = opts.fetch(:angularjs, true)
20
+
21
+ raise 'targets must be a lambda' unless targets.lambda?
22
+ raise 'output_folder must be a lambda' unless output_folder.lambda?
23
+
24
+ Rake.application.last_description = task_desc
25
+ Rake::Task.define_task task_name do |task|
26
+ PageObjectStubs.generate targets: targets.call,
27
+ output_folder: output_folder.call,
28
+ angularjs: angularjs
29
+ end
30
+ end
31
+ end
32
+ end if defined?(Rake::Task)
@@ -1,4 +1,4 @@
1
1
  module PageObjectStubs
2
- VERSION = '0.0.1' unless defined? ::PageObjectStubs::VERSION
3
- DATE = '2015-05-09' unless defined? ::PageObjectStubs::DATE
2
+ VERSION = '0.0.2' unless defined? ::PageObjectStubs::VERSION
3
+ DATE = '2015-05-10' unless defined? ::PageObjectStubs::DATE
4
4
  end
data/release_notes.md ADDED
@@ -0,0 +1,6 @@
1
+ #### v0.0.2 2015-05-10
2
+
3
+ - [7b9acc7](https://github.com/bootstraponline/page_object_stubs/commit/7b9acc7020c98d1beb6de6f108ac64a765f14428) Release 0.0.2
4
+ - [5df8330](https://github.com/bootstraponline/page_object_stubs/commit/5df833016e619e2a8e0b76eb71bcd4b0b3af8341) Fix Rake task
5
+ - [d3d6c8b](https://github.com/bootstraponline/page_object_stubs/commit/d3d6c8bc66e9e711ab085e7b0f711e84843e5247) Update README.md
6
+ - [f7f871f](https://github.com/bootstraponline/page_object_stubs/commit/f7f871f0c3e92a85d80cec3800c4f249696b991b) Add gem badge
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_object_stubs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2015-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -112,8 +112,10 @@ files:
112
112
  - lib/page_object_stubs.rb
113
113
  - lib/page_object_stubs/ast_processor.rb
114
114
  - lib/page_object_stubs/page_object_stubs.rb
115
+ - lib/page_object_stubs/raketask.rb
115
116
  - lib/page_object_stubs/version.rb
116
117
  - page_object_stubs.gemspec
118
+ - release_notes.md
117
119
  homepage: https://github.com/bootstraponline/page_object_stubs
118
120
  licenses:
119
121
  - http://www.apache.org/licenses/LICENSE-2.0.txt