calatrava 0.6.7 → 0.6.8

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.
data/CHANGES.markdown CHANGED
@@ -1,3 +1,18 @@
1
+ ## v0.6.8
2
+
3
+ New features:
4
+ * Ability to specify js libraries that need to be loaded with js
5
+ runtime running kernel code.
6
+ Note: This changes the format of manifest.yml
7
+
8
+ Bugs Fixed:
9
+ * [Issue #87][i87]: Fixing Calatrava build errors by changing
10
+ jasmine-node version number
11
+ * [Issue #86][i86]: Files and folders under asset folders are not
12
+ copied recursively
13
+ * [Issue #84][i84]: Clean up automation tasks (a sample feature
14
+ also implemented).
15
+
1
16
  ## v0.6.7
2
17
 
3
18
  New features:
@@ -182,3 +197,6 @@ Changes that will affect existing projects:
182
197
  [i76]: https://github.com/calatrava/calatrava/pull/76
183
198
  [i33]: https://github.com/calatrava/calatrava/issues/33
184
199
  [i83]: https://github.com/calatrava/calatrava/issues/83
200
+ [i87]: https://github.com/calatrava/calatrava/pull/87
201
+ [i86]: https://github.com/calatrava/calatrava/pull/86
202
+ [i84]: https://github.com/calatrava/calatrava/pull/84
@@ -22,11 +22,27 @@ module Calatrava
22
22
  "#{build_scripts_dir}/#{File.basename(cf, '.coffee')}.js"
23
23
  end
24
24
 
25
- def load_instructions
25
+ def change_path_to_relative files, &change_file_path
26
26
  build_path = Pathname.new(File.dirname(build_dir))
27
- @manifest.kernel_bootstrap.collect do |cf|
28
- Pathname.new(js_file(cf)).relative_path_from(build_path).to_s
29
- end.join($/)
27
+ files.collect do |file_to_add|
28
+ Pathname.new(change_file_path.call(file_to_add)).relative_path_from(build_path).to_s
29
+ end
30
+ end
31
+
32
+ def library_files
33
+ change_path_to_relative @manifest.kernel_libraries do |js_library|
34
+ "#{build_scripts_dir}/#{File.basename(js_library)}"
35
+ end
36
+ end
37
+
38
+ def feature_files
39
+ change_path_to_relative @manifest.kernel_bootstrap do |coffee_file|
40
+ js_file(coffee_file)
41
+ end
42
+ end
43
+
44
+ def load_instructions
45
+ feature_files.concat(library_files).join($/)
30
46
  end
31
47
 
32
48
  def haml_files
@@ -8,7 +8,13 @@ module Calatrava
8
8
  def initialize(path, app_dir, kernel, shell)
9
9
  @path, @kernel, @shell = path, kernel, shell
10
10
  @src_file = "#{app_dir}/manifest.yml"
11
- @feature_list = YAML.load(IO.read("#{@path}/#{@src_file}"))
11
+ files_to_load = YAML.load(IO.read("#{@path}/#{@src_file}"))
12
+ @feature_list = files_to_load["features"]
13
+ @kernel_libraries = files_to_load["kernel_libs"] || []
14
+ end
15
+
16
+ def kernel_libraries
17
+ @kernel_libraries
12
18
  end
13
19
 
14
20
  def features
@@ -1,5 +1,5 @@
1
1
  def cp_ne(source, dest_dir)
2
- cp Dir[source], dest_dir
2
+ cp_r Dir[source], dest_dir, :remove_destination => true
3
3
  end
4
4
 
5
5
  def coffee(in_dir_or_file, out_dir)
@@ -8,4 +8,4 @@ def coffee(in_dir_or_file, out_dir)
8
8
  ok = system "node_modules/coffee-script/bin/coffee --compile --output #{out_dir} #{in_dir_or_file}"
9
9
  fail "Error compiling CoffeeScript: '#{in_dir_or_file}'" if !ok
10
10
  end
11
- end
11
+ end
@@ -1,27 +1,16 @@
1
+ ROOT_DIR ||= ".".freeze
1
2
  FEATURES_DIR = File.join('.', 'features').freeze
2
3
  FEATURE_RESULTS_DIR = File.join('.', 'results').freeze
3
4
 
4
5
  namespace :automation do
5
6
  namespace :web do
6
7
  desc "Runs cucumber tests against the web app"
7
- task :features, [:file] => [:create_sim_link, :copy_steps_file, :clean_up_results_dir] do |t, args|
8
+ task :features, [:file] => [:clean_up_results_dir] do |t, args|
8
9
  ENV['PATH'] = "#{ROOT_DIR}/web/features:#{ENV['PATH']}"
9
10
  features_to_be_run = args[:file] ? "#{FEATURES_DIR}/#{args[:file]}" : FEATURES_DIR
10
11
  sh "cucumber --strict --tags @all,@web --tags ~@wip #{features_to_be_run} --format html --out #{FEATURE_RESULTS_DIR}/report.html --format pretty"
11
12
  end
12
13
 
13
- desc "create sim link for the ios step_definitions and support folder"
14
- task :create_sim_link do
15
- sh "rm -rf #{FEATURES_DIR}/step_definitions"
16
- sh "rm -rf #{FEATURES_DIR}/support"
17
- end
18
-
19
- desc "copy the web_steps file to web_steps.rb"
20
- task :copy_steps_file do
21
- sh "rm -f #{FEATURES_DIR}/*.rb"
22
- sh "cp #{FEATURES_DIR}/web_steps #{FEATURES_DIR}/web_steps.rb"
23
- end
24
-
25
14
  desc "delete and create the results dir"
26
15
  task :clean_up_results_dir do
27
16
  sh "rm -rf #{FEATURE_RESULTS_DIR}"
@@ -7,3 +7,7 @@ gem "cocoapods", ">= 0.16.0"{{/mac?}}
7
7
 
8
8
  #auto compile shell and kernel for webapp. If you remove this, it'll stop auto compiling
9
9
  gem "filewatcher"
10
+
11
+ group :test do
12
+ gem 'rspec'
13
+ end
@@ -1 +1,4 @@
1
- - converter
1
+ features:
2
+ - converter
3
+ kernel_libs:
4
+ # - assets/lib/underscore.js
@@ -0,0 +1,10 @@
1
+ Feature: Converter
2
+ As an international traveller
3
+ I want to check if I am getting a good exchange rate
4
+ So that I can haggle and get a better rate
5
+
6
+ @web
7
+ Scenario: Converting to Aussie dollars
8
+ Given I have 100 USD
9
+ When I check conversion rate to AUD
10
+ Then the result should be greater than 100
@@ -0,0 +1,29 @@
1
+ Before do
2
+ @driver = Selenium::WebDriver.for :firefox
3
+ end
4
+
5
+ After do
6
+ @driver.quit
7
+ end
8
+
9
+ Given(/^I have (\d+) (.*)$/) do |amount, in_currency|
10
+ @driver.get "http://localhost:8888"
11
+ in_currency_selector = Selenium::WebDriver::Support::Select.new(@driver.find_element :id => "in_currency")
12
+ in_currency_selector.select_by :value, in_currency
13
+ in_amount = @driver.find_element :id => "in_amount"
14
+ in_amount.clear
15
+ in_amount.send_keys amount
16
+ end
17
+
18
+ When(/^I check conversion rate to (.*)$/) do |out_currency|
19
+ out_currency_selector = Selenium::WebDriver::Support::Select.new(@driver.find_element :id => "out_currency")
20
+ out_currency_selector.select_by :value, out_currency
21
+ convert_button = @driver.find_element :id => "convert"
22
+ convert_button.click
23
+ end
24
+
25
+ Then(/^the result should be greater than (\d+)$/) do |amount|
26
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3) # seconds
27
+ wait.until { @driver.find_element(:id => "out_amount").attribute("value").to_f > 0 }
28
+ @driver.find_element(:id => "out_amount").attribute("value").to_f.should > amount.to_f
29
+ end
@@ -0,0 +1,2 @@
1
+ require 'selenium-webdriver'
2
+ require 'rspec-expectations'
@@ -1 +1,4 @@
1
- - converter
1
+ features:
2
+ - converter
3
+ kernel_libs:
4
+ # - assets/lib/underscore.js
@@ -8,7 +8,7 @@
8
8
  , "cucumber" : "latest"
9
9
  , "jsdom" : "latest"
10
10
  , "mime" : "latest"
11
- , "jasmine-node" : "1.0.26"
11
+ , "jasmine-node" : "1.5.0"
12
12
  , "should" : "*"
13
13
  , "jasmine-reporters" : "*"
14
14
  , "walkdir" : "*"
@@ -1 +1,4 @@
1
- - converter
1
+ features:
2
+ - converter
3
+ kernel_libs:
4
+ # - assets/lib/underscore.js
@@ -1,3 +1,3 @@
1
1
  module Calatrava
2
- Version = "0.6.7"
2
+ Version = "0.6.8"
3
3
  end
@@ -13,7 +13,8 @@ describe Calatrava::AppBuilder do
13
13
  let(:manifest) { double('web mf',
14
14
  :coffee_files => ['path/to/kernel.coffee', 'diff/path/shell.coffee'],
15
15
  :kernel_bootstrap => ['path/to/kernel.coffee'],
16
- :haml_files => ['diff/path/shell.haml']) }
16
+ :haml_files => ['diff/path/shell.haml'],
17
+ :kernel_libraries => ['path/to/external/kernel_lib.js']) }
17
18
 
18
19
  let(:app) { Calatrava::AppBuilder.new('app', 'app/build', manifest) }
19
20
 
@@ -32,9 +33,10 @@ describe Calatrava::AppBuilder do
32
33
  end
33
34
 
34
35
  context '#load_file' do
35
- subject { app.load_instructions.lines.to_a }
36
+ subject { app.load_instructions.lines.to_a.each(&:chomp!) }
36
37
 
37
38
  it { should include 'build/scripts/kernel.js' }
39
+ it { should include 'build/scripts/kernel_lib.js' }
38
40
  it { should_not include 'build/scripts/shell.js' }
39
41
  end
40
42
 
@@ -43,4 +45,5 @@ describe Calatrava::AppBuilder do
43
45
 
44
46
  it { should include 'diff/path/shell.haml' }
45
47
  end
48
+
46
49
  end
@@ -6,7 +6,7 @@ describe Calatrava::Manifest do
6
6
 
7
7
  before(:each) do
8
8
  create_dir 'app'
9
- write_file 'app/manifest.yml', ['included'].to_yaml
9
+ write_file 'app/manifest.yml', {'features' => ['included'], 'kernel_libs' => ['kernel_lib.js']}.to_yaml
10
10
  end
11
11
 
12
12
  let(:features) { }
@@ -59,4 +59,22 @@ describe Calatrava::Manifest do
59
59
  it { should_not include 'shell_inc' }
60
60
  end
61
61
 
62
+ context '#kernel_libraries' do
63
+ context "#when present" do
64
+ subject { manifest.kernel_libraries }
65
+
66
+ it { should include 'kernel_lib.js'}
67
+ end
68
+
69
+ context "#when not present" do
70
+ before do
71
+ write_file 'app/manifest.yml', {'features' => ['included'], 'kernel_libs' => nil}.to_yaml
72
+ end
73
+
74
+ subject { manifest.kernel_libraries }
75
+
76
+ it { should be_empty}
77
+ end
78
+ end
79
+
62
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calatrava
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-22 00:00:00.000000000 Z
12
+ date: 2013-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -255,6 +255,9 @@ files:
255
255
  - lib/calatrava/templates/droid/calatrava/src/com/calatrava/shell/WebViewActivity.java
256
256
  - lib/calatrava/templates/droid/calatrava/src/com/calatrava/shell/WebViewPageStateManager.java
257
257
  - lib/calatrava/templates/droid/manifest.yml
258
+ - lib/calatrava/templates/features/converter.feature
259
+ - lib/calatrava/templates/features/step_definitions/converter_steps.rb
260
+ - lib/calatrava/templates/features/support/env.rb
258
261
  - lib/calatrava/templates/ios/Podfile.calatrava
259
262
  - lib/calatrava/templates/ios/manifest.yml
260
263
  - lib/calatrava/templates/ios/src/AppDelegate.h